From 1f8f3840ac086c3047d19701b245132e74a65e5f Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 23 Jul 2023 15:13:47 -0700 Subject: [PATCH] Disable right-click menu on main window Before, right-clicking on the toolbar would allow toggling all dock widgets, including the debugger ones even when they are disabled. (See https://doc.qt.io/qt-5/qmainwindow.html#createPopupMenu for this behavior, and https://bugs.dolphin-emu.org/issues/13306 for an example of where it caused issues.) --- Source/Core/DolphinQt/MainWindow.cpp | 7 +++++++ Source/Core/DolphinQt/MainWindow.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 42a6a04603..c63fa1ae50 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -1645,6 +1645,13 @@ bool MainWindow::eventFilter(QObject* object, QEvent* event) return false; } +QMenu* MainWindow::createPopupMenu() +{ + // Disable the default popup menu as it exposes the debugger UI even when the debugger UI is + // disabled, which can lead to user confusion (see e.g. https://bugs.dolphin-emu.org/issues/13306) + return nullptr; +} + void MainWindow::dragEnterEvent(QDragEnterEvent* event) { if (event->mimeData()->hasUrls() && event->mimeData()->urls().size() == 1) diff --git a/Source/Core/DolphinQt/MainWindow.h b/Source/Core/DolphinQt/MainWindow.h index 4654202ed7..357dc5186e 100644 --- a/Source/Core/DolphinQt/MainWindow.h +++ b/Source/Core/DolphinQt/MainWindow.h @@ -13,6 +13,7 @@ #include "Core/Boot/Boot.h" +class QMenu; class QStackedWidget; class QString; @@ -80,6 +81,7 @@ public: WindowSystemInfo GetWindowSystemInfo() const; bool eventFilter(QObject* object, QEvent* event) override; + QMenu* createPopupMenu() override; signals: void ReadOnlyModeChanged(bool read_only);