Warning, /frameworks/kirigami/src/controls/Action.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2016 Marco Martin <mart@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.7 0008 import QtQuick.Controls 2.4 as QQC2 0009 import org.kde.kirigami 2.14 as Kirigami 0010 0011 /** 0012 * @brief An item that represents an abstract Action 0013 * @inherit QtQuick.Controls.Action 0014 */ 0015 QQC2.Action { 0016 id: root 0017 0018 //BEGIN properties 0019 /** 0020 * @brief This property holds whether the graphic representation of the action 0021 * is supposed to be visible. 0022 * 0023 * It's up to the action representation to honor this property. 0024 * 0025 * default: ``true`` 0026 */ 0027 property bool visible: true 0028 0029 /** 0030 * @brief This property holds the icon name for the action. This will pick the icon with the given name from the current theme. 0031 * @deprecated Use the icon.name property instead. 0032 * @property string iconName 0033 */ 0034 property alias iconName: root.icon.name 0035 0036 /** 0037 * @brief This property holds an url to an icon file or resource url for the action. 0038 * @note Use this if you want a specific file rather than an icon from the theme. 0039 * @deprecated Use icon.source property instead. 0040 * @property url iconSource 0041 */ 0042 property alias iconSource: root.icon.source 0043 0044 /** 0045 * @brief This property holds the tooltip text that is shown when the cursor is hovering over the control. 0046 * 0047 * Leaving this undefined or setting it to an empty string means that no tooltip will be shown when 0048 * the cursor is hovering over the control that triggers the tooltip. 0049 * 0050 * @warning Tooltips may not be supported on all platforms. 0051 */ 0052 property string tooltip 0053 0054 /** 0055 * @brief This property sets whether this action is a separator action. 0056 * 0057 * default: ``false`` 0058 */ 0059 property bool separator: false 0060 0061 /** 0062 * @brief This property sets whether this action becomes a title displaying 0063 * its child actions as sub-items in GlobalDrawers and ContextDrawers. 0064 * 0065 * default: ``false`` 0066 * 0067 * @since org.kde.kirigami 2.6 0068 */ 0069 property bool expandible: false 0070 0071 /** 0072 * @brief This property holds the parent action. 0073 */ 0074 property QQC2.Action parent 0075 0076 /** 0077 * @brief This property sets this action's display type. 0078 * 0079 * These are provided to implementations to indicate a preference for certain display 0080 * styles. 0081 * 0082 * default: ``Kirigami.DisplayHint.NoPreference`` 0083 * 0084 * @note This property contains only preferences, implementations may choose to disregard them. 0085 * @see DisplayHint 0086 * @since org.kde.kirigami 2.12 0087 * @property Kirigami.DisplayHint displayHint 0088 */ 0089 property int displayHint: Kirigami.DisplayHint.NoPreference 0090 0091 /** 0092 * @brief This is a helper function to check if a certain display hint has been set. 0093 * 0094 * This function is mostly convenience to enforce the mutual exclusivity of KeepVisible and AlwaysHide. 0095 * 0096 * @param hint The display hint to check if it is set. 0097 * @return @c true if the hint was set for this action, @c false if not. 0098 * @deprecated Since 2.14, Use DisplayHint.displayHintSet(action, hint) instead. 0099 * @since org.kde.kirigami 2.12 0100 */ 0101 function displayHintSet(hint) { 0102 print("Action::displayHintSet is deprecated, use Kirigami.DisplayHint.displayHintSet(action, hint)") 0103 return Kirigami.DisplayHint.displayHintSet(root, hint); 0104 } 0105 0106 /** 0107 * @brief This property holds the component that should be used for displaying this action. 0108 * @note This can be used to display custom components in the toolbar. 0109 * @since KDE Frameworks 5.65 0110 * @since org.kde.kirigami 2.12 0111 */ 0112 property Component displayComponent: null 0113 0114 /** 0115 * @brief This property holds a list of child actions. 0116 * 0117 * This is useful for tree-like menus, such as the GlobalDrawer. 0118 * 0119 * Example usage: 0120 * @code{.qml} 0121 * Action { 0122 * text: "Tools" 0123 * Action { 0124 * text: "Action1" 0125 * } 0126 * Action { 0127 * text: "Action2" 0128 * } 0129 * } 0130 * @endcode 0131 * @property list<Action> children 0132 */ 0133 default property list<QtObject> children 0134 //END properties 0135 0136 onChildrenChanged: { 0137 let child; 0138 for (const i in children) { 0139 child = children[i]; 0140 if (child.hasOwnProperty("parent")) { 0141 child.parent = root 0142 } 0143 } 0144 } 0145 0146 /** 0147 * @brief This property holds the action's visible child actions. 0148 * @property list<Action> visibleChildren 0149 */ 0150 readonly property var visibleChildren: { 0151 const visible = []; 0152 for (const i in children) { 0153 const child = children[i]; 0154 if (!child.hasOwnProperty("visible") || child.visible) { 0155 visible.push(child); 0156 } 0157 } 0158 return visible; 0159 } 0160 /** 0161 * @brief Hints for implementations using Actions indicating preferences about how to display the action. 0162 * @deprecated Since 2.14, use Kirigami.DisplayHint instead. 0163 */ 0164 enum DisplayHint { 0165 NoPreference = 0, 0166 IconOnly = 1, 0167 KeepVisible = 2, 0168 AlwaysHide = 4, 0169 HideChildIndicator = 8 0170 } 0171 }