# HG changeset patch # User Matti Hamalainen # Date 1491483019 -10800 # Node ID 372c1be58996c4905623947a690ef59075074b1f # Parent acc235907fab3207566d3a37b3588af4c2a4471a Improve shortcuts functionality a bit. diff -r acc235907fab -r 372c1be58996 main.cpp --- a/main.cpp Thu Apr 06 15:24:11 2017 +0300 +++ b/main.cpp Thu Apr 06 15:50:19 2017 +0300 @@ -138,11 +138,11 @@ "#label_EUR { font-size: %4pt; font-weight: bold; }" "#edit_Amount { font-size: %4pt; margin: 0.5em; padding: 0.5em; }" ). + arg(12 * setScale). arg(14 * setScale). arg(16 * setScale). - arg(20 * setScale). - arg(16 * setScale). - arg(22 * setScale) + arg(18 * setScale). + arg(20 * setScale) ); } @@ -260,10 +260,14 @@ setActivePerson(-1); // Keyboard shortcuts - sc_quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close())); - sc_esc = new QShortcut(QKeySequence(Qt::Key_Escape), this, SLOT(on_button_ClearFilter_clicked())); - sc_sc_up = new QShortcut(QKeySequence(QKeySequence::ZoomIn), this, SLOT(changeUIScaleZoomIn())); - sc_sc_dn = new QShortcut(QKeySequence(QKeySequence::ZoomOut), this, SLOT(changeUIScaleZoomOut())); + new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close())); + new QShortcut(QKeySequence(Qt::Key_Escape), this, SLOT(on_button_ClearFilter_clicked())); + new QShortcut(QKeySequence(QKeySequence::ZoomIn), this, SLOT(changeUIZoomIn())); + new QShortcut(QKeySequence(QKeySequence::ZoomOut), this, SLOT(changeUIZoomOut())); + new QShortcut(QKeySequence(Qt::CTRL + Qt::KeypadModifier + Qt::Key_Plus), this, SLOT(changeUIZoomIn())); + new QShortcut(QKeySequence(Qt::CTRL + Qt::KeypadModifier + Qt::Key_Minus), this, SLOT(changeUIZoomOut())); + new QShortcut(QKeySequence(Qt::CTRL + Qt::KeypadModifier + Qt::Key_0), this, SLOT(changeUIZoomReset())); + new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_0), this, SLOT(changeUIZoomReset())); } @@ -301,20 +305,27 @@ } -void SyntilistaMainWindow::changeUIScaleZoomIn() +void SyntilistaMainWindow::changeUIZoomIn() { setScale += 0.1f; setCommonStyleSheet(this); } -void SyntilistaMainWindow::changeUIScaleZoomOut() +void SyntilistaMainWindow::changeUIZoomOut() { setScale -= 0.1f; setCommonStyleSheet(this); } +void SyntilistaMainWindow::changeUIZoomReset() +{ + setScale = 1.0f; + setCommonStyleSheet(this); +} + + void SyntilistaMainWindow::selectedPersonChanged(const QModelIndex &curr, const QModelIndex &prev) { (void) prev; diff -r acc235907fab -r 372c1be58996 main.h --- a/main.h Thu Apr 06 15:24:11 2017 +0300 +++ b/main.h Thu Apr 06 15:50:19 2017 +0300 @@ -137,8 +137,9 @@ void selectedPersonChanged(const QModelIndex &, const QModelIndex &); - void changeUIScaleZoomIn(); - void changeUIScaleZoomOut(); + void changeUIZoomIn(); + void changeUIZoomOut(); + void changeUIZoomReset(); void updateSortOrder(int index, Qt::SortOrder order); @@ -153,8 +154,6 @@ int peopleSortIndex; Qt::SortOrder peopleSortOrder; QString peopleFilter; - - QShortcut *sc_quit, *sc_esc, *sc_sc_up, *sc_sc_dn; };