allow adding separators to the context menu
This commit is contained in:
parent
486fbf6f82
commit
1e2e094fdd
@ -248,6 +248,21 @@ QRectF AppletInterface::rect() const
|
||||
return applet()->contentsRect();
|
||||
}
|
||||
|
||||
void AppletInterface::setActionSeparator(const QString &name)
|
||||
{
|
||||
Plasma::Applet *a = applet();
|
||||
QAction *action = a->action(name);
|
||||
|
||||
if (!action) {
|
||||
action->setSeparator(true);
|
||||
} else {
|
||||
action = new QAction(this);
|
||||
action->setSeparator(true);
|
||||
a->addAction(name, action);
|
||||
m_actions.append(name);
|
||||
}
|
||||
}
|
||||
|
||||
void AppletInterface::setAction(const QString &name, const QString &text, const QString &icon, const QString &shortcut)
|
||||
{
|
||||
Plasma::Applet *a = applet();
|
||||
|
@ -256,6 +256,7 @@ enum IntervalAlignment {
|
||||
Q_INVOKABLE QSizeF size() const;
|
||||
Q_INVOKABLE QRectF rect() const;
|
||||
|
||||
Q_INVOKABLE void setActionSeparator(const QString &name);
|
||||
Q_INVOKABLE void setAction(const QString &name, const QString &text,
|
||||
const QString &icon = QString(), const QString &shortcut = QString());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user