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.h | |
| parent | 58568cd94ea54723b95eaae83ccc387415ff8547 (diff) | |
Styling for data in shared cache view.
Diffstat (limited to 'view/sharedcache/ui/symboltable.h')
| -rw-r--r-- | view/sharedcache/ui/symboltable.h | 117 |
1 files changed, 63 insertions, 54 deletions
diff --git a/view/sharedcache/ui/symboltable.h b/view/sharedcache/ui/symboltable.h index 53c71874..2fc5c892 100644 --- a/view/sharedcache/ui/symboltable.h +++ b/view/sharedcache/ui/symboltable.h @@ -8,79 +8,88 @@ #include <QStandardItemModel> #include "filter.h" + class SymbolTableView; -class SymbolTableModel : public QAbstractTableModel { - Q_OBJECT - SymbolTableView* m_parent; - std::string m_filter; - std::vector<SharedCacheAPI::CacheSymbol> m_preparedSymbols {}; - // the symbols we actually use. - std::vector<SharedCacheAPI::CacheSymbol> m_modelSymbols {}; +class SymbolTableModel : public QAbstractTableModel +{ +Q_OBJECT + SymbolTableView* m_parent; + QFont m_font; + std::string m_filter; + std::vector<SharedCacheAPI::CacheSymbol> m_preparedSymbols{}; + // These are the symbols we actually use + std::vector<SharedCacheAPI::CacheSymbol> m_modelSymbols{}; public: - explicit SymbolTableModel(SymbolTableView* parent); - - int rowCount(const QModelIndex& parent = QModelIndex()) const override; - int columnCount(const QModelIndex& parent = QModelIndex()) const override; - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + explicit SymbolTableModel(SymbolTableView* parent); - void updateSymbols(std::vector<SharedCacheAPI::CacheSymbol>&& symbols); - - void setFilter(std::string text); - - const SharedCacheAPI::CacheSymbol& symbolAt(int row) const; + int rowCount(const QModelIndex& parent) const override; + int columnCount(const QModelIndex& parent) const override; + QVariant data(const QModelIndex& index, int role) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + void updateSymbols(std::vector<SharedCacheAPI::CacheSymbol>&& symbols); + void setFilter(std::string text); + const SharedCacheAPI::CacheSymbol& symbolAt(int row) const; }; class SymbolTableView : public QTableView, public FilterTarget { - Q_OBJECT - friend class SymbolTableModel; +Q_OBJECT + friend class SymbolTableModel; - SymbolTableModel* m_model; + SymbolTableModel* m_model; public: - SymbolTableView(QWidget* parent); - virtual ~SymbolTableView() override; + explicit SymbolTableView(QWidget* parent); + + ~SymbolTableView() override; - void scrollToFirstItem() override { - if (model()->rowCount() > 0) { - scrollTo(model()->index(0, 0)); - } - } + void scrollToFirstItem() override + { + if (model()->rowCount() > 0) + { + scrollTo(model()->index(0, 0)); + } + } - // Call this to populate the symbols from the given view. - void populateSymbols(BinaryNinja::BinaryView& view); + // Call this to populate the symbols from the given view. + void populateSymbols(BinaryNinja::BinaryView& view); - void scrollToCurrentItem() override { - QModelIndex currentIndex = selectionModel()->currentIndex(); - if (currentIndex.isValid()) { - scrollTo(currentIndex); - } - } + void scrollToCurrentItem() override + { + QModelIndex currentIndex = selectionModel()->currentIndex(); + if (currentIndex.isValid()) + { + scrollTo(currentIndex); + } + } - void selectFirstItem() override { - if (model()->rowCount() > 0) { - QModelIndex firstIndex = model()->index(0, 0); - selectionModel()->select(firstIndex, QItemSelectionModel::ClearAndSelect); - } - } + void selectFirstItem() override + { + if (model()->rowCount() > 0) + { + QModelIndex firstIndex = model()->index(0, 0); + selectionModel()->select(firstIndex, QItemSelectionModel::ClearAndSelect); + } + } - void activateFirstItem() override { - if (model()->rowCount() > 0) { - QModelIndex firstIndex = model()->index(0, 0); - setCurrentIndex(firstIndex); - emit activated(firstIndex); - } - } + void activateFirstItem() override + { + if (model()->rowCount() > 0) + { + QModelIndex firstIndex = model()->index(0, 0); + setCurrentIndex(firstIndex); + emit activated(firstIndex); + } + } - SharedCacheAPI::CacheSymbol getSymbolAtRow(int row) const - { - return m_model->symbolAt(row); - } + SharedCacheAPI::CacheSymbol getSymbolAtRow(int row) const + { + return m_model->symbolAt(row); + } - void setFilter(const std::string& filter) override; + void setFilter(const std::string& filter) override; };
\ No newline at end of file |
