21 import org.kde.plasma.core 0.1 as PlasmaCore
22 import "private/Config.js" as Config
31 default property alias content: paddingItem.data
38 property alias enabled: itemMouse.enabled
65 property bool checked:
false
72 property bool sectionDelegate:
false
74 width: parent ? parent.width : childrenRect.width
75 height: paddingItem.childrenRect.height + background.margins.top + background.margins.bottom
77 property int implicitHeight: paddingItem.childrenRect.height + background.margins.top + background.margins.bottom
82 onCheckedChanged: background.prefix = (listItem.checked ?
"pressed" :
"normal")
83 onSectionDelegateChanged: background.prefix = (listItem.sectionDelegate ?
"section" :
"normal")
86 PlasmaCore.FrameSvgItem {
88 imagePath:
"widgets/listitem"
92 visible: listItem.ListView.view ? listItem.ListView.view.highlight === null :
true
93 opacity: itemMouse.containsMouse && !itemMouse.pressed ? 0.5 : 1
94 Component.onCompleted: {
95 prefix = (listItem.sectionDelegate ?
"section" : (listItem.checked ?
"pressed" :
"normal"))
97 Behavior on opacity { NumberAnimation { duration: 200 } }
100 svg: PlasmaCore.Svg {imagePath:
"widgets/listitem"}
101 elementId:
"separator"
107 height: naturalSize.height
108 visible: listItem.sectionDelegate || (typeof(index) !=
"undefined" && index > 0 && !listItem.checked && !itemMouse.pressed)
113 property bool changeBackgroundOnPress: !listItem.checked && !listItem.sectionDelegate
114 anchors.fill: background
116 hoverEnabled: Config.mouseOverEnabled
118 onClicked: listItem.clicked()
119 onPressAndHold: listItem.pressAndHold()
120 onPressed:
if (changeBackgroundOnPress) background.prefix =
"pressed"
121 onReleased:
if (changeBackgroundOnPress) background.prefix =
"normal"
122 onCanceled:
if (changeBackgroundOnPress) background.prefix =
"normal"
129 leftMargin: background.margins.left
130 topMargin: background.margins.top
131 rightMargin: background.margins.right
132 bottomMargin: background.margins.bottom