Warning, /plasma/plasma-mobile/look-and-feel/contents/logout/ActionButton.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *   SPDX-FileCopyrightText: 2016 David Edmundson <davidedmundson@kde.org>
0003  *   SPDX-FileCopyrightText: 2022 Seshan Ravikumar <seshan10@me.com>
0004  *
0005  *   SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 import QtQuick 2.8
0009 
0010 import org.kde.plasma.core 2.0 as PlasmaCore
0011 import org.kde.plasma.components 3.0 as PlasmaComponents3
0012 
0013 Item {
0014     id: root
0015     property alias text: label.text
0016     property alias iconSource: icon.source
0017     property alias containsMouse: mouseArea.containsMouse
0018     property alias font: label.font
0019     property alias labelRendering: label.renderType
0020     property alias circleOpacity: buttonRect.opacity
0021     property alias circleVisiblity: buttonRect.visible
0022     readonly property bool softwareRendering: GraphicsInfo.api === GraphicsInfo.Software
0023 
0024     signal clicked
0025 
0026     activeFocusOnTab: true
0027 
0028     property int iconSize: PlasmaCore.Units.gridUnit
0029 
0030     implicitWidth: PlasmaCore.Units.gridUnit * 14
0031     implicitHeight: iconSize + PlasmaCore.Units.smallSpacing + label.implicitHeight
0032 
0033     Rectangle {
0034         id: buttonRect
0035         width: root.width
0036         height: iconSize * 2.2
0037         radius: PlasmaCore.Units.smallSpacing
0038         color: PlasmaCore.ColorScope.backgroundColor
0039         opacity: mouseArea.containsPress ? 1 : 0.6
0040         border {
0041             color: Qt.rgba(255, 255, 255, 0.8)
0042             width: 1
0043         }
0044     }
0045 
0046     PlasmaCore.IconItem {
0047         id: icon
0048         anchors {
0049             verticalCenter: buttonRect.verticalCenter
0050             left: buttonRect.left
0051             leftMargin: PlasmaCore.Units.mediumSpacing
0052         }
0053         width: iconSize
0054         height: iconSize
0055 
0056         colorGroup: PlasmaCore.ColorScope.colorGroup
0057     }
0058 
0059     PlasmaComponents3.Label {
0060         id: label
0061         font.pointSize: PlasmaCore.Theme.defaultFont.pointSize + 1
0062         anchors {
0063             centerIn: buttonRect
0064         }
0065         style: softwareRendering ? Text.Outline : Text.Normal
0066         styleColor: softwareRendering ? PlasmaCore.ColorScope.backgroundColor : "transparent" //no outline, doesn't matter
0067         horizontalAlignment: Text.AlignHCenter
0068         verticalAlignment: Text.AlignTop
0069         wrapMode: Text.WordWrap
0070         font.underline: root.activeFocus
0071     }
0072 
0073     MouseArea {
0074         id: mouseArea
0075         hoverEnabled: true
0076         onClicked: root.clicked()
0077         anchors.fill: parent
0078     }
0079 
0080     Keys.onEnterPressed: clicked()
0081     Keys.onReturnPressed: clicked()
0082     Keys.onSpacePressed: clicked()
0083 
0084     Accessible.onPressAction: clicked()
0085     Accessible.role: Accessible.Button
0086     Accessible.name: label.text
0087 }