Warning, /plasma/kdeplasma-addons/applets/userswitcher/package/contents/ui/ListDelegate.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Kai Uwe Broulik <kde@privat.broulik.de>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.15
0008 import QtQuick.Layouts 1.15
0009 
0010 import org.kde.kirigami 2.20 as Kirigami
0011 import org.kde.plasma.core as PlasmaCore
0012 import org.kde.kirigami 2.20 as Kirigami
0013 import org.kde.plasma.components 3.0 as PlasmaComponents3
0014 
0015 PlasmaComponents3.ItemDelegate {
0016     id: item
0017 
0018     Layout.fillWidth: true
0019 
0020     property alias subText: sublabel.text
0021     property alias iconItem: iconItem.children
0022 
0023     highlighted: activeFocus
0024 
0025     Accessible.name: `${text}${subText ? `: ${subText}` : ""}`
0026 
0027     onHoveredChanged: if (hovered) {
0028         if (ListView.view) {
0029             ListView.view.currentIndex = index;
0030         }
0031         forceActiveFocus();
0032     }
0033 
0034     contentItem: RowLayout {
0035         id: row
0036 
0037         spacing: Kirigami.Units.smallSpacing
0038 
0039         Item {
0040             id: iconItem
0041 
0042             Layout.preferredWidth: Kirigami.Units.iconSizes.medium
0043             Layout.preferredHeight: Kirigami.Units.iconSizes.medium
0044             Layout.minimumWidth: Layout.preferredWidth
0045             Layout.maximumWidth: Layout.preferredWidth
0046             Layout.minimumHeight: Layout.preferredHeight
0047             Layout.maximumHeight: Layout.preferredHeight
0048         }
0049 
0050         ColumnLayout {
0051             id: column
0052             Layout.fillWidth: true
0053             spacing: 0
0054 
0055             PlasmaComponents3.Label {
0056                 id: label
0057                 Layout.fillWidth: true
0058                 text: item.text
0059                 textFormat: Text.PlainText
0060                 wrapMode: Text.NoWrap
0061                 elide: Text.ElideRight
0062             }
0063 
0064             PlasmaComponents3.Label {
0065                 id: sublabel
0066                 Layout.fillWidth: true
0067                 textFormat: Text.PlainText
0068                 wrapMode: Text.NoWrap
0069                 elide: Text.ElideRight
0070                 opacity: 0.6
0071                 font: Kirigami.Theme.smallFont
0072                 visible: text !== ""
0073             }
0074         }
0075     }
0076 }