Add removeMenuItem to PlasmaComponents.ContextMenu
REVIEW: 128999
This commit is contained in:
parent
95f01093ac
commit
1369bca36f
@ -226,6 +226,16 @@ void QMenuProxy::addSection(const QString &text)
|
|||||||
m_menu->addSection(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)
|
void QMenuProxy::itemTriggered(QAction *action)
|
||||||
{
|
{
|
||||||
QMenuItem *item = qobject_cast<QMenuItem *>(action);
|
QMenuItem *item = qobject_cast<QMenuItem *>(action);
|
||||||
|
@ -147,6 +147,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE void addSection(const QString &text);
|
Q_INVOKABLE void addSection(const QString &text);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This removes MenuItem 'item'
|
||||||
|
*
|
||||||
|
* @since 5.27
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void removeMenuItem(QMenuItem *item);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
bool event(QEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user