diff options
author | Daniel Ziegenberg <daniel@ziegenberg.at> | 2022-06-19 00:30:09 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2022-07-02 05:29:33 +0300 |
commit | 6b05b848952108fdc073ff7d1abd47b99ea983db (patch) | |
tree | e8f6dc32ed32416fb0b68c3379bb9640fe077958 | |
parent | 861fe2e5a9ec1025f89591b14017fc3880fb3733 (diff) |
Add Ctrl+Tab shortcut to cycle databases in unlock dialog
The main window has both `Ctrl+PageUp` / `Ctrl+PageDown` and
`Ctrl+Tab / Ctrl+Shift+Tab` shortcuts to cycle the database tabs. When
in PR #5427 the abbility to select any open database in the unlock
dialog was introduced, only the `Ctrl+PageUp` / `Ctrl+PageDown`
shortcuts were added. This commit adds the `Ctrl+Tab / Ctrl+Shift+Tab`
shortcuts to the unlock diaglog to fix this inconsistent UI behaviour.
Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
-rw-r--r-- | src/gui/DatabaseOpenDialog.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/DatabaseOpenDialog.cpp b/src/gui/DatabaseOpenDialog.cpp index 799e82963..e1b9391d0 100644 --- a/src/gui/DatabaseOpenDialog.cpp +++ b/src/gui/DatabaseOpenDialog.cpp @@ -59,13 +59,24 @@ DatabaseOpenDialog::DatabaseOpenDialog(QWidget* parent) setLayout(layout); setMinimumWidth(700); - // set up Ctrl+PageUp and Ctrl+PageDown shortcuts to cycle tabs + // set up Ctrl+PageUp / Ctrl+PageDown and Ctrl+Tab / Ctrl+Shift+Tab shortcuts to cycle tabs + // Ctrl+Tab is broken on Mac, so use Alt (i.e. the Option key) - https://bugreports.qt.io/browse/QTBUG-8596 + auto dbTabModifier = Qt::CTRL; +#ifdef Q_OS_MACOS + dbTabModifier = Qt::ALT; +#endif auto* shortcut = new QShortcut(Qt::CTRL + Qt::Key_PageUp, this); shortcut->setContext(Qt::WidgetWithChildrenShortcut); connect(shortcut, &QShortcut::activated, this, [this]() { selectTabOffset(-1); }); + shortcut = new QShortcut(dbTabModifier + Qt::Key_Tab, this); + shortcut->setContext(Qt::WidgetWithChildrenShortcut); + connect(shortcut, &QShortcut::activated, this, [this]() { selectTabOffset(-1); }); shortcut = new QShortcut(Qt::CTRL + Qt::Key_PageDown, this); shortcut->setContext(Qt::WidgetWithChildrenShortcut); connect(shortcut, &QShortcut::activated, this, [this]() { selectTabOffset(1); }); + shortcut = new QShortcut(dbTabModifier + Qt::SHIFT + Qt::Key_Tab, this); + shortcut->setContext(Qt::WidgetWithChildrenShortcut); + connect(shortcut, &QShortcut::activated, this, [this]() { selectTabOffset(1); }); } void DatabaseOpenDialog::selectTabOffset(int offset) |