summaryrefslogtreecommitdiff
path: root/src/components/qt_hmi/References/Work/bananasnacks/qml/Bananas/Components/CheckButton.qml
blob: 713d00d1b33fefa68cb4f2ca3dec6d2583e441ff (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 QtQuick 2.0

Rectangle {
    signal press
    property alias text: clickable.text

    states: [
      State {
        name: 'pressed'
      }
    ]
    id: container
    border.color: "#333"
    border.width: 1
    height: 45
    width: 150
    radius: 3
    gradient: Gradient {
        GradientStop {
            position: 0.0
            color: (state === 'pressed' || clickable.pressed) ?  "#3C1414" : Qt.rgba(0.18, 0.18, 0.18, 1)
        }
        GradientStop {
            position: 1.0
            color: (state === 'pressed' || clickable.pressed) ? "#9C3335" : "black"
        }
    }
    Clickable {
        anchors.fill: parent
        id: clickable
        onPress: { container.press(); container.state = (container.state === '') ? 'pressed' : '' }

        textAnchors.horizontalCenter: horizontalCenter
        textAnchors.verticalCenter: verticalCenter
    }
}