Warning, /plasma/plasma-nm/kcm/qml/ListItem.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2010 Marco Martin <notmart@gmail.com>
0003     SPDX-FileCopyrightText: 2016 Jan Grulich <jgrulich@redhat.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 import QtQuick 2.1
0009 import org.kde.plasma.core 2.0 as PlasmaCore
0010 import org.kde.kirigami 2.15 as Kirigami
0011 
0012 MouseArea {
0013     id: listItem
0014 
0015     default property alias content: paddingItem.data
0016     property bool checked: false
0017     property bool sectionDelegate: false
0018 
0019     width: parent ? parent.width : undefined
0020     height: paddingItem.childrenRect.height + background.margins.top + background.margins.bottom
0021     implicitHeight: paddingItem.childrenRect.height + Math.round(Kirigami.Units.gridUnit / 2)
0022     property bool changeBackgroundOnPress: !listItem.checked && !listItem.sectionDelegate
0023     hoverEnabled: true
0024 
0025     onPressed: if (changeBackgroundOnPress) background.prefix = "pressed"
0026     onReleased: if (changeBackgroundOnPress) background.prefix = "normal"
0027     onCanceled: if (changeBackgroundOnPress) background.prefix = "normal"
0028 
0029     Rectangle {
0030         id: background
0031 
0032         anchors.fill: parent
0033         visible: listItem.ListView.view ? listItem.ListView.view.highlight === null : true
0034         opacity: !listItem.checked && listItem.containsMouse && !listItem.pressed ? 0.5 : 1
0035         color: listItem.sectionDelegate ? alternateBaseColor : (listItem.checked || listItem.containsMouse ? highlightColor : baseColor)
0036     }
0037 
0038     PlasmaCore.SvgItem {
0039         svg: PlasmaCore.Svg {imagePath: "widgets/listitem"}
0040         elementId: "separator"
0041         anchors {
0042             left: parent.left
0043             right: parent.right
0044             top: parent.top
0045         }
0046         height: naturalSize.height
0047         visible: listItem.sectionDelegate || (typeof(index) != "undefined" && index > 0 && !listItem.checked && !listItem.pressed)
0048     }
0049 
0050     Item {
0051         id: paddingItem
0052         anchors {
0053             fill: parent
0054             margins: Math.round(Kirigami.Units.gridUnit / 3)
0055         }
0056     }
0057 
0058     Accessible.role: Accessible.ListItem
0059 }