Fix the display of Preferences menu shortcut on macOS.

It was appearing only on first launch, when OSCAR was asking where
to store its data. Now it appears consistently.
This commit is contained in:
sawinglogz 2020-01-18 17:01:35 -05:00
parent 127a3e1964
commit 91dbd3a204

View File

@ -130,6 +130,12 @@ void MainWindow::SetupGUI()
#ifdef Q_OS_MAC
ui->action_About->setMenuRole(QAction::ApplicationSpecificRole);
ui->action_Preferences->setMenuRole(QAction::ApplicationSpecificRole);
// For some reason, setShortcuts won't change the text of the menu item unless Qt has had a chance
// to do something first. Without the processEvents() call it still installs the shortcut, but
// not visible. (Any preceding UI such as QMessageBox seems to have the same effect.)
QApplication::processEvents();
ui->action_Preferences->setShortcuts(QKeySequence::Preferences);
#endif