Warning, /plasma/plasma-mobile/lookandfeel/contents/systemdialog/private/MobileSystemDialogButton.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.15 0008 import QtQuick.Controls 2.15 0009 import QtQuick.Layouts 1.15 0010 import QtQuick.Window 2.2 0011 import Qt5Compat.GraphicalEffects 0012 import org.kde.kirigami 2.18 as Kirigami 0013 0014 AbstractButton { 0015 id: root 0016 0017 property alias corners: background.corners 0018 0019 property bool verticalSeparator: false 0020 property bool horizontalSeparator: false 0021 0022 background: Kirigami.ShadowedRectangle { 0023 id: background 0024 Kirigami.Theme.colorSet: Kirigami.Theme.Button 0025 Kirigami.Theme.inherit: false 0026 color: { 0027 if (root.down) { 0028 let avg = (Kirigami.Theme.backgroundColor.r + Kirigami.Theme.backgroundColor.g + Kirigami.Theme.backgroundColor.b) / 3; 0029 // sample down 0030 avg = Math.max(0, (avg - 0.8) * 5); 0031 return Qt.darker(Kirigami.Theme.backgroundColor, 1.1 + 0.4 * (1 - avg)); 0032 } else if (hoverHandler.hovered) { 0033 return Qt.darker(Kirigami.Theme.backgroundColor, 1.05) 0034 } else { 0035 return Kirigami.Theme.backgroundColor 0036 } 0037 } 0038 0039 Kirigami.Separator { 0040 anchors.left: parent.left 0041 anchors.top: parent.top 0042 anchors.bottom: parent.bottom 0043 visible: root.verticalSeparator 0044 } 0045 Kirigami.Separator { 0046 anchors.left: parent.left 0047 anchors.right: parent.right 0048 anchors.top: parent.top 0049 visible: root.horizontalSeparator 0050 } 0051 } 0052 0053 leftPadding: Kirigami.Units.largeSpacing 0054 rightPadding: Kirigami.Units.largeSpacing 0055 topPadding: Kirigami.Units.largeSpacing 0056 bottomPadding: Kirigami.Units.largeSpacing 0057 0058 contentItem: Item { 0059 implicitHeight: row.height + Kirigami.Units.smallSpacing 0060 implicitWidth: row.implicitWidth 0061 RowLayout { 0062 id: row 0063 anchors.centerIn: parent 0064 spacing: 0 0065 0066 Kirigami.Icon { 0067 Layout.preferredHeight: label.height 0068 Layout.preferredWidth: height 0069 Layout.rightMargin: Kirigami.Units.smallSpacing 0070 visible: root.icon.name 0071 source: root.icon.name 0072 } 0073 Label { 0074 id: label 0075 text: root.text 0076 } 0077 } 0078 0079 HoverHandler { 0080 id: hoverHandler 0081 } 0082 } 0083 }