path: root/src
diff options
authorShawn Rutledge <>2016-09-15 14:07:07 +0200
committerShawn Rutledge <>2016-09-26 14:13:20 +0000
commit8cd28ea8850c5365c47dd65de16f528e2e223835 (patch)
treeb0156559fe7e6740a94dcd040d6bd7119aa8f4c3 /src
parent680dd3313cd15ab4d9d6b8b3bde77aabbd8de0b0 (diff)
QGuiApplication, platform plugins: don't modify AA_DontUseNativeMenuBar
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 <>
Diffstat (limited to 'src')
3 files changed, 0 insertions, 11 deletions
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<QByteArray> &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);
// 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/ b/src/plugins/platforms/cocoa/
index f02dad675e..e481cede17 100644
--- a/src/plugins/platforms/cocoa/
+++ b/src/plugins/platforms/cocoa/
@@ -300,8 +300,6 @@ QCocoaIntegration::QCocoaIntegration(const QStringList &paramList)
QMacAutoReleasePool pool;
- qApp->setAttribute(Qt::AA_DontUseNativeMenuBar, false);
NSApplication *cocoaApplication = [QNSApplication sharedApplication];