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  *  SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk>
0004  *
0005  *  SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Controls as QQC2
0010 import QtQuick.Templates as T
0011 import org.kde.kirigami as Kirigami
0012 
0013 /**
0014  * @brief An item that represents an abstract Action
0015  * @inherit QtQuick.QQC2.Action
0016  */
0017 QQC2.Action {
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 tooltip text that is shown when the cursor is hovering over the control.
0031      *
0032      * Leaving this undefined or setting it to an empty string means that no tooltip will be shown when
0033      * the cursor is hovering over the control that triggers the tooltip.
0034      * @warning Tooltips may not be supported on all platforms.
0035      */
0036     property string tooltip
0037 
0038     /**
0039      * @brief This property sets whether this action is a separator action.
0040      *
0041      * default: ``false``
0042      */
0043     property bool separator: false
0044 
0045     /**
0046      * @brief This property sets whether this action  becomes a title displaying
0047      * its child actions as sub-items in GlobalDrawers and ContextDrawers.
0048      *
0049      * default: ``false``
0050      *
0051      * @since 2.6
0052      */
0053     property bool expandible: false
0054 
0055     /**
0056      * @brief This property holds the parent action.
0057      */
0058     property T.Action parent
0059 
0060     /**
0061      * @brief This property sets this action's display type.
0062      *
0063      * These are provided to implementations to indicate a preference for certain display
0064      * styles.
0065      *
0066      * default: ``Kirigami.DisplayHint.NoPreference``
0067      *
0068      * @note This property contains only preferences, implementations may choose to disregard them.
0069      * @see org::kde::kirigami::DisplayHint
0070      * @since 2.12
0071      */
0072     property int displayHint: Kirigami.DisplayHint.NoPreference
0073 
0074     /**
0075      * @brief This property holds the component that should be used for displaying this action.
0076      * @note This can be used to display custom components in the toolbar.
0077      * @since 5.65
0078      * @since 2.12
0079      */
0080     property Component displayComponent
0081 
0082     /**
0083      * @brief This property holds a list of child actions.
0084      *
0085      * This is useful for tree-like menus, such as the GlobalDrawer.
0086      *
0087      * Example usage:
0088      * @code
0089      * import QtQuick.Controls as QQC2
0090      * import org.kde.kirigami as Kirigami
0091      *
0092      * Kirigami.Action {
0093      *    text: "Tools"
0094      *
0095      *    QQC2.Action {
0096      *        text: "Action1"
0097      *    }
0098      *    Kirigami.Action {
0099      *        text: "Action2"
0100      *    }
0101      * }
0102      * @endcode
0103      * @property list<T.Action> children
0104      */
0105     default property list<T.Action> children
0106 //END properties
0107 
0108     onChildrenChanged: {
0109         children
0110             .filter(action => action instanceof Kirigami.Action)
0111             .forEach(action => {
0112                 action.parent = this;
0113             });
0114     }
0115 
0116     /**
0117      * @brief This property holds the action's visible child actions.
0118      * @property list<T.Action> visibleChildren
0119      */
0120     readonly property list<T.Action> visibleChildren: children
0121         .filter(action => !(action instanceof Kirigami.Action) || action.visible)
0122 }