Kirigami2

Action.qml
1/*
2 * SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org>
3 * SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
4 *
5 * SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7
8import QtQuick
9import QtQuick.Controls as QQC2
10import QtQuick.Templates as T
11import org.kde.kirigami as Kirigami
12
13/**
14 * @brief An item that represents an abstract Action
15 * @inherit QtQuick.QQC2.Action
16 */
17QQC2.Action {
18//BEGIN properties
19 /**
20 * @brief This property holds whether the graphic representation of the action
21 * is supposed to be visible.
22 *
23 * It's up to the action representation to honor this property.
24 *
25 * default: ``true``
26 */
27 property bool visible: true
28
29 /**
30 * @brief This property holds the tooltip text that is shown when the cursor is hovering over the control.
31 *
32 * Leaving this undefined or setting it to an empty string means that no tooltip will be shown when
33 * the cursor is hovering over the control that triggers the tooltip.
34 * @warning Tooltips may not be supported on all platforms.
35 */
36 property string tooltip
37
38 /**
39 * @brief This property sets whether this action is a separator action.
40 *
41 * default: ``false``
42 */
43 property bool separator: false
44
45 /**
46 * @brief This property sets whether this action becomes a title displaying
47 * its child actions as sub-items in GlobalDrawers and ContextDrawers.
48 *
49 * default: ``false``
50 *
51 * @since 2.6
52 */
53 property bool expandible: false
54
55 /**
56 * @brief This property holds the parent action.
57 */
58 property T.Action parent
59
60 /**
61 * @brief This property sets this action's display type.
62 *
63 * These are provided to implementations to indicate a preference for certain display
64 * styles.
65 *
66 * default: ``Kirigami.DisplayHint.NoPreference``
67 *
68 * @note This property contains only preferences, implementations may choose to disregard them.
69 * @see org::kde::kirigami::DisplayHint
70 * @since 2.12
71 */
72 property int displayHint: Kirigami.DisplayHint.NoPreference
74 /**
75 * @brief This property holds the component that should be used for displaying this action.
76 * @note This can be used to display custom components in the toolbar.
77 * @since 5.65
78 * @since 2.12
79 */
80 property Component displayComponent
81
82 /**
83 * @brief This property holds a list of child actions.
84 *
85 * This is useful for tree-like menus, such as the GlobalDrawer.
86 *
87 * Example usage:
88 * @code
89 * import QtQuick.Controls as QQC2
90 * import org.kde.kirigami as Kirigami
91 *
92 * Kirigami.Action {
93 * text: "Tools"
94 *
95 * QQC2.Action {
96 * text: "Action1"
97 * }
98 * Kirigami.Action {
99 * text: "Action2"
100 * }
101 * }
102 * @endcode
103 * @property list<T.Action> children
104 */
105 default property list<T.Action> children
106//END properties
107
108 onChildrenChanged: {
109 children
110 .filter(action => action instanceof Kirigami.Action)
111 .forEach(action => {
112 action.parent = this;
113 });
114 }
115
116 /**
117 * @brief This property holds the action's visible child actions.
118 * @property list<T.Action> visibleChildren
119 */
120 readonly property list<T.Action> visibleChildren: children
121 .filter(action => !(action instanceof Kirigami.Action) || action.visible)
122}
QStringList filter(QStringView str, Qt::CaseSensitivity cs) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Apr 27 2024 22:13:10 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.