From 4974cac59af26c8885bf90005b58faec8e059313 Mon Sep 17 00:00:00 2001 From: BruebachL <44814898+BruebachL@users.noreply.github.com> Date: Sun, 18 Oct 2026 22:48:51 +0200 Subject: [PATCH] [Client] Settings: add top-right cogwheel shortcut (#7485) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Client] Settings: add top-right cogwheel shortcut Add a subtle flat settings button to the tab bar corner that opens the settings dialog via the existing menu action slot. Icon and tooltip follow the menu action in retranslateUi. * [Client] Settings: flat black-cogwheel corner entry per review --------- Co-authored-by: Lukas BrĂ¼bach --- cockatrice/src/interface/window_main.cpp | 18 ++++++++++++++++++ cockatrice/src/interface/window_main.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/cockatrice/src/interface/window_main.cpp b/cockatrice/src/interface/window_main.cpp index d23ce254c..636cee281 100644 --- a/cockatrice/src/interface/window_main.cpp +++ b/cockatrice/src/interface/window_main.cpp @@ -82,10 +82,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -355,6 +357,9 @@ void MainWindow::retranslateUi() aForgotPassword->setText(tr("&Restore password...")); aSettings->setText(tr("&Settings...")); aSettings->setIcon(themePixmap(QStringLiteral("icons/settings"))); + settingsButton->setToolTip(tr("Settings")); + settingsButton->setAccessibleName(tr("Settings")); + settingsButton->setIcon(themePixmap(QStringLiteral("icons/cogwheel"))); aExit->setText(tr("&Exit")); #if defined(__APPLE__) /* For OSX */ @@ -559,6 +564,19 @@ MainWindow::MainWindow(QWidget *parent) setCentralWidget(tabSupervisor); + // Unobtrusive settings entry in the tab bar corner: flat icon-only button that blends into the tab + // bar until hovered, mirroring the menu action for discoverability + settingsButton = new QToolButton(tabSupervisor); + settingsButton->setAutoRaise(true); + settingsButton->setToolButtonStyle(Qt::ToolButtonIconOnly); + settingsButton->setIconSize(QSize(16, 16)); + settingsButton->setCursor(Qt::PointingHandCursor); + settingsButton->setFocusPolicy(Qt::NoFocus); + settingsButton->setStyleSheet( + QStringLiteral("QToolButton { border: none; background: transparent; padding: 4px; }")); + connect(settingsButton, &QToolButton::clicked, this, &MainWindow::actSettings); + tabSupervisor->setCornerWidget(settingsButton, Qt::TopRightCorner); + retranslateUi(); if (!restoreGeometry(SettingsCache::instance().layouts().getMainWindowGeometry())) { diff --git a/cockatrice/src/interface/window_main.h b/cockatrice/src/interface/window_main.h index 4b3da716d..bcf709cb1 100644 --- a/cockatrice/src/interface/window_main.h +++ b/cockatrice/src/interface/window_main.h @@ -46,6 +46,7 @@ #include class QAction; +class QToolButton; class QWidget; struct LocalGameOptions; @@ -178,6 +179,7 @@ private: QList tabMenus; QMenu *cockatriceMenu, *dbMenu, *tabsMenu, *helpMenu, *trayIconMenu; QAction *aAbout, *aSettings, *aShow, *aExit; + QToolButton *settingsButton = nullptr; QAction *aConnect, *aDisconnect, *aRegister, *aForgotPassword, *aSinglePlayer, *aWatchReplay, *aFullScreen; QAction *aManageSets, *aEditTokens, *aOpenCustomFolder, *aOpenCustomsetsFolder, *aAddCustomSet, *aReloadCardDatabase;