Warning, /plasma/latte-dock/shell/package/contents/configuration/canvas/controls/Button.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2019 Michail Vourlakos <mvourlakos@gmail.com>
0003 SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005
0006 import QtQuick 2.7
0007 import QtQuick.Layouts 1.1
0008
0009 import org.kde.plasma.core 2.0 as PlasmaCore
0010 import org.kde.plasma.components 2.0 as PlasmaComponents
0011
0012 Item{
0013 id: button
0014 width: visibleButton.width
0015 height: visibleButton.height
0016
0017 signal pressedChanged(bool pressed);
0018
0019 property bool checked: false
0020
0021 property bool iconPositionReversed: false
0022 property string text: "Default Text"
0023 property string tooltip: ""
0024
0025 readonly property bool containsMouse: tooltipBtn.hovered
0026 readonly property int implicitHeight: visibleButton.height
0027
0028 readonly property color appliedTextColor: checked ? checkedTextColor : textColor
0029 readonly property color appliedBackgroundColor: checked ? checkedBackgroundColor : backgroundColor
0030 readonly property color appliedBorderColor: checked ? checkedBorderColor : borderColor
0031
0032 readonly property color textColor: containsMouse ? latteView.colorizer.buttonTextColor : settingsRoot.textColor
0033 readonly property color backgroundColor: containsMouse ? hoveredBackground : normalBackground
0034 readonly property color borderColor: containsMouse ? hoveredBorder : normalBorder// "transparent"
0035
0036 readonly property color checkedTextColor: latteView.colorizer.buttonTextColor
0037 readonly property color checkedBackgroundColor: latteView.colorizer.buttonFocusColor
0038 readonly property color checkedBorderColor: hoveredBorder //"transparent" //checkedTextColor
0039
0040 readonly property color normalBackground: Qt.rgba(latteView.colorizer.buttonHoverColor.r,
0041 latteView.colorizer.buttonHoverColor.g,
0042 latteView.colorizer.buttonHoverColor.b,
0043 0.04)
0044
0045 readonly property color hoveredBackground: Qt.rgba(latteView.colorizer.buttonHoverColor.r,
0046 latteView.colorizer.buttonHoverColor.g,
0047 latteView.colorizer.buttonHoverColor.b,
0048 0.7)
0049
0050 readonly property color normalBorder: Qt.rgba(settingsRoot.textColor.r,
0051 settingsRoot.textColor.g,
0052 settingsRoot.textColor.b,
0053 0.7)
0054
0055 readonly property color hoveredBorder: "#222222"
0056
0057 property Component icon
0058
0059 Item{
0060 id: visibleButtonRoot
0061 width: visibleButton.width
0062 height: visibleButton.height
0063
0064 Rectangle {
0065 id: visibleButton
0066 width: buttonRow.width + 4 * margin
0067 height: buttonRow.height + 2 * margin
0068 radius: 2
0069 color: appliedBackgroundColor
0070 border.width: 1
0071 border.color: appliedBorderColor
0072
0073 readonly property int margin: units.smallSpacing
0074
0075 RowLayout{
0076 id: buttonRow
0077 anchors.centerIn: parent
0078 spacing: units.smallSpacing
0079 layoutDirection: iconPositionReversed ? Qt.RightToLeft : Qt.LeftToRight
0080
0081 Loader {
0082 width: height
0083 height: textLbl.implicitHeight
0084 active: button.icon
0085 sourceComponent: button.icon
0086 visible: active
0087
0088 readonly property color iconColor: button.appliedTextColor
0089 }
0090
0091 PlasmaComponents.Label{
0092 id: textLbl
0093 text: button.text
0094 color: button.appliedTextColor
0095 }
0096 }
0097 }
0098 }
0099
0100 PlasmaComponents.Button {
0101 id: tooltipBtn
0102 anchors.fill: visibleButtonRoot
0103 opacity: 0
0104 tooltip: button.tooltip
0105
0106 onPressedChanged: button.pressedChanged(pressed)
0107 }
0108 }