aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/quickcontrols/menus/cppsettings.cpp
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2024-06-27 12:18:09 +0200
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2024-07-03 16:36:50 +0200
commit399c3c42169c541778fe909707c89a57006e99ab (patch)
tree651569bf48ddf1c64d5ffffab32750997dd14d2b /tests/manual/quickcontrols/menus/cppsettings.cpp
parent744fda367494bc093449f57351b8b74d781c9a50 (diff)
QQuickMenu: respect Qt::AA_DontUseNativeMenuWindows
Now that we enable native menus by default for the macOS style, we also need to make sure that we actually respect the Qt::AA_DontUseNativeMenuWindows. Pick-to: 6.8 Change-Id: I2a02b5528110a4e0514fb53c0673653f0086dfe8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/manual/quickcontrols/menus/cppsettings.cpp')
-rw-r--r--tests/manual/quickcontrols/menus/cppsettings.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/manual/quickcontrols/menus/cppsettings.cpp b/tests/manual/quickcontrols/menus/cppsettings.cpp
index 589cea916b..1bb3bc7d8f 100644
--- a/tests/manual/quickcontrols/menus/cppsettings.cpp
+++ b/tests/manual/quickcontrols/menus/cppsettings.cpp
@@ -41,3 +41,19 @@ void CppSettings::setPopupType(int newPopupType)
mSettings.setValue("popupType", newPopupType);
emit popupTypeChanged();
}
+
+bool CppSettings::dontUseNativeMenuWindows() const
+{
+ return mSettings.value("dontUseNativeMenuWindows").toBool();
+}
+
+void CppSettings::setDontUseNativeMenuWindows(bool dontUseNativeMenuWindows)
+{
+ const bool oldValue = this->dontUseNativeMenuWindows();
+ if (dontUseNativeMenuWindows == oldValue)
+ return;
+
+ QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuWindows, dontUseNativeMenuWindows);
+ mSettings.setValue("dontUseNativeMenuWindows", dontUseNativeMenuWindows);
+ emit dontUseNativeMenuWindowsChanged();
+}