diff --git a/src/widgets/FlagsWidget.cpp b/src/widgets/FlagsWidget.cpp index 68c5119b..bc6d9a3a 100644 --- a/src/widgets/FlagsWidget.cpp +++ b/src/widgets/FlagsWidget.cpp @@ -2,6 +2,7 @@ #include "ui_FlagsWidget.h" #include "core/MainWindow.h" #include "dialogs/RenameDialog.h" +#include "dialogs/XrefsDialog.h" #include "common/Helpers.h" #include @@ -149,7 +150,12 @@ FlagsWidget::FlagsWidget(MainWindow *main, QAction *action) : connect(ui->filterLineEdit, &QLineEdit::textChanged, this, [this] { tree->showItemsNumber(flags_proxy_model->rowCount()); }); - + + auto xRefShortcut = new QShortcut(QKeySequence{Qt::CTRL + Qt::Key_X}, this); + xRefShortcut->setContext(Qt::WidgetWithChildrenShortcut); + ui->actionXrefs->setShortcut(Qt::CTRL + Qt::Key_X); + connect(xRefShortcut, SIGNAL(activated()), this, SLOT(on_actionXrefs_triggered())); + setScrollMode(); ui->flagsTreeView->setContextMenuPolicy(Qt::CustomContextMenu); @@ -198,11 +204,23 @@ void FlagsWidget::on_actionDelete_triggered() Core()->delFlag(flag.name); } +void FlagsWidget::on_actionXrefs_triggered() +{ + FlagDescription flag = ui->flagsTreeView->selectionModel()->currentIndex().data( + FlagsModel::FlagDescriptionRole).value(); + + XrefsDialog xresfDialog(nullptr); + xresfDialog.fillRefsForAddress(flag.offset, RAddressString(flag.offset), false); + xresfDialog.exec(); +} + void FlagsWidget::showContextMenu(const QPoint &pt) { QMenu *menu = new QMenu(ui->flagsTreeView); menu->addAction(ui->actionRename); menu->addAction(ui->actionDelete); + menu->addSeparator(); + menu->addAction(ui->actionXrefs); menu->exec(ui->flagsTreeView->mapToGlobal(pt)); delete menu; } diff --git a/src/widgets/FlagsWidget.h b/src/widgets/FlagsWidget.h index 285568d7..aef5c5d1 100644 --- a/src/widgets/FlagsWidget.h +++ b/src/widgets/FlagsWidget.h @@ -71,6 +71,7 @@ private slots: void on_actionRename_triggered(); void on_actionDelete_triggered(); + void on_actionXrefs_triggered(); void showContextMenu(const QPoint &pt); diff --git a/src/widgets/FlagsWidget.ui b/src/widgets/FlagsWidget.ui index a58912f3..078b822f 100644 --- a/src/widgets/FlagsWidget.ui +++ b/src/widgets/FlagsWidget.ui @@ -98,11 +98,28 @@ Rename + + Ctrl+N + Delete + + Del + + + + + X-Refs + + + Show X-Refs of this flag + + + Ctrl+X +