From 90915134f5aa316e0f6735813ae84c95a8724678 Mon Sep 17 00:00:00 2001 From: xarkes Date: Sat, 13 Jan 2018 14:49:20 +0100 Subject: [PATCH] Fix shortcuts #237 --- src/widgets/DisassemblerGraphView.cpp | 9 ++++++++- src/widgets/DisassemblyWidget.cpp | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/widgets/DisassemblerGraphView.cpp b/src/widgets/DisassemblerGraphView.cpp index 799eadf6..04eb8233 100644 --- a/src/widgets/DisassemblerGraphView.cpp +++ b/src/widgets/DisassemblerGraphView.cpp @@ -71,6 +71,12 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent) QShortcut *shortcut_prev_instr = new QShortcut(QKeySequence(Qt::Key_K), this); shortcut_prev_instr->setContext(Qt::WidgetShortcut); connect(shortcut_prev_instr, SIGNAL(activated()), this, SLOT(prevInstr())); + QShortcut *shortcut_next_instr_arrow = new QShortcut(QKeySequence::MoveToNextLine, this); + shortcut_next_instr_arrow->setContext(Qt::WidgetShortcut); + connect(shortcut_next_instr_arrow, SIGNAL(activated()), this, SLOT(nextInstr())); + QShortcut *shortcut_prev_instr_arrow = new QShortcut(QKeySequence::MoveToPreviousLine, this); + shortcut_prev_instr_arrow->setContext(Qt::WidgetShortcut); + connect(shortcut_prev_instr_arrow, SIGNAL(activated()), this, SLOT(prevInstr())); shortcuts.append(shortcut_disassembly); shortcuts.append(shortcut_escape); shortcuts.append(shortcut_zoom_in); @@ -78,7 +84,8 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent) shortcuts.append(shortcut_zoom_reset); shortcuts.append(shortcut_next_instr); shortcuts.append(shortcut_prev_instr); - + shortcuts.append(shortcut_next_instr_arrow); + shortcuts.append(shortcut_prev_instr_arrow); initFont(); colorsUpdatedSlot(); diff --git a/src/widgets/DisassemblyWidget.cpp b/src/widgets/DisassemblyWidget.cpp index 4aa10b8a..bf8f54da 100644 --- a/src/widgets/DisassemblyWidget.cpp +++ b/src/widgets/DisassemblyWidget.cpp @@ -148,7 +148,9 @@ DisassemblyWidget::DisassemblyWidget(QWidget *parent) s->setContext(Qt::WidgetShortcut); \ connect(s, &QShortcut::activated, this, (slot)); \ } + ADD_SHORTCUT(QKeySequence(Qt::Key_J), [this]() { moveCursorRelative(false, false); }) ADD_SHORTCUT(QKeySequence::MoveToNextLine, [this]() { moveCursorRelative(false, false); }) + ADD_SHORTCUT(QKeySequence(Qt::Key_K), [this]() { moveCursorRelative(true, false); }) ADD_SHORTCUT(QKeySequence::MoveToPreviousLine, [this]() { moveCursorRelative(true, false); }) ADD_SHORTCUT(QKeySequence::MoveToNextPage, [this]() { moveCursorRelative(false, true); }) ADD_SHORTCUT(QKeySequence::MoveToPreviousPage, [this]() { moveCursorRelative(true, true); })