X11: Keep the menubar inside the widgetbox window in toplevel mode
authorMichał Zając <quintasan@kubuntu.org>
Fri, 13 May 2011 08:40:05 +0000 (10:40 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 12 Sep 2011 15:29:43 +0000 (17:29 +0200)
For now the appmenu protocol does not make it possible to associate a
menubar with all application windows. This means in top level mode you
can only reach the menubar when the widgetbox window is active. Since
this is quite inconvenient, better not use the native menubar in this
configuration and keep the menubar in the widgetbox window.

Merge-request: 1229
Reviewed-by: denis
(cherry-picked from commit a45398677309ab905b69c599177b4c2951292b04)

Change-Id: Ib2994551558d87db84874f84f279be5e766cde15
Reviewed-on: http://codereview.qt-project.org/4602
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
src/designer/src/designer/qdesigner_workbench.cpp

index fa8dbe0..627148b 100644 (file)
@@ -410,6 +410,9 @@ void QDesignerWorkbench::switchToDockedMode()
 
     switchToNeutralMode();
 
+#ifdef Q_WS_X11
+    QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, false);
+#endif
 #ifndef Q_WS_MAC
     QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow();
     widgetBoxWrapper->action()->setVisible(true);
@@ -477,6 +480,14 @@ void QDesignerWorkbench::switchToTopLevelMode()
     // The widget box is special, it gets the menubar and gets to be the main widget.
 
     m_core->setTopLevel(widgetBoxWrapper);
+#ifdef Q_WS_X11
+    // For now the appmenu protocol does not make it possible to associate a
+    // menubar with all application windows. This means in top level mode you
+    // can only reach the menubar when the widgetbox window is active. Since
+    // this is quite inconvenient, better not use the native menubar in this
+    // configuration and keep the menubar in the widgetbox window.
+    QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);
+#endif
 #ifndef Q_WS_MAC
     widgetBoxWrapper->setMenuBar(m_globalMenuBar);
     widgetBoxWrapper->action()->setVisible(false);