Warning, /plasma/plasma-welcome/src/qml/pages/powerfulwhenneeded/PlasmaFeatureButton.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: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006
0007 import QtQuick
0008 import QtQuick.Layouts
0009 import QtQuick.Controls as QQC2
0010
0011 import org.kde.kirigami as Kirigami
0012
0013 QQC2.Button {
0014 id: root
0015
0016 required property string title
0017 required property string subtitle
0018 required property string buttonIcon
0019 readonly property int implicitTitleWidth: metrics.width
0020 readonly property int fixedSizeStuff: icon.implicitWidth + leftPadding + rightPadding + titleRowLayout.spacing
0021
0022 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
0023 implicitContentWidth + leftPadding + rightPadding)
0024 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
0025 implicitContentHeight + topPadding + bottomPadding)
0026
0027 leftPadding: Kirigami.Units.largeSpacing
0028 rightPadding: Kirigami.Units.largeSpacing
0029 topPadding: Kirigami.Units.largeSpacing
0030 bottomPadding: Kirigami.Units.largeSpacing
0031
0032 TextMetrics {
0033 id: metrics
0034 text: root.title
0035 }
0036
0037 contentItem: ColumnLayout {
0038 spacing: 0
0039
0040 RowLayout {
0041 id: titleRowLayout
0042
0043 spacing: Kirigami.Units.smallSpacing
0044 Layout.minimumHeight: Kirigami.Units.gridUnit * 2 + spacing
0045
0046 // Icon
0047 Kirigami.Icon {
0048 id: icon
0049 Layout.preferredWidth: Kirigami.Units.iconSizes.medium
0050 Layout.preferredHeight: Kirigami.Units.iconSizes.medium
0051 Layout.alignment: Qt.AlignVCenter
0052 source: root.buttonIcon
0053 }
0054 // Title
0055 Kirigami.Heading {
0056 Layout.fillWidth: true
0057 level: 4
0058 text: root.title
0059 verticalAlignment: Text.AlignVCenter
0060 maximumLineCount: 2
0061 elide: Text.ElideRight
0062 wrapMode: Text.Wrap
0063 }
0064 }
0065
0066 // Subtitle
0067 QQC2.Label {
0068 Layout.fillWidth: true
0069 Layout.fillHeight: true
0070 visible: root.subtitle
0071 text: root.subtitle
0072 elide: Text.ElideRight
0073 wrapMode: Text.Wrap
0074 opacity: 0.6
0075 verticalAlignment: Text.AlignTop
0076 }
0077 }
0078 }