aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/quickcontrols/menus/main.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2024-03-14 11:36:06 +0800
committerMitch Curtis <mitch.curtis@qt.io>2024-04-17 15:05:01 +0800
commit822db20f84e188de0adb49741c751548d3c000ea (patch)
treefcb0d61de31ea91b9608642ca0c3ab81219364ac /tests/manual/quickcontrols/menus/main.cpp
parent55806207069a7014bde8785d7352e84f9e9f9406 (diff)
Menu, MenuBar: remove requestNative and rely solely on app attributes
It was decided that we'll have two attributes: - AA_DontUseNativeMenuBar - AA_DontUseNativeMenuWindows Setting AA_DontUseNativeMenuWindows only affects windows we create (context menus, combobox menus, menus of non-native menu bars). So, setting AA_DontUseNativeMenuWindows restores Qt to today's behavior. But we can't control the windows of native menu bars, so if you don't want those to be native, you have to set AA_DontUseNativeMenuBar just like today. By removing requestNative, we also effectively default to native menus and menu bars, as the attributes are not set by default. [ChangeLog][Controls][Important Behavior Changes] Menu and MenuBar now use native menus by default on platforms where they're supported. Task-number: QTBUG-69558 Change-Id: Ia917c2f820634def0cf815aa8ca8895ca79db75d Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/manual/quickcontrols/menus/main.cpp')
-rw-r--r--tests/manual/quickcontrols/menus/main.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/manual/quickcontrols/menus/main.cpp b/tests/manual/quickcontrols/menus/main.cpp
index d08850551e..e9b4e6d5eb 100644
--- a/tests/manual/quickcontrols/menus/main.cpp
+++ b/tests/manual/quickcontrols/menus/main.cpp
@@ -7,17 +7,20 @@
int main(int argc, char *argv[])
{
- QGuiApplication::setApplicationName("menus");
QGuiApplication::setOrganizationName("QtProject");
+ QGuiApplication::setApplicationName("menus");
QGuiApplication app(argc, argv);
-// app.setAttribute(Qt::AA_DontUseNativeMenuBar, true);
- qputenv("QT_QUICK_CONTROLS_USE_NATIVE_MENUS", "1");
-
QQmlApplicationEngine engine;
engine.setInitialProperties({{ "currentStyle", QQuickStyle::name() }});
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ QObject::connect(
+ &engine,
+ &QQmlApplicationEngine::objectCreationFailed,
+ &app,
+ []() { QCoreApplication::exit(-1); },
+ Qt::QueuedConnection);
+ engine.loadFromModule("Menus", "Main");
return app.exec();
}