aboutsummaryrefslogtreecommitdiff
path: root/components/StandardButton.qml
blob: 027356e87756bc9f0af66b96394d09a7917ceb5d (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
37
38
39
40
41
42
43
44
45
46
import QtQuick 2.0

Item {
    height: 37
    property string shadowColor
    property string pressedColor
    property string releasedColor
    property string textColor: "#FFFFFF"
    property alias text: label.text
    signal clicked()

    Rectangle {
        anchors.left: parent.left
        anchors.right: parent.right
        height: parent.height - 1
        y: buttonArea.pressed ? 1 : 0
        radius: 4
        color: parent.shadowColor
    }

    Rectangle {
        anchors.left: parent.left
        anchors.right: parent.right
        height: parent.height - 1
        y: buttonArea.pressed ? 0 : 1
        color: buttonArea.pressed ? parent.pressedColor : parent.releasedColor
        radius: 4
    }

    Text {
        id: label
        anchors.verticalCenter: parent.verticalCenter
        anchors.left: parent.left
        anchors.right: parent.right
        horizontalAlignment: Text.AlignHCenter
        elide: Text.ElideRight
        font.pixelSize: 12
        color: parent.textColor
    }

    MouseArea {
        id: buttonArea
        anchors.fill: parent
        onClicked: parent.clicked()
    }
}