| 88 | } |
| 89 | |
| 90 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override |
| 91 | { |
| 92 | if(index.isValid() && (role == Qt::DisplayRole || role == SortDataRole)) |
| 93 | { |
| 94 | bool sort = (role == SortDataRole); |
| 95 | |
| 96 | int row = index.row(); |
| 97 | int col = index.column(); |
| 98 | |
| 99 | if(col >= 0 && col < columnCount() && row < rowCount()) |
| 100 | { |
| 101 | const DebugMessage &msg = m_Ctx.DebugMessages()[row]; |
| 102 | |
| 103 | switch(col) |
| 104 | { |
| 105 | case 0: return msg.eventId; |
| 106 | case 1: return ToQStr(msg.source); |
| 107 | case 2: return sort ? QVariant((uint32_t)msg.severity) : QVariant(ToQStr(msg.severity)); |
| 108 | case 3: return ToQStr(msg.category); |
| 109 | case 4: return msg.messageID; |
| 110 | case 5: |
| 111 | { |
| 112 | QVariant desc = msg.description; |
| 113 | RichResourceTextInitialise(desc, &m_Ctx, true); |
| 114 | return desc; |
| 115 | } |
| 116 | default: break; |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | if(index.isValid() && role == EIDRole && index.row() >= 0 && |
| 122 | index.row() < m_Ctx.DebugMessages().count()) |
| 123 | return m_Ctx.DebugMessages()[index.row()].eventId; |
| 124 | |
| 125 | return QVariant(); |
| 126 | } |
| 127 | |
| 128 | private: |
| 129 | ICaptureContext &m_Ctx; |
no test coverage detected