Qt: Use standard key sequences for main window shortcuts

Notably, this enables command+R to refresh on macOS, where F5
is not commonly used.
This commit is contained in:
Davide Pesavento 2025-06-10 12:38:01 -04:00 committed by Connor McLaughlin
parent e45c04e0dd
commit 36b869003a
2 changed files with 9 additions and 7 deletions

View File

@ -1689,15 +1689,17 @@ void MainWindow::setupAdditionalUi()
updateDebugMenuVisibility(); updateDebugMenuVisibility();
m_shortcuts.open_file = m_shortcuts.open_file =
new QShortcut(Qt::ControlModifier | Qt::Key_O, this, this, &MainWindow::onStartFileActionTriggered); new QShortcut(QKeySequence::Open, this, this, &MainWindow::onStartFileActionTriggered);
m_shortcuts.game_list_refresh = new QShortcut(Qt::Key_F5, this, this, &MainWindow::onScanForNewGamesTriggered); m_shortcuts.game_list_refresh =
new QShortcut(QKeySequence::Refresh, this, this, &MainWindow::onScanForNewGamesTriggered);
m_shortcuts.game_list_search = new QShortcut(this); m_shortcuts.game_list_search = new QShortcut(this);
m_shortcuts.game_list_search->setKeys({Qt::ControlModifier | Qt::Key_F, Qt::Key_F3}); m_shortcuts.game_list_search->setKeys(
QKeySequence::keyBindings(QKeySequence::Find) + QKeySequence::keyBindings(QKeySequence::FindNext));
connect(m_shortcuts.game_list_search, &QShortcut::activated, m_game_list_widget, &GameListWidget::focusSearchWidget); connect(m_shortcuts.game_list_search, &QShortcut::activated, m_game_list_widget, &GameListWidget::focusSearchWidget);
m_shortcuts.game_grid_zoom_in = m_shortcuts.game_grid_zoom_in =
new QShortcut(Qt::ControlModifier | Qt::Key_Plus, this, this, &MainWindow::onViewGameGridZoomInActionTriggered); new QShortcut(QKeySequence::ZoomIn, this, this, &MainWindow::onViewGameGridZoomInActionTriggered);
m_shortcuts.game_grid_zoom_out = m_shortcuts.game_grid_zoom_out =
new QShortcut(Qt::ControlModifier | Qt::Key_Minus, this, this, &MainWindow::onViewGameGridZoomOutActionTriggered); new QShortcut(QKeySequence::ZoomOut, this, this, &MainWindow::onViewGameGridZoomOutActionTriggered);
s_disable_window_rounded_corners = Host::GetBaseBoolSettingValue("Main", "DisableWindowRoundedCorners", false); s_disable_window_rounded_corners = Host::GetBaseBoolSettingValue("Main", "DisableWindowRoundedCorners", false);
if (s_disable_window_rounded_corners) if (s_disable_window_rounded_corners)

View File

@ -30,7 +30,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>33</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuSystem"> <widget class="QMenu" name="menuSystem">
@ -721,7 +721,7 @@
<string>Resume</string> <string>Resume</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Resumes the last save state created.</string> <string>Resumes the last save state created</string>
</property> </property>
</action> </action>
<action name="actionViewToolbar"> <action name="actionViewToolbar">