ActionCollection QML Type

A container for a set of QAction objects. More...

Import Statement: import org.kde.kirigamiaddons.actions
In C++: KirigamiActionCollection

Properties

Detailed Description

KirigamiActionCollection manages a set of QAction objects. It allows them to be grouped for organized presentation of configuration to the user, saving + loading of configuration, and optionally for automatic plugging into specified widget(s).

Additionally, KirigamiActionCollection provides several convenience functions for locating named actions, and actions grouped by QActionGroup.

In QML, declare ActionData and StandardActionData as children. They are registered with the supplied AbstractKirigamiApplication and become available to its command bar and configurable shortcut editor.

import org.kde.kirigamiaddons.actions as KirigamiActions

KirigamiActions.StatefulWindow {
    id: root
    application: MyApplication {}

    KirigamiActions.ActionCollection {
        application: root.application
        name: "main"
        text: i18n("Main Actions")

        KirigamiActions.ActionData {
            name: "open_search"
            text: i18n("Search")
            icon.name: "search"
            defaultShortcut: "Ctrl+F"
        }
    }
}

A QML action can refer to an action in a collection with the attached properties ActionCollection.collection and ActionCollection.action:

Kirigami.Action {
    ActionCollection.collection: "main"
    ActionCollection.action: "open_search"
    onTriggered: search.open()
}

Property Documentation

action : string

The name of the action in the collection.

actions : list<ActionData> [read-only]

The ActionData and StandardActionData children in this collection.

application : AbstractKirigamiApplication

The application to which the declared actions are added.

collection : string

The name of the action collection.

configGroup : string

configIsGlobal : bool

Declarative menus contributed by this collection.

name : string

The unique name of the collection.

text : string

The user-visible name shown for the collection in shortcut configuration.