diff options
-rw-r--r-- | tools/designer/src/lib/shared/qdesigner_menubar.cpp | 2 | ||||
-rw-r--r-- | 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 <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[] = { |