Warning, /frameworks/kirigami/src/controls/private/ContextDrawerActionItem.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2019 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 QtQuick.Layouts 0012 import org.kde.kirigami as Kirigami 0013 0014 QQC2.ItemDelegate { 0015 id: listItem 0016 0017 required property T.Action tAction 0018 0019 readonly property Kirigami.Action kAction: tAction instanceof Kirigami.Action ? tAction : null 0020 0021 readonly property bool isSeparator: kAction?.separator ?? false 0022 readonly property bool isExpandable: kAction?.expandible ?? false 0023 0024 checked: tAction.checked || (actionsMenu && actionsMenu.visible) 0025 highlighted: checked 0026 icon.name: tAction.icon.name 0027 0028 text: tAction.text ? tAction.text : tAction.tooltip 0029 hoverEnabled: (!isExpandable || root.collapsed) && !Kirigami.Settings.tabletMode && !isSeparator 0030 font.pointSize: Kirigami.Theme.defaultFont.pointSize * (isExpandable ? 1.30 : 1) 0031 0032 enabled: !isExpandable && tAction.enabled 0033 visible: kAction?.visible ?? true 0034 opacity: enabled || isExpandable ? 1.0 : 0.6 0035 0036 Accessible.onPressAction: listItem.clicked() 0037 0038 Kirigami.Separator { 0039 id: separatorAction 0040 0041 visible: listItem.isSeparator 0042 Layout.fillWidth: true 0043 } 0044 0045 ActionsMenu { 0046 id: actionsMenu 0047 y: Kirigami.Settings.isMobile ? -height : listItem.height 0048 actions: kAction?.children ?? [] 0049 submenuComponent: ActionsMenu {} 0050 } 0051 0052 Loader { 0053 Layout.fillWidth: true 0054 Layout.fillHeight: true 0055 sourceComponent: kAction?.displayComponent ?? null 0056 onStatusChanged: { 0057 for (const child of parent.children) { 0058 if (child === this) { 0059 child.visible = status === Loader.Ready; 0060 break; 0061 } else { 0062 child.visible = status !== Loader.Ready; 0063 } 0064 } 0065 } 0066 Component.onCompleted: statusChanged() 0067 } 0068 0069 onPressed: { 0070 if (kAction && kAction.children.length > 0) { 0071 actionsMenu.open(); 0072 } 0073 } 0074 onClicked: { 0075 if (!kAction || kAction.children.length === 0) { 0076 root.drawerOpen = false; 0077 } 0078 0079 tAction?.trigger(); 0080 } 0081 }