summaryrefslogtreecommitdiff
path: root/navit/gui/qt5_qml/skins/MainButton.qml
blob: e189ad9a2a228df87d8c81d21f49f19a7f69e682 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import QtQuick 2.2
import QtQuick.Layouts 1.0

Rectangle {
    id: container

    signal clicked
    property string text: "Button"
    property string icon: "icons/appbar.home.variant.svg"

    smooth: true;
    width: 200;
    height: 80
    color: "#35322f"
    radius: 2
    border.width: 1

    MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() }

    Text {
        id: txtItem;
        color: "#ffffff"
        text: container.text
        font.pointSize: 18
        anchors.left: rectangle.right
        anchors.leftMargin: 8
        anchors.verticalCenter: parent.verticalCenter
        z: 1
    }

    Rectangle {
        id: rectangle
        width: container.height
        height: container.height
        color: "#35322f"
        radius: 2
        border.width: 1
        anchors.verticalCenter: parent.verticalCenter

        Image {
            id: imgItem;
            width: parent.width;
            height: parent.height;
            source: container.icon
            smooth: true
            scale: 1
            anchors.verticalCenter: parent.verticalCenter
            anchors.left: parent.left
//            anchors.leftMargin: 8
            sourceSize.width: parent.width
            sourceSize.height: parent.height
        }
    }

    states: [
        State {
            name: "Pressed"; when: mr.pressed == true
            PropertyChanges {
                target: txtItem;
                opacity: 0.6;
                color: "#84ca43";
            }
        }
    ]

    transitions: Transition {
        NumberAnimation { properties: "scale"; easing.type: "OutExpo"; duration: 200 }
    }

}