10import QtQuick.Templates as T
11import org.kde.ksvg as KSvg
13import org.kde.plasma.core as PlasmaCore
14import org.kde.kirigami as Kirigami
19 implicitWidth: Math.max(background ? background.implicitWidth : 0,
20 contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
21 implicitHeight: Math.max(background ? background.implicitHeight : 0,
22 contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
24 delegate: MenuItem { width: parent.width; onImplicitWidthChanged: control.contentItem.contentItem.childrenChanged() }
29 leftPadding: (background as
KSvg.FrameSvgItem)?.margins.left ?? undefined
30 rightPadding: (background as
KSvg.FrameSvgItem)?.margins.right ?? undefined
31 bottomPadding: (background as
KSvg.FrameSvgItem)?.margins.bottom ?? undefined
33 contentItem: ListView {
34 implicitHeight: contentHeight
35 property bool hasCheckables: false
36 property bool hasIcons: false
37 model: control.contentModel
41 for (var i = 0; i < contentItem.children.length; ++i) {
42 maxWidth = Math.max(maxWidth, contentItem.children[i].implicitWidth);
47 interactive:
Window.window ? contentHeight + control.topPadding + control.bottomPadding >
Window.window.height :
false
49 currentIndex: control.currentIndex || 0
50 keyNavigationEnabled:
true
51 keyNavigationWraps:
true
53 T.ScrollBar.vertical: ScrollBar {}
57 target: control.contentItem.contentItem
59 function onChildrenChanged() {
60 for (var i in control.contentItem.contentItem.children) {
61 var child = control.contentItem.contentItem.children[i];
62 if (child.checkable) {
63 control.contentItem.hasCheckables =
true;
65 if (child.icon && child.icon.hasOwnProperty(
"name") && (child.icon.name.length > 0 || child.icon.source.length > 0)) {
66 control.contentItem.hasIcons =
true;
77 easing.type: Easing.InOutQuad
78 duration:
Kirigami.Units.shortDuration
87 easing.type: Easing.InOutQuad
88 duration:
Kirigami.Units.shortDuration
93 imagePath:
"widgets/background"
94 implicitWidth:
Kirigami.Units.gridUnit * 8
95 implicitHeight:
Kirigami.Units.gridUnit * 2