diff options
| author | Alexander Taylor <alex@vector35.com> | 2025-04-02 20:03:51 -0400 |
|---|---|---|
| committer | Alexander Taylor <alex@vector35.com> | 2025-04-02 20:03:51 -0400 |
| commit | 1b32a95b3a88567b349e1d3a57dea2fea9f42961 (patch) | |
| tree | cce799bc75a63fe5dc6a4606e9a02b2ecb252dc7 /view/sharedcache/ui/symboltable.cpp | |
| parent | 58568cd94ea54723b95eaae83ccc387415ff8547 (diff) | |
Styling for data in shared cache view.
Diffstat (limited to 'view/sharedcache/ui/symboltable.cpp')
| -rw-r--r-- | view/sharedcache/ui/symboltable.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/view/sharedcache/ui/symboltable.cpp b/view/sharedcache/ui/symboltable.cpp index f4a062da..c96ce086 100644 --- a/view/sharedcache/ui/symboltable.cpp +++ b/view/sharedcache/ui/symboltable.cpp @@ -3,6 +3,8 @@ #include <QHeaderView> +#include "ui/fontsettings.h" + #include "binaryninjaapi.h" using namespace BinaryNinja; @@ -10,6 +12,8 @@ using namespace SharedCacheAPI; SymbolTableModel::SymbolTableModel(SymbolTableView* parent) : QAbstractTableModel(parent), m_parent(parent) { + // TODO: Need to implement updating this font if it is changed by the user + m_font = getMonospaceFont(parent); } int SymbolTableModel::rowCount(const QModelIndex& parent) const { @@ -24,20 +28,31 @@ int SymbolTableModel::columnCount(const QModelIndex& parent) const { } QVariant SymbolTableModel::data(const QModelIndex& index, int role) const { - if (!index.isValid() || role != Qt::DisplayRole) { + if (!index.isValid() || (role != Qt::DisplayRole && role != Qt::FontRole)) { return QVariant(); } - auto symbol = symbolAt(index.row()); - auto symbolType = GetSymbolTypeAsString(symbol.type); + switch (role) + { + case Qt::DisplayRole: + { + auto symbol = symbolAt(index.row()); + auto symbolType = GetSymbolTypeAsString(symbol.type); - switch (index.column()) { - case 0: // Address column - return QString("0x%1").arg(symbol.address, 0, 16); // Display address as hexadecimal - case 1: // Type column - return QString::fromUtf8(symbolType.c_str(), symbolType.size()); - case 2: // Name column - return QString::fromUtf8(symbol.name.c_str(), symbol.name.size()); + switch (index.column()) + { + case 0: // Address column + return QString("0x%1").arg(symbol.address, 0, 16); // Display address as hexadecimal + case 1: // Type column + return QString::fromUtf8(symbolType.c_str(), symbolType.size()); + case 2: // Name column + return QString::fromUtf8(symbol.name.c_str(), symbol.name.size()); + default: + return QVariant(); + } + } + case Qt::FontRole: + return m_font; default: return QVariant(); } |
