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
This commit is contained in:
dok 2018-06-15 02:03:22 +02:00 committed by xarkes
parent 81aa85e461
commit db76bffbe3
2 changed files with 15 additions and 0 deletions

View File

@ -169,6 +169,8 @@ DisassemblyWidget::DisassemblyWidget(MainWindow *main, QAction *action)
ADD_SHORTCUT(QKeySequence::MoveToPreviousPage, [this]() { ADD_SHORTCUT(QKeySequence::MoveToPreviousPage, [this]() {
moveCursorRelative(true, true); 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 #undef ADD_SHORTCUT
} }
@ -293,6 +295,16 @@ bool DisassemblyWidget::updateMaxLines()
return false; return false;
} }
void DisassemblyWidget::zoomIn() {
mDisasTextEdit->zoomIn();
updateMaxLines();
}
void DisassemblyWidget::zoomOut() {
mDisasTextEdit->zoomOut();
updateMaxLines();
}
void DisassemblyWidget::highlightCurrentLine() void DisassemblyWidget::highlightCurrentLine()
{ {
QList<QTextEdit::ExtraSelection> extraSelections; QList<QTextEdit::ExtraSelection> extraSelections;

View File

@ -39,6 +39,9 @@ private slots:
void cursorPositionChanged(); void cursorPositionChanged();
void zoomIn();
void zoomOut();
private: private:
DisassemblyContextMenu *mCtxMenu; DisassemblyContextMenu *mCtxMenu;
DisassemblyScrollArea *mDisasScrollArea; DisassemblyScrollArea *mDisasScrollArea;