Add removeMenuItem to PlasmaComponents.ContextMenu

REVIEW: 128999
This commit is contained in:
David Rosca 2016-09-26 17:54:45 +02:00
parent 95f01093ac
commit 1369bca36f
2 changed files with 17 additions and 0 deletions

View File

@ -226,6 +226,16 @@ void QMenuProxy::addSection(const QString &text)
m_menu->addSection(text);
}
void QMenuProxy::removeMenuItem(QMenuItem *item)
{
if (!item) {
return;
}
m_menu->removeAction(item->action());
m_items.removeOne(item);
}
void QMenuProxy::itemTriggered(QAction *action)
{
QMenuItem *item = qobject_cast<QMenuItem *>(action);

View File

@ -147,6 +147,13 @@ public:
*/
Q_INVOKABLE void addSection(const QString &text);
/**
* This removes MenuItem 'item'
*
* @since 5.27
*/
Q_INVOKABLE void removeMenuItem(QMenuItem *item);
protected:
bool event(QEvent *event) Q_DECL_OVERRIDE;