Kirigami-addons

AbstractHeaderComponent.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
8
9import org.kde.kirigami as Kirigami
10
11/**
12 * @brief Abstract header component.
13 *
14 * Designed to form a set of properties that will be used in the implementation.
15 *
16 * @inherit QtQml.QtObject
17 */
18QtObject {
19 id: component
21 /**
22 * @brief Stores the current width of an entire table column.
23 */
24 property real width
25
26 /**
27 * @brief Stores the minimum allowed width of the entire column
28 */
29 property real minimumWidth: Kirigami.Units.gridUnit * 2
30
31 /**
32 * @brief Column title.
33 *
34 * Default used in default headerDelegate.
35 *
36 * @see headerDelegate
37 */
38 property string title
39
40 /**
41 * @brief The name of the role from the model for the current column.
42 *
43 * Used to access the value that is stored in the model for that role.
44 */
45 property string textRole
46
47 /**
48 * @brief The role value from the model for the current column.
49 *
50 * By default, used to indicate the column by which the table is sorted.
51 */
52 property int role
53
54 /**
55 * @brief The property is responsible for displaying the entire column in the table.
56 */
57 property bool visible: true
58
59 /**
60 * @brief The flag reflects the ability to change the original column size.
61 */
62 property bool resizable: true
63
64 /**
65 * @brief The flag reflects the ability to move the current column to another place in the table.
66 */
67 property bool draggable
69 /**
70 * @brief The element that will be used as the base element to display in all delegates of this column.
71 *
72 * It can be customized to put any kind of Item in there.
73 */
74 property Component itemDelegate: __baseDelegate
75
76 /**
77 * @brief This property holds an item that will be displayed as the main component of the column.
78 *
79 * It can be customized to put any kind of Item in there.
80 */
81 property Component headerDelegate: __baseDelegate
82
83 /**
84 * @brief This property holds an item that will be displayed to the left
85 * of the headerDelegate contents.
86 *
87 * It can be customized to put any kind of Item in there.
88 *
89 * @see headerDelegate
90 */
91 property Component leading
92
93 readonly property Component __baseDelegate: QQC2.Label {
94 id: label
95 text: modelData ?? ""
96 elide: Text.ElideRight
97 verticalAlignment: Qt.AlignVCenter
98 horizontalAlignment: Qt.AlignLeft
99 leftPadding: Kirigami.Units.largeSpacing
100 rightPadding: Kirigami.Units.largeSpacing
101
102 QQC2.ToolTip.visible: truncated && handler.hovered
103 QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay
104 QQC2.ToolTip.text: text
105
106 HoverHandler {
107 id: handler
108 enabled: label.truncated
109 }
110 }
111}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:33:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.