Plasma::ContainmentActions Class

The base ContainmentActions class. More...

Header: #include <Plasma/ContainmentActions>
CMake: find_package(Plasma REQUIRED)
target_link_libraries(mytarget PRIVATE Plasma::Plasma)
Inherits: QObject

Public Functions

ContainmentActions(QObject *parent = nullptr)
virtual void configurationAccepted()
Plasma::Containment *containment()
virtual QList<QAction *> contextualActions()
virtual QWidget *createConfigurationInterface(QWidget *parent)
(since 5.67) KPluginMetaData metadata() const
virtual void performNextAction()
virtual void performPreviousAction()
virtual void restore(const KConfigGroup &config)
virtual void save(KConfigGroup &config)
(since 4.6) void setContainment(Plasma::Containment *newContainment)

Static Public Members

QString eventToString(QEvent *event)

Protected Functions

ContainmentActions(QObject *parent, const QVariantList &args)

Detailed Description

"ContainmentActions" are components that provide actions (usually displaying a contextmenu) in response to an event with a position (usually a mouse event).

ContainmentActions plugins are registered using .desktop files. These files should be named using the following naming scheme:

plasma-containmentactions-<pluginname>.desktop

Member Function Documentation

[explicit] ContainmentActions::ContainmentActions(QObject *parent = nullptr)

Default constructor for an empty or null containmentactions

[protected] ContainmentActions::ContainmentActions(QObject *parent, const QVariantList &args)

This constructor is to be used with the plugin loading systems found in KPluginInfo and KService. The argument list is expected to have one element: the KService service ID for the desktop entry.

parent a QObject parent; you probably want to pass in 0

args a list of strings containing one entry: the service id

[virtual] void ContainmentActions::configurationAccepted()

This method is called when the user's configuration changes are accepted

Plasma::Containment *ContainmentActions::containment()

Returns the containment the plugin is associated with.

See also setContainment().

[virtual] QList<QAction *> ContainmentActions::contextualActions()

Implement this to provide a list of actions that can be added to another menu for example, when right-clicking an applet, the "Activity Options" submenu is populated with this.

[virtual] QWidget *ContainmentActions::createConfigurationInterface(QWidget *parent)

Returns the widget used in the configuration dialog. Add the configuration interface of the containmentactions to this widget.

[static] QString ContainmentActions::eventToString(QEvent *event)

Turns a mouse or wheel event into a string suitable for a ContainmentActions Returns the string representation of the event

[since 5.67] KPluginMetaData ContainmentActions::metadata() const

Returns the metadata for this ContainmentActions instance including name, pluginName and icon

This function was introduced in 5.67.

[virtual] void ContainmentActions::performNextAction()

Called when a "next" action is triggered (e.g. by mouse wheel scroll). This can be used to scroll through a list of items this plugin manages such as windows, virtual desktops, activities, etc.

See also performPrevious.

[virtual] void ContainmentActions::performPreviousAction()

Called when a "previous" action is triggered (e.g. by mouse wheel scroll). This can be used to scroll through a list of items this plugin manages such as windows, virtual desktops, activities, etc.

See also performNext.

[virtual] void ContainmentActions::restore(const KConfigGroup &config)

This method should be called once the plugin is loaded or settings are changed.

config Config group to load settings

See also init.

[virtual] void ContainmentActions::save(KConfigGroup &config)

This method is called when settings need to be saved.

config Config group to save settings

[since 4.6] void ContainmentActions::setContainment(Plasma::Containment *newContainment)

newContainment the containment the plugin should be associated with.

This function was introduced in 4.6.

See also containment().