summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-04-22 11:42:34 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-05-04 13:09:59 (GMT)
commit1e0e67406c3865717fef8b98d2c69adbefc54245 (patch)
treee26996ae282fee233e12e7674373bc5c9336a8d4 /src/corelib
parent4ac548735b1a62b2db344b5ee4ecc14207f1111d (diff)
downloadQt-1e0e67406c3865717fef8b98d2c69adbefc54245.zip
Qt-1e0e67406c3865717fef8b98d2c69adbefc54245.tar.gz
Qt-1e0e67406c3865717fef8b98d2c69adbefc54245.tar.bz2
Deprecate qt_mac_set_show_menubar for a public cross-platform API.
I'm tired of these "hidden" functions. We have an AA_MacPluginApplication, but sometimes you may have a legitimate reason for setting this outside of "plugin applications." In the footsteps of the menu icon attribute, the attribute is the main leader, but menubars can disable/enable this locally the new QMenuBar::setNativeMenuBar() property. Otherwise, the menubars take their que from the application attribute. This also works for Windows CE. So, there is a bit on convergence as well. Task-number: 236757
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qnamespace.h1
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp14
2 files changed, 15 insertions, 0 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 9b26ef3..4873b17 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -503,6 +503,7 @@ public:
AA_NativeWindows = 3,
AA_DontCreateNativeWidgetSiblings = 4,
AA_MacPluginApplication = 5,
+ AA_DontUseNativeMenuBar = 6,
// Add new attributes before this line
AA_AttributeCount
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index e4bd664..c21cf87 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -556,6 +556,20 @@ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on)
QCoreApplicationPrivate::attribs |= 1 << attribute;
else
QCoreApplicationPrivate::attribs &= ~(1 << attribute);
+#ifdef Q_OS_MAC
+ // Turn on the no native menubar here, since we used to
+ // do this implicitly. We DO NOT flip it off if someone sets
+ // it to false.
+ // Ideally, we'd have magic that would be something along the lines of
+ // "follow MacPluginApplication" unless explicitly set.
+ // Considering this attribute isn't only at the beginning
+ // it's unlikely it will ever be a problem, but I want
+ // to have the behavior documented here.
+ if (attribute == Qt::AA_MacPluginApplication && on
+ && !testAttribute(Qt::AA_DontUseNativeMenuBar)) {
+ setAttribute(Qt::AA_DontUseNativeMenuBar, true);
+ }
+#endif
}
/*!