From 36b869003a5032ad6b8ebdfeb290664590722e00 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Tue, 10 Jun 2025 12:38:01 -0400 Subject: [PATCH] Qt: Use standard key sequences for main window shortcuts Notably, this enables command+R to refresh on macOS, where F5 is not commonly used. --- src/duckstation-qt/mainwindow.cpp | 12 +++++++----- src/duckstation-qt/mainwindow.ui | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/duckstation-qt/mainwindow.cpp b/src/duckstation-qt/mainwindow.cpp index 07a539f77..381519a8e 100644 --- a/src/duckstation-qt/mainwindow.cpp +++ b/src/duckstation-qt/mainwindow.cpp @@ -1689,15 +1689,17 @@ void MainWindow::setupAdditionalUi() updateDebugMenuVisibility(); m_shortcuts.open_file = - new QShortcut(Qt::ControlModifier | Qt::Key_O, this, this, &MainWindow::onStartFileActionTriggered); - m_shortcuts.game_list_refresh = new QShortcut(Qt::Key_F5, this, this, &MainWindow::onScanForNewGamesTriggered); + new QShortcut(QKeySequence::Open, this, this, &MainWindow::onStartFileActionTriggered); + 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->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); 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 = - 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); if (s_disable_window_rounded_corners) diff --git a/src/duckstation-qt/mainwindow.ui b/src/duckstation-qt/mainwindow.ui index 98b12d2fe..7d3e4f406 100644 --- a/src/duckstation-qt/mainwindow.ui +++ b/src/duckstation-qt/mainwindow.ui @@ -30,7 +30,7 @@ 0 0 800 - 33 + 22 @@ -721,7 +721,7 @@ Resume - Resumes the last save state created. + Resumes the last save state created