QTfrontend/model/roomslistmodel.cpp
changeset 6987 e34415c77342
parent 6983 ede55af89e78
child 6993 47830cf50574
equal deleted inserted replaced
6986:409dd3851309 6987:e34415c77342
    90     if ((column < 0) || (column >= c_nColumns))
    90     if ((column < 0) || (column >= c_nColumns))
    91         return QVariant();
    91         return QVariant();
    92 
    92 
    93     // not a role we have data for
    93     // not a role we have data for
    94     if (role != Qt::DisplayRole)
    94     if (role != Qt::DisplayRole)
    95         // only decorate name column
    95         // only custom-align counters
    96         if ((role != Qt::DecorationRole) || (column != 1))
    96         if ((role != Qt::TextAlignmentRole) || (column < 2) || (column > 3))
    97             // only dye map column
    97             // only decorate name column
    98             if ((role != Qt::ForegroundRole) || (column != 5))
    98             if ((role != Qt::DecorationRole) || (column != 1))
    99                 return QVariant();
    99                 // only dye map column
       
   100                 if ((role != Qt::ForegroundRole) || (column != 5))
       
   101                     return QVariant();
   100 
   102 
   101     // decorate room name based on room state
   103     // decorate room name based on room state
   102     if (role == Qt::DecorationRole)
   104     if (role == Qt::DecorationRole)
   103     {
   105     {
   104         const QIcon roomBusyIcon(":/res/iconDamage.png");
   106         const QIcon roomBusyIcon(":/res/iconDamage.png");
   144             return QBrush(QColor("darkred"));
   146             return QBrush(QColor("darkred"));
   145         else
   147         else
   146             return QVariant();
   148             return QVariant();
   147     }
   149     }
   148 
   150 
       
   151     if (role == Qt::TextAlignmentRole)
       
   152     {
       
   153         return (int)(Qt::AlignHCenter | Qt::AlignVCenter);
       
   154     }
       
   155 
   149     Q_ASSERT(false);
   156     Q_ASSERT(false);
   150     return QVariant();
   157     return QVariant();
   151 }
   158 }
   152 
   159 
   153 
   160