| 99 | } |
| 100 | |
| 101 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override |
| 102 | { |
| 103 | if(index.isValid()) |
| 104 | { |
| 105 | int row = index.row(); |
| 106 | int col = index.column(); |
| 107 | |
| 108 | if(col >= 0 && col < columnCount() && row < rowCount()) |
| 109 | { |
| 110 | const LogMessage &msg = m_Viewer->m_Messages[row]; |
| 111 | |
| 112 | if(role == Qt::DisplayRole) |
| 113 | { |
| 114 | switch(col) |
| 115 | { |
| 116 | case Column_Source: return msg.Source; |
| 117 | case Column_PID: return QString::number(msg.PID); |
| 118 | case Column_Timestamp: return msg.Timestamp.toString(lit("HH:mm:ss")); |
| 119 | case Column_Location: return msg.Location; |
| 120 | case Column_Type: return ToQStr(msg.Type); |
| 121 | case Column_Message: |
| 122 | { |
| 123 | QVariant desc = msg.Message; |
| 124 | RichResourceTextInitialise(desc, &m_Viewer->m_Ctx); |
| 125 | return desc; |
| 126 | } |
| 127 | default: break; |
| 128 | } |
| 129 | } |
| 130 | else if(msg.Type == LogType::Error) |
| 131 | { |
| 132 | if(role == Qt::BackgroundRole) |
| 133 | return QBrush(QColor(255, 70, 70)); |
| 134 | if(role == Qt::ForegroundRole) |
| 135 | return QBrush(QColor(0, 0, 0)); |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | return QVariant(); |
| 141 | } |
| 142 | |
| 143 | private: |
| 144 | LogView *m_Viewer; |
no test coverage detected