Added new submenu in menu bar for OS X to switch tabs with hotkeys.

- Fixed #1176.
 - https://bugreports.qt.io/browse/QTBUG-8596
This commit is contained in:
23rd 2019-08-04 16:29:54 +03:00
parent c578cd47e1
commit 79a87e740a

View file

@ -346,12 +346,25 @@ void Window::addMenuBar()
QMenuBar *mainMenu = new QMenuBar();
mainMenu->setNativeMenuBar(true);
QMenu *menu = new QMenu(QString());
mainMenu->addMenu(menu);
// First menu.
QMenu *menu = mainMenu->addMenu(QString());
QAction *prefs = menu->addAction(QString());
prefs->setMenuRole(QAction::PreferencesRole);
connect(prefs, &QAction::triggered, this,
[] { SettingsDialog::showDialog(); });
// Window menu.
QMenu *windowMenu = mainMenu->addMenu(QString("Window"));
QAction *nextTab = windowMenu->addAction(QString("Select next tab"));
nextTab->setShortcuts({QKeySequence("Meta+Tab")});
connect(nextTab, &QAction::triggered, this,
[=] { this->notebook_->selectNextTab(); });
QAction *prevTab = windowMenu->addAction(QString("Select previous tab"));
prevTab->setShortcuts({QKeySequence("Meta+Shift+Tab")});
connect(prevTab, &QAction::triggered, this,
[=] { this->notebook_->selectPreviousTab(); });
}
#define UGLYMACROHACK1(s) #s