summaryrefslogtreecommitdiff
path: root/view/sharedcache/ui/symboltable.h
diff options
context:
space:
mode:
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