Mercurial > hg > syntilista
changeset 46:372c1be58996
Improve shortcuts functionality a bit.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 06 Apr 2017 15:50:19 +0300 |
parents | acc235907fab |
children | 08c0d5116e82 |
files | main.cpp main.h |
diffstat | 2 files changed, 23 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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; };