summaryrefslogtreecommitdiff
path: root/SDL_Core/src/components/qt_hmi/References/Look/Widgets/TouchButton.qml
blob: c05e1ab525bc930f5e1f96af0ce103094a00041b (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
72
73
74
75
76
77
import QtQuick 2.0
import com.ford.hmiframework 1.0
import "../Widgets"

FWdgtTouchArea {
    id: button

    property string text: "Text"
    property string bitmap: ""
    property int wrapText: Text.NoWrap
    property bool indicatorState: false
    property string unpressedColor: "gray"
    property string pressEventColor: "lightGray"
    property string pressedColor: "darkGray"
    property bool vis: true


    width: 120
    height: 40
    enabled: button.vis



    Rectangle {
        id: buttonArea
        radius: 10
        anchors.centerIn: parent
        width: button.width
        height: button.height
        color: "gray"
        visible: button.vis

        BaseText {
            id: st
            anchors.centerIn: parent
            text: button.text
            wrapMode: wrapText
            visible: button.vis
        }

        FWdgtImage{
            id: img
            anchors.fill: buttonArea
            bitmap: button.bitmap
            visible: false
        }


    }

    FViewUseCaseSimple{
        condition: button.bitmap !== ""
        PropertyChanges {
            target: img; visible: true
        }
    }

    FViewUseCaseGroup{
        FViewUseCase{condition: pressed === true
            PropertyChanges {
                target: buttonArea; color: pressEventColor
            }
        }
        FViewUseCase{condition: indicatorState === true
            PropertyChanges {
                target: buttonArea; color: pressedColor
            }
        }
        FViewUseCase{condition: pressed === false
            PropertyChanges {
                target: buttonArea; color: unpressedColor
            }
        }
    }

}