From e121edf7d8b82c3b373b958537bdea7b51ec1750 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 30 Dec 2011 17:48:14 +0100 Subject: [PATCH] update the menu at childAdded/removed --- declarativeimports/plasmacomponents/qmenu.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/declarativeimports/plasmacomponents/qmenu.cpp b/declarativeimports/plasmacomponents/qmenu.cpp index 92b69a4a9..137557308 100644 --- a/declarativeimports/plasmacomponents/qmenu.cpp +++ b/declarativeimports/plasmacomponents/qmenu.cpp @@ -83,7 +83,7 @@ void QMenuProxy::setVisualParent(QObject *parent) action->setMenu(m_menu); m_menu->clear(); foreach(QMenuItem* item, m_items) { - m_menu->addAction (item); + m_menu->addAction(item); } m_menu->updateGeometry(); } @@ -100,6 +100,7 @@ bool QMenuProxy::event(QEvent *event) QMenuItem *mi = qobject_cast(ce->child()); //FIXME: linear complexity here if (mi && !m_items.contains(mi)) { + m_menu->addAction(mi); m_items << mi; } break; @@ -111,6 +112,7 @@ bool QMenuProxy::event(QEvent *event) //FIXME: linear complexity here if (mi) { + m_menu->removeAction(mi); m_items.removeAll(mi); } break; @@ -133,11 +135,13 @@ void QMenuProxy::addMenuItem(const QString &text) { QMenuItem *item = new QMenuItem(this); item->setText(text); + m_menu->addAction(item); m_items << item; } void QMenuProxy::addMenuItem(QMenuItem *item) { + m_menu->addAction(item); m_items << item; }