cutter/src/widgets/EntrypointWidget.cpp

53 lines
1.3 KiB
C++
Raw Normal View History

#include "EntrypointWidget.h"
#include "ui_EntrypointWidget.h"
2017-10-01 19:09:42 +00:00
#include "MainWindow.h"
#include "utils/Helpers.h"
#include <QTreeWidget>
#include <QPen>
/*
* Entrypoint Widget
*/
EntrypointWidget::EntrypointWidget(MainWindow *main, QAction *action) :
CutterDockWidget(main, action),
ui(new Ui::EntrypointWidget)
{
ui->setupUi(this);
setScrollMode();
connect(Core(), SIGNAL(refreshAll()), this, SLOT(fillEntrypoint()));
}
EntrypointWidget::~EntrypointWidget() {}
void EntrypointWidget::fillEntrypoint()
{
ui->entrypointTreeWidget->clear();
2018-04-12 06:33:30 +00:00
for (auto i : Core()->getAllEntrypoint()) {
2017-12-02 19:15:12 +00:00
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, RAddressString(i.vaddr));
item->setText(1, i.type);
item->setData(0, Qt::UserRole, QVariant::fromValue(i));
2017-12-02 19:15:12 +00:00
ui->entrypointTreeWidget->addTopLevelItem(item);
}
qhelpers::adjustColumns(ui->entrypointTreeWidget, 0, 10);
}
void EntrypointWidget::setScrollMode()
{
qhelpers::setVerticalScrollMode(ui->entrypointTreeWidget);
}
2018-03-21 20:32:32 +00:00
void EntrypointWidget::on_entrypointTreeWidget_itemDoubleClicked(QTreeWidgetItem *item,
int /* column */)
{
EntrypointDescription ep = item->data(0, Qt::UserRole).value<EntrypointDescription>();
2018-04-12 06:33:30 +00:00
Core()->seek(ep.vaddr);
}