From 467e3fc798f067ba4d3f22c32066e9d12c64fd3c Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 9 Aug 2013 13:28:49 +0200 Subject: MenuBar: Make sure invisible menus appear so Task-number: QTBUG-32899 Change-Id: Id07baba90ff45ba420d563ce47ee58964d4e4d02 Reviewed-by: Jens Bache-Wiig --- src/controls/qquickmenu.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/controls/qquickmenu.cpp') diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp index bb0ddae9..2dbaf952 100644 --- a/src/controls/qquickmenu.cpp +++ b/src/controls/qquickmenu.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qquickmenu_p.h" +#include "qquickmenubar_p.h" #include "qquickmenuitemcontainer_p.h" #include "qquickmenupopupwindow_p.h" @@ -110,7 +111,7 @@ QT_BEGIN_NAMESPACE \qmlproperty bool Menu::visible Whether the menu should be visible. This is only enabled when the menu is used as - a submenu. Its value defaults to \c true. + a submenu or in the menubar. Its value defaults to \c true. */ /*! @@ -271,6 +272,17 @@ QQuickMenu::~QQuickMenu() m_platformMenu = 0; } +void QQuickMenu::setVisible(bool v) +{ + QQuickMenuBase::setVisible(v); + if (m_platformMenu) { + m_platformMenu->setVisible(v); + QQuickMenuBar *menubar = qobject_cast(parent()); + if (menubar && menubar->platformMenuBar()) + menubar->platformMenuBar()->syncMenu(m_platformMenu); + } +} + void QQuickMenu::updateText() { if (m_platformMenu) -- cgit v1.2.1