Use Alt+Tab on macOS to switch between databases (#5407)

This commit is contained in:
Stefan Sundin 2020-09-15 06:43:35 -07:00 committed by GitHub
parent 6a35bbea2f
commit 8a4a804c8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -295,9 +295,14 @@ MainWindow::MainWindow()
new QShortcut(Qt::CTRL + Qt::Key_M, this, SLOT(minimizeOrHide()));
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_M, this, SLOT(hideWindow()));
// Control database tabs
new QShortcut(Qt::CTRL + Qt::Key_Tab, this, SLOT(selectNextDatabaseTab()));
// Ctrl+Tab is broken on Mac, so use Alt (i.e. the Option key) - https://bugreports.qt.io/browse/QTBUG-8596
auto dbTabModifier2 = Qt::CTRL;
#ifdef Q_OS_MACOS
dbTabModifier2 = Qt::ALT;
#endif
new QShortcut(dbTabModifier2 + Qt::Key_Tab, this, SLOT(selectNextDatabaseTab()));
new QShortcut(Qt::CTRL + Qt::Key_PageDown, this, SLOT(selectNextDatabaseTab()));
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this, SLOT(selectPreviousDatabaseTab()));
new QShortcut(dbTabModifier2 + Qt::SHIFT + Qt::Key_Tab, this, SLOT(selectPreviousDatabaseTab()));
new QShortcut(Qt::CTRL + Qt::Key_PageUp, this, SLOT(selectPreviousDatabaseTab()));
// Tab selection by number, Windows uses Ctrl, macOS uses Command,