From f830fc17fbf6bf84117bc6e444a57048bb900a56 Mon Sep 17 00:00:00 2001 From: xarkes Date: Tue, 16 Jul 2019 18:39:51 +0200 Subject: [PATCH] Updated DisasWidget zoom shortcuts Now the shortcuts are consistent with the GraphView widget. --- docs/source/shortcuts.rst | 6 ++++++ src/widgets/DisassemblyWidget.cpp | 15 ++++++++++----- src/widgets/DisassemblyWidget.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/source/shortcuts.rst b/docs/source/shortcuts.rst index 3782505d..0b49d1ac 100644 --- a/docs/source/shortcuts.rst +++ b/docs/source/shortcuts.rst @@ -51,6 +51,12 @@ Disassembly view shortcuts +------------+----------------------------------+ | X | Show Xrefs | +------------+----------------------------------+ +| \+ | Zoom in | ++------------+----------------------------------+ +| \- | Zoom out | ++------------+----------------------------------+ +| = | Reset zoom | ++------------+----------------------------------+ Graph view shortcuts -------------------- diff --git a/src/widgets/DisassemblyWidget.cpp b/src/widgets/DisassemblyWidget.cpp index 993dbdb6..f7b02d68 100644 --- a/src/widgets/DisassemblyWidget.cpp +++ b/src/widgets/DisassemblyWidget.cpp @@ -218,11 +218,10 @@ DisassemblyWidget::DisassemblyWidget(MainWindow *main, QAction *action) moveCursorRelative(true, true); }) - // Plus sign in num-bar considered "Qt::Key_Equal" - ADD_ACTION(QKeySequence(Qt::CTRL + Qt::Key_Equal), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomIn) - // Plus sign in numpad - ADD_ACTION(QKeySequence(Qt::CTRL + Qt::Key_Plus), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomIn) - ADD_ACTION(QKeySequence(Qt::CTRL + Qt::Key_Minus), Qt::WidgetWithChildrenShortcut, &DisassemblyWidget::zoomOut) + // 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) #undef ADD_ACTION } @@ -397,6 +396,12 @@ void DisassemblyWidget::zoomOut() updateMaxLines(); } +void DisassemblyWidget::zoomReset() +{ + setupFonts(); + updateMaxLines(); +} + void DisassemblyWidget::highlightCurrentLine() { QList extraSelections; diff --git a/src/widgets/DisassemblyWidget.h b/src/widgets/DisassemblyWidget.h index 3165203a..0ca77855 100644 --- a/src/widgets/DisassemblyWidget.h +++ b/src/widgets/DisassemblyWidget.h @@ -48,6 +48,7 @@ protected slots: void zoomIn(); void zoomOut(); + void zoomReset(); protected: DisassemblyContextMenu *mCtxMenu;