From bb8cb3ff820338f58dbedf9c8f0eb729cf900aa9 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 28 Jan 2023 11:08:15 -0500 Subject: [PATCH] main: Globally disable the "?" button on dialogs (#6263) Sets the AA_DisableWindowContextHelpButton attribute to disable this useless button globally. This is disabled by default on Qt6. --- src/citra_qt/cheats.cpp | 1 - src/citra_qt/configuration/configure_dialog.cpp | 2 -- src/citra_qt/configuration/configure_per_game.cpp | 2 -- src/citra_qt/debugger/profiler.cpp | 5 ++--- src/citra_qt/main.cpp | 4 ++++ src/citra_qt/util/sequence_dialog/sequence_dialog.cpp | 1 - 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/citra_qt/cheats.cpp b/src/citra_qt/cheats.cpp index fee42d55c..343568004 100644 --- a/src/citra_qt/cheats.cpp +++ b/src/citra_qt/cheats.cpp @@ -17,7 +17,6 @@ CheatDialog::CheatDialog(QWidget* parent) : QDialog(parent), ui(std::make_unique()) { // Setup gui control settings ui->setupUi(this); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); ui->tableCheats->setColumnWidth(0, 30); ui->tableCheats->setColumnWidth(2, 85); ui->tableCheats->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed); diff --git a/src/citra_qt/configuration/configure_dialog.cpp b/src/citra_qt/configuration/configure_dialog.cpp index 80670f2af..1b00ddbe3 100644 --- a/src/citra_qt/configuration/configure_dialog.cpp +++ b/src/citra_qt/configuration/configure_dialog.cpp @@ -20,8 +20,6 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry, bool PopulateSelectionList(); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - connect(ui->uiTab, &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged); connect(ui->selectorList, &QListWidget::itemSelectionChanged, this, &ConfigureDialog::UpdateVisibleTabs); diff --git a/src/citra_qt/configuration/configure_per_game.cpp b/src/citra_qt/configuration/configure_per_game.cpp index 19760fba6..fc74e9e4c 100644 --- a/src/citra_qt/configuration/configure_per_game.cpp +++ b/src/citra_qt/configuration/configure_per_game.cpp @@ -41,8 +41,6 @@ ConfigurePerGame::ConfigurePerGame(QWidget* parent, u64 title_id_, const QString setFocusPolicy(Qt::ClickFocus); setWindowTitle(tr("Properties")); - // remove Help question mark button from the title bar - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); scene = new QGraphicsScene; ui->icon_view->setScene(scene); diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp index 9f394a020..9f195f1ee 100644 --- a/src/citra_qt/debugger/profiler.cpp +++ b/src/citra_qt/debugger/profiler.cpp @@ -50,9 +50,8 @@ MicroProfileDialog::MicroProfileDialog(QWidget* parent) : QWidget(parent, Qt::Di setObjectName(QStringLiteral("MicroProfile")); setWindowTitle(tr("MicroProfile")); resize(1000, 600); - // Remove the "?" button from the titlebar and enable the maximize button - setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) | - Qt::WindowMaximizeButtonHint); + // Enable the maximize button + setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint); #if MICROPROFILE_ENABLED diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 53ca8dd05..44515db4a 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -2644,6 +2644,10 @@ int main(int argc, char* argv[]) { #ifdef __APPLE__ std::string bin_path = FileUtil::GetBundleDirectory() + DIR_SEP + ".."; chdir(bin_path.c_str()); +#endif +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + // Disables the "?" button on all dialogs. Disabled by default on Qt6. + QCoreApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton); #endif QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity); QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); diff --git a/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp b/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp index 1cfe3c0bd..0bba5348e 100644 --- a/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp +++ b/src/citra_qt/util/sequence_dialog/sequence_dialog.cpp @@ -9,7 +9,6 @@ SequenceDialog::SequenceDialog(QWidget* parent) : QDialog(parent) { setWindowTitle(tr("Enter a hotkey")); - setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); key_sequence = new QKeySequenceEdit;