summaryrefslogtreecommitdiff
path: root/view/sharedcache/ui/symboltable.h
diff options
context:
space:
mode:
authorAlexander Taylor <alex@vector35.com>2025-04-14 11:15:01 -0400
committerAlexander Taylor <alex@vector35.com>2025-04-14 14:53:51 -0400
commit507935f828188047ee009d2216a2c2d92c8b83fd (patch)
tree4247355ef5788809c8e47fc11e345a623f053196 /view/sharedcache/ui/symboltable.h
parent37e20cc30d57fff6b78bf6be9be2230a8ff973cc (diff)
Fixes for multiple issues in DSC/KC Triage views.
1. Crash on kernel cache image load 2. Duplicate Load Image buttons in kernel cache view 3. Improper selection behavior in both views 4. Address column should no longer resize to be smaller than contents 5. Symbol tables should now be properly sortable
Diffstat (limited to 'view/sharedcache/ui/symboltable.h')
-rw-r--r--view/sharedcache/ui/symboltable.h47
1 files changed, 27 insertions, 20 deletions
diff --git a/view/sharedcache/ui/symboltable.h b/view/sharedcache/ui/symboltable.h
index 2fc5c892..51ba88f0 100644
--- a/view/sharedcache/ui/symboltable.h
+++ b/view/sharedcache/ui/symboltable.h
@@ -2,12 +2,13 @@
#include <sharedcacheapi.h>
#include "viewframe.h"
-#include "animation.h"
#include <QTableView>
#include <QStandardItemModel>
#include "filter.h"
+#ifndef BINARYNINJA_DSCSYMBOLTABLE_H
+#define BINARYNINJA_DSCSYMBOLTABLE_H
class SymbolTableView;
@@ -29,9 +30,11 @@ public:
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 sort(int column, Qt::SortOrder order) override;
void updateSymbols(std::vector<SharedCacheAPI::CacheSymbol>&& symbols);
void setFilter(std::string text);
const SharedCacheAPI::CacheSymbol& symbolAt(int row) const;
+
};
@@ -44,45 +47,46 @@ Q_OBJECT
public:
explicit SymbolTableView(QWidget* parent);
-
~SymbolTableView() override;
+ // Call this to populate the symbols from the given view.
+ void populateSymbols(BinaryNinja::BinaryView& view);
+
void scrollToFirstItem() override
{
- if (model()->rowCount() > 0)
- {
- scrollTo(model()->index(0, 0));
+ if (model()->rowCount() > 0) {
+ QModelIndex top = indexAt(rect().topLeft());
+ if (top.isValid())
+ scrollTo(top);
}
}
- // 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 selectFirstItem() override
{
- if (model()->rowCount() > 0)
- {
- QModelIndex firstIndex = model()->index(0, 0);
- selectionModel()->select(firstIndex, QItemSelectionModel::ClearAndSelect);
+ if (model()->rowCount() > 0) {
+ QModelIndex top = indexAt(rect().topLeft());
+ if (top.isValid()) {
+ selectionModel()->select(top, QItemSelectionModel::ClearAndSelect);
+ setCurrentIndex(top);
+ }
}
}
void activateFirstItem() override
{
- if (model()->rowCount() > 0)
- {
- QModelIndex firstIndex = model()->index(0, 0);
- setCurrentIndex(firstIndex);
- emit activated(firstIndex);
+ if (model()->rowCount() > 0) {
+ QModelIndex topLeft = indexAt(rect().topLeft());
+ if (topLeft.isValid()) {
+ setCurrentIndex(topLeft);
+ emit activated(topLeft);
+ }
}
}
@@ -92,4 +96,7 @@ public:
}
void setFilter(const std::string& filter) override;
-}; \ No newline at end of file
+};
+
+
+#endif // BINARYNINJA_DSCSYMBOLTABLE_H