From a15d104b4559310cfe9603f6f979496656c1adf9 Mon Sep 17 00:00:00 2001 From: xarkes Date: Fri, 27 Sep 2019 18:16:05 +0200 Subject: [PATCH] Fixed zoom shortcuts to something more generic (#1781) --- docs/source/shortcuts.rst | 74 +++++++++++++-------------- src/widgets/DisassemblerGraphView.cpp | 6 +-- src/widgets/DisassemblyWidget.cpp | 6 +-- 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/docs/source/shortcuts.rst b/docs/source/shortcuts.rst index 7d491328..bdc14c16 100644 --- a/docs/source/shortcuts.rst +++ b/docs/source/shortcuts.rst @@ -35,43 +35,43 @@ Disassembly view shortcuts -------------------------- *Most of these shortcuts are also applied to Disassembly Graph view* -+------------+----------------------------------+ -| Shortcut | Function | -+============+==================================+ -| Esc | Seek to previous position | -+------------+----------------------------------+ -| Space | Switch to disassembly graph view | -+------------+----------------------------------+ -| Ctrl/Cmd+C | Copy | -+------------+----------------------------------+ -| ; | Add comment | -+------------+----------------------------------+ -| P | Define a new function | -+------------+----------------------------------+ -| Shift+P | Edit function | -+------------+----------------------------------+ -| U | Undefine a function | -+------------+----------------------------------+ -| N | Rename current function/flag | -+------------+----------------------------------+ -| Shift+N | Rename flag/function used here | -+------------+----------------------------------+ -| Y | Edit\rename local variables | -+------------+----------------------------------+ -| L | Link a type\struct to address | -+------------+----------------------------------+ -| A | Set current address to String | -+------------+----------------------------------+ -| C | Set current address to Code | -+------------+----------------------------------+ -| X | Show Xrefs | -+------------+----------------------------------+ -| \+ | Zoom in | -+------------+----------------------------------+ -| \- | Zoom out | -+------------+----------------------------------+ -| = | Reset zoom | -+------------+----------------------------------+ ++-------------+----------------------------------+ +| Shortcut | Function | ++=============+==================================+ +| Esc | Seek to previous position | ++-------------+----------------------------------+ +| Space | Switch to disassembly graph view | ++-------------+----------------------------------+ +| Ctrl/Cmd+C | Copy | ++-------------+----------------------------------+ +| ; | Add comment | ++-------------+----------------------------------+ +| P | Define a new function | ++-------------+----------------------------------+ +| Shift+P | Edit function | ++-------------+----------------------------------+ +| U | Undefine a function | ++-------------+----------------------------------+ +| N | Rename current function/flag | ++-------------+----------------------------------+ +| Shift+N | Rename flag/function used here | ++-------------+----------------------------------+ +| Y | Edit\rename local variables | ++-------------+----------------------------------+ +| L | Link a type\struct to address | ++-------------+----------------------------------+ +| A | Set current address to String | ++-------------+----------------------------------+ +| C | Set current address to Code | ++-------------+----------------------------------+ +| X | Show Xrefs | ++-------------+----------------------------------+ +| Ctrl/Cmd+\+ | Zoom in | ++-------------+----------------------------------+ +| Ctrl/Cmd+\- | Zoom out | ++-------------+----------------------------------+ +| Ctrl/Cmd+= | Reset zoom | ++-------------+----------------------------------+ Graph view shortcuts -------------------- diff --git a/src/widgets/DisassemblerGraphView.cpp b/src/widgets/DisassemblerGraphView.cpp index 04a89bea..bc6e4e81 100644 --- a/src/widgets/DisassemblerGraphView.cpp +++ b/src/widgets/DisassemblerGraphView.cpp @@ -63,15 +63,15 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent, CutterSeekable *se connect(shortcut_escape, SIGNAL(activated()), seekable, SLOT(seekPrev())); // Zoom shortcuts - QShortcut *shortcut_zoom_in = new QShortcut(QKeySequence(Qt::Key_Plus), this); + QShortcut *shortcut_zoom_in = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus), this); shortcut_zoom_in->setContext(Qt::WidgetShortcut); connect(shortcut_zoom_in, &QShortcut::activated, this, std::bind(&DisassemblerGraphView::zoom, this, QPointF(0.5, 0.5), 1)); - QShortcut *shortcut_zoom_out = new QShortcut(QKeySequence(Qt::Key_Minus), this); + QShortcut *shortcut_zoom_out = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus), this); shortcut_zoom_out->setContext(Qt::WidgetShortcut); connect(shortcut_zoom_out, &QShortcut::activated, this, std::bind(&DisassemblerGraphView::zoom, this, QPointF(0.5, 0.5), -1)); - QShortcut *shortcut_zoom_reset = new QShortcut(QKeySequence(Qt::Key_Equal), this); + QShortcut *shortcut_zoom_reset = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Equal), this); shortcut_zoom_reset->setContext(Qt::WidgetShortcut); connect(shortcut_zoom_reset, SIGNAL(activated()), this, SLOT(zoomReset())); diff --git a/src/widgets/DisassemblyWidget.cpp b/src/widgets/DisassemblyWidget.cpp index 5ef04127..e0c882f7 100644 --- a/src/widgets/DisassemblyWidget.cpp +++ b/src/widgets/DisassemblyWidget.cpp @@ -210,9 +210,9 @@ DisassemblyWidget::DisassemblyWidget(MainWindow *main, QAction *action) }) // Zoom shortcuts - ADD_ACTION(QKeySequence(Qt::Key_Plus), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomIn) - ADD_ACTION(QKeySequence(Qt::Key_Minus), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomOut) - ADD_ACTION(QKeySequence(Qt::Key_Equal), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomReset) + ADD_ACTION(QKeySequence(Qt::CTRL + Qt::Key_Plus), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomIn) + ADD_ACTION(QKeySequence(Qt::CTRL + Qt::Key_Minus), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomOut) + ADD_ACTION(QKeySequence(Qt::CTRL + Qt::Key_Equal), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomReset) #undef ADD_ACTION }