KirigamiActions::ActionCollection Class

class KirigamiActions::ActionCollection

This class is the C++ entry point to access QAction instabces created by the ActionCollection QML module. With this is possible to define new actions on the C++ side or access ones created from QML, to either connect to them or change proeprties. More...

Header: #include <Kirigami/ActionCollection/ActionCollection>
In QML: ActionCollection

Public Functions

QAction *action(KStandardActions::StandardAction standardAction)
QAction *action(const QString &name)
QList<QAction *> actions() const
QAction *createAction(KStandardActions::StandardAction standardAction)
QAction *createAction(const QString &name, const QString &iconName, const QString &text)
QString name() const
void setText(const QString &text)
QString text() const

Signals

void actionInserted(QAction *action)
void actionRemoved(QAction *action)
void textChanged(const QString &text)

Detailed Description

Member Function Documentation

QAction *ActionCollection::action(KStandardActions::StandardAction standardAction)

Returns an action based on the given standardAction IF no action based of the standardAction is present, the function will return nullptr

standardAction the standard action we want to search in the collection

[invokable] QAction *ActionCollection::action(const QString &name)

Returns an action given its unique name. If no action with that name exist, the function will return nullptr

name The unique name fir the action.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

[signal] void ActionCollection::actionInserted(QAction *action)

Emitted when a new action has been inserted in this collection action the new action

[signal] void ActionCollection::actionRemoved(QAction *action)

Emitted when an action has been removed from this collection action the old action

QList<QAction *> ActionCollection::actions() const

All known actions in this collection.

QAction *ActionCollection::createAction(KStandardActions::StandardAction standardAction)

Creates a new action and inserts it in this collection.

standardAction The KStandardActions::StandardAction we want to add: text and icon of the action will be automatically set

Returns the newly created QAction, or nullptr if an action with the same name was already present.

QAction *ActionCollection::createAction(const QString &name, const QString &iconName, const QString &text)

Creates a new action and inserts it in this collection.

name The unique name for the new action. No actions with that name should exist. iconName Name for the icon: should be a name present in the current icon theme. text The user readable text label for the new action.

Returns the newly created QAction, or nullptr if an action with the same name was already present.

QString ActionCollection::name() const

Returns the unique name for this collection. The name is guaranteed to be unique in the context of the whole application

void ActionCollection::setText(const QString &text)

Sets the user readable text label for this collection. This will be visible in the shortcut configuration page.

text The new text label for the collection

See also text().

QString ActionCollection::text() const

Returns the user readable text label for this collection. This will be visible in the shortcut configuration page.

See also setText().

[signal] void ActionCollection::textChanged(const QString &text)

Emitted when the user-reabable text label for this collection has changed.

text The new text label for the collection