From db76bffbe305bc79e917b487c109ca1b68586acf Mon Sep 17 00:00:00 2001 From: dok Date: Fri, 15 Jun 2018 02:03:22 +0200 Subject: [PATCH] widgets/disasm: Add shortcuts to change font-size Add two shortcut for changing the font-size in the Disassembly window: CTRL+PLUS : increase font size CTRL+MINUS: decrease font size Issue: #298 --- src/widgets/DisassemblyWidget.cpp | 12 ++++++++++++ src/widgets/DisassemblyWidget.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/widgets/DisassemblyWidget.cpp b/src/widgets/DisassemblyWidget.cpp index 9cc3f858..4098f339 100644 --- a/src/widgets/DisassemblyWidget.cpp +++ b/src/widgets/DisassemblyWidget.cpp @@ -169,6 +169,8 @@ DisassemblyWidget::DisassemblyWidget(MainWindow *main, QAction *action) ADD_SHORTCUT(QKeySequence::MoveToPreviousPage, [this]() { moveCursorRelative(true, true); }) + ADD_SHORTCUT(QKeySequence(Qt::CTRL + Qt::Key_Plus), &DisassemblyWidget::zoomIn) + ADD_SHORTCUT(QKeySequence(Qt::CTRL + Qt::Key_Minus), &DisassemblyWidget::zoomOut) #undef ADD_SHORTCUT } @@ -293,6 +295,16 @@ bool DisassemblyWidget::updateMaxLines() return false; } +void DisassemblyWidget::zoomIn() { + mDisasTextEdit->zoomIn(); + updateMaxLines(); +} + +void DisassemblyWidget::zoomOut() { + mDisasTextEdit->zoomOut(); + updateMaxLines(); +} + void DisassemblyWidget::highlightCurrentLine() { QList extraSelections; diff --git a/src/widgets/DisassemblyWidget.h b/src/widgets/DisassemblyWidget.h index 9b7a45a2..d574dc67 100644 --- a/src/widgets/DisassemblyWidget.h +++ b/src/widgets/DisassemblyWidget.h @@ -39,6 +39,9 @@ private slots: void cursorPositionChanged(); + void zoomIn(); + void zoomOut(); + private: DisassemblyContextMenu *mCtxMenu; DisassemblyScrollArea *mDisasScrollArea;