From 783ca8d44fd87f842323ad1f9e2fef4a5d0b37ad Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 25 Sep 2009 12:16:01 +0200 Subject: 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 --- tools/designer/src/lib/shared/qdesigner_menubar.cpp | 2 ++ tools/designer/src/lib/shared/qdesigner_propertysheet.cpp | 11 +++++++++-- 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 #include #include +#include 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(d->m_object)) // prevent toolbars from being dragged off + if (qobject_cast(d->m_object)) { // prevent toolbars from being dragged off createFakeProperty(QLatin1String("floatable"), QVariant(true)); - + } else { + if (qobject_cast(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[] = { -- cgit v0.12