Kirigami-addons

ListRowDelegate.qml
1/*
2 * Copyright 2023 Evgeny Chesnokov <echesnokov@astralinux.ru>
3 * SPDX-License-Identifier: LGPL-2.0-or-later
4 */
5
6import QtQuick
7import QtQuick.Controls as QQC2
8import QtQuick.Layouts
9
10import org.kde.kirigami as Kirigami
11
12QQC2.ItemDelegate {
13 id: delegate
14
15 Accessible.role: Accessible.Row
16 leftPadding: 0
17 rightPadding: 0
18 topPadding: 0
19 bottomPadding: 0
20
21 required property var model
22 required property int index
23
24 property bool alternatingRows
25
26 background: Rectangle {
27 color: {
28 if (delegate.enabled) {
29 if (delegate.down || delegate.highlighted) {
30 return Kirigami.Theme.highlightColor
31 }
32
33 if (delegate.hovered && !Kirigami.Settings.isMobile) {
34 return Qt.alpha(Kirigami.Theme.hoverColor, 0.3)
35 }
36 }
37
38 if (delegate.alternatingRows && index % 2) {
39 return Kirigami.Theme.alternateBackgroundColor;
40 }
41
42 return "Transparent"
43 }
44 }
45
46 contentItem: Row {
47 spacing: 0
48
49 Repeater {
50 model: root.__columnModel
51
52 delegate: ListCellDelegate {
53 implicitWidth: root.__columnModel.get(index).headerComponent.width
54 implicitHeight: root.__rowHeight
55 entry: delegate.model
56 rowIndex: delegate.index
57 }
58 }
59 }
60
61 onClicked: delegate.forceActiveFocus()
62}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 10 2024 11:50:14 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.