summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-09-25 10:16:01 (GMT)
committerFriedemann Kleint <Friedemann.Kleint@nokia.com>2009-09-25 10:16:01 (GMT)
commit783ca8d44fd87f842323ad1f9e2fef4a5d0b37ad (patch)
tree6d422b03a3d695bd3b70ccebcf5e9c7b36f99688 /tools
parent6d240dd985bc9af5756ff6f494112d677cb8148f (diff)
downloadQt-783ca8d44fd87f842323ad1f9e2fef4a5d0b37ad.zip
Qt-783ca8d44fd87f842323ad1f9e2fef4a5d0b37ad.tar.gz
Qt-783ca8d44fd87f842323ad1f9e2fef4a5d0b37ad.tar.bz2
Make menu editor work on Mac OS X.
Fix a regression caused by the introduction of the QMenuBar::nativeMenuBar property (defaulting to true), which caused it the menu editor to disappear. Handle QMenuBar::nativeMenuBar it as a fake property, keeping it set to false for Form Editor. Reviewed-by: Jarek Kobus <jkobus@trolltech.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menubar.cpp2
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertysheet.cpp11
2 files changed, 11 insertions, 2 deletions
diff --git a/tools/designer/src/lib/shared/qdesigner_menubar.cpp b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
index 6d231ca..80c7b53 100644
--- a/tools/designer/src/lib/shared/qdesigner_menubar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
@@ -104,6 +104,8 @@ QDesignerMenuBar::QDesignerMenuBar(QWidget *parent) :
setContextMenuPolicy(Qt::DefaultContextMenu);
setAcceptDrops(true); // ### fake
+ // Fake property: Keep the menu bar editable in the form even if a native menu bar is used.
+ setNativeMenuBar(false);
m_addMenu->setText(tr("Type Here"));
addAction(m_addMenu);
diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 851bfc1..7574fdd 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -63,6 +63,7 @@
#include <QtGui/QApplication>
#include <QtGui/QToolBar>
#include <QtGui/QMainWindow>
+#include <QtGui/QMenuBar>
QT_BEGIN_NAMESPACE
@@ -611,9 +612,15 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
createFakeProperty(QLatin1String("dragEnabled"));
// windowModality is visible only for the main container, in which case the form windows enables it on loading
setVisible(createFakeProperty(QLatin1String("windowModality")), false);
- if (qobject_cast<const QToolBar *>(d->m_object)) // prevent toolbars from being dragged off
+ if (qobject_cast<const QToolBar *>(d->m_object)) { // prevent toolbars from being dragged off
createFakeProperty(QLatin1String("floatable"), QVariant(true));
-
+ } else {
+ if (qobject_cast<const QMenuBar *>(d->m_object)) {
+ // Keep the menu bar editable in the form even if a native menu bar is used.
+ const bool nativeMenuBarDefault = !qApp->testAttribute(Qt::AA_DontUseNativeMenuBar);
+ createFakeProperty(QLatin1String("nativeMenuBar"), QVariant(nativeMenuBarDefault));
+ }
+ }
if (d->m_canHaveLayoutAttributes) {
static const QString layoutGroup = QLatin1String("Layout");
const char* fakeLayoutProperties[] = {