| 32 | |
| 33 | |
| 34 | QVariant SymbolTableModel::data(const QModelIndex& index, int role) const { |
| 35 | if (!index.isValid() || (role != Qt::DisplayRole && role != Qt::FontRole)) { |
| 36 | return QVariant(); |
| 37 | } |
| 38 | |
| 39 | switch (role) |
| 40 | { |
| 41 | case Qt::DisplayRole: |
| 42 | { |
| 43 | auto symbol = symbolAt(index.row()); |
| 44 | auto symbolType = GetSymbolTypeAsString(symbol.type); |
| 45 | |
| 46 | switch (index.column()) |
| 47 | { |
| 48 | case 0: // Address column |
| 49 | return QString("0x%1").arg(symbol.address, 0, 16); // Display address as hexadecimal |
| 50 | case 1: // Type column |
| 51 | return QString::fromUtf8(symbolType.c_str(), symbolType.size()); |
| 52 | case 2: // Name column |
| 53 | return QString::fromUtf8(symbol.name.c_str(), symbol.name.size()); |
| 54 | default: |
| 55 | return QVariant(); |
| 56 | } |
| 57 | } |
| 58 | case Qt::FontRole: |
| 59 | return m_font; |
| 60 | default: |
| 61 | return QVariant(); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | |
| 66 | QVariant SymbolTableModel::headerData(int section, Qt::Orientation orientation, int role) const { |
no test coverage detected