From 8cd28ea8850c5365c47dd65de16f528e2e223835 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 15 Sep 2016 14:07:07 +0200 Subject: QGuiApplication, platform plugins: don't modify AA_DontUseNativeMenuBar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default should be false, meaning the application will prefer to use a native menubar if the platform supports it. The application author can set it to true if he wants to always use a Qt-rendered menubar instead; or, he can call QMenuBar::setNativeMenuBar(). Qt and its plugins should not override the author's wishes. Instead, if the platform plugin cannot create a native menubar for whatever reason, createPlatformMenuBar() will return null, and QMenuBar will fall back to using a Qt menubar instead. The application can check the result via QMenuBar::isNativeMenuBar(). QMdiArea when maximized inside a QMainWindow with an empty title does not replace the main window's title if we are using native menus. This behavior turned out to be the same on Unity as it is on macOS, so the autotest needed adjustment to expect that behavior whenever the menubar is native, not only on certain platforms. tst_QMenuBar::allowActiveAndDisabled() tests a standalone QMenuBar. In f92f78094 it was disabled on macOS, but on Ubuntu it passes as long as we force it to be a non-native menubar, so it should pass that way on macOS too. Removed unused variable RESET to fix warning. Task-number: QTBUG-54793 Change-Id: I716e40da709f96331cbbf25213bd7bc153e4dbe2 Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qguiapplication.cpp | 6 ------ src/plugins/platforms/android/qandroidplatformtheme.cpp | 3 --- src/plugins/platforms/cocoa/qcocoaintegration.mm | 2 -- 3 files changed, 11 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f60cfd8af3..353b623a3b 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1192,12 +1192,6 @@ static void init_plugins(const QList &pluginList) void QGuiApplicationPrivate::createPlatformIntegration() { - // Use the Qt menus by default. Platform plugins that - // want to enable a native menu implementation can clear - // this flag. - QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); - - QHighDpiScaling::initHighDpiScaling(); // Load the platform integration diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index 3949113240..f8d0b9c8ba 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -368,9 +368,6 @@ QAndroidPlatformTheme::QAndroidPlatformTheme(QAndroidPlatformNativeInterface *an // default in case the style has not set a font m_systemFont = QFont(QLatin1String("Roboto"), 14.0 * 100 / 72); // keep default size the same after changing from 100 dpi to 72 dpi - - // by default use native menu bar - QCoreApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, false); } QPlatformMenuBar *QAndroidPlatformTheme::createPlatformMenuBar() const diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index f02dad675e..e481cede17 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -300,8 +300,6 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList) initResources(); QMacAutoReleasePool pool; - qApp->setAttribute(Qt::AA_DontUseNativeMenuBar, false); - NSApplication *cocoaApplication = [QNSApplication sharedApplication]; qt_redirectNSApplicationSendEvent(); -- cgit v1.2.3