summaryrefslogtreecommitdiff
path: root/modules/controlcenter/network/SimpleButton.qml
blob: 49ab2f4a6399204dbe1dfd7c41360337ebb2a38b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import qs.components
import qs.components.effects
import qs.config
import QtQuick

StyledRect {
    id: root

    property color onColor: Colours.palette.m3onSurface
    property alias disabled: stateLayer.disabled
    property alias text: label.text
    property alias enabled: stateLayer.enabled

    implicitWidth: label.implicitWidth + Appearance.padding.normal * 2
    implicitHeight: label.implicitHeight + Appearance.padding.normal * 2
    radius: Appearance.rounding.normal

    StateLayer {
        id: stateLayer
        color: parent.onColor
        function onClicked(): void {
            if (parent.enabled !== false) {
                parent.clicked();
            }
        }
    }

    StyledText {
        id: label
        anchors.centerIn: parent
        color: parent.onColor
    }

    signal clicked
}