Warning, /plasma/discover/discover/qml/ApplicationResourceButton.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2022 Nate Graham <nate@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.15 0008 import QtQuick.Layouts 1.15 0009 import QtQuick.Controls 2.15 as QQC2 0010 0011 import org.kde.kirigami 2.19 as Kirigami 0012 0013 QQC2.Button { 0014 id: root 0015 0016 required property string buttonIcon 0017 required property string title 0018 required property string subtitle 0019 property string tooltipText 0020 readonly property int implicitMinWidth: leftPadding + 0021 layout.spacing + 0022 text.width + 0023 layout.spacing + 0024 icon.Layout.preferredWidth + 0025 layout.spacing + 0026 rightPadding 0027 0028 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, 0029 implicitContentWidth + leftPadding + rightPadding) 0030 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, 0031 implicitContentHeight + topPadding + bottomPadding) 0032 0033 leftPadding: Kirigami.Units.largeSpacing 0034 rightPadding: Kirigami.Units.largeSpacing 0035 topPadding: Kirigami.Units.largeSpacing 0036 bottomPadding: Kirigami.Units.largeSpacing 0037 0038 TextMetrics { 0039 id: text 0040 text: root.title 0041 } 0042 0043 contentItem: ColumnLayout { 0044 spacing: 0 0045 RowLayout { 0046 id: layout 0047 spacing: Kirigami.Units.smallSpacing 0048 Layout.minimumHeight: Kirigami.Units.gridUnit * 2 + spacing 0049 0050 // Icon 0051 Kirigami.Icon { 0052 id: icon 0053 Layout.preferredWidth: Kirigami.Units.iconSizes.medium 0054 Layout.preferredHeight: Kirigami.Units.iconSizes.medium 0055 Layout.alignment: Qt.AlignVCenter 0056 source: root.buttonIcon 0057 } 0058 0059 // Title 0060 Kirigami.Heading { 0061 Layout.fillWidth: true 0062 level: 4 0063 text: root.title 0064 verticalAlignment: Text.AlignVCenter 0065 maximumLineCount: 2 0066 elide: Text.ElideRight 0067 wrapMode: Text.Wrap 0068 } 0069 } 0070 0071 // Subtitle 0072 QQC2.Label { 0073 Layout.fillWidth: true 0074 Layout.fillHeight: true 0075 visible: root.subtitle 0076 text: root.subtitle 0077 elide: Text.ElideRight 0078 wrapMode: Text.Wrap 0079 opacity: 0.6 0080 verticalAlignment: Text.AlignTop 0081 } 0082 } 0083 QQC2.ToolTip { 0084 text: root.tooltipText ? root.tooltipText : "" 0085 } 0086 }