Kirigami2
8 import QtQuick.Controls 2.15 as QQC2
9 import org.kde.kirigami 2.20 as Kirigami
15 property alias actions: actionsInstantiator.model
18 property Component itemDelegate: ActionMenuItem {}
19 property Component separatorDelegate: QQC2.MenuSeparator {
property var action }
20 property Component loaderDelegate: Loader {
property var action }
21 property QQC2.Action parentAction
22 property QQC2.MenuItem parentItem
29 id: actionsInstantiator
31 active: theMenu.visible
33 readonly
property QQC2.Action action: modelData
34 property QtObject item:
null
35 property bool isSubMenu:
false
38 if (!action.hasOwnProperty(
"children") && !action.children || action.children.length === 0) {
39 if (action.hasOwnProperty(
"separator") && action.separator) {
40 item = theMenu.separatorDelegate.createObject(
null, { action: action });
42 else if (action.displayComponent) {
43 item = theMenu.loaderDelegate.createObject(
null,
44 { action: action, sourceComponent: action.displayComponent });
47 item = theMenu.itemDelegate.createObject(
null, { action: action });
50 }
else if (theMenu.submenuComponent) {
51 item = theMenu.submenuComponent.createObject(
null, { parentAction: action, title: action.text, actions: action.children });
53 theMenu.insertMenu(theMenu.count, item)
54 item.parentItem = theMenu.contentData[theMenu.contentData.length-1]
55 item.parentItem.
icon = action.icon
61 theMenu.removeMenu(item)
63 theMenu.removeItem(item)
69 onObjectAdded:
object.create()
70 onObjectRemoved:
object.remove()
QAction * create(StandardGameAction id, const QObject *recvr, const char *slot, QObject *parent)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:14:23 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.