aboutsummaryrefslogtreecommitdiffstats
path: root/BtnMapDirection.qml
blob: 59eb9665ffc8893598d45487768c22580820efec (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
// SPDX-License-Identifier: GPL-3.0+
// Copyright (C) 2021 AISIN CORPORATION
// Copyright (C) 2024 Automotive Grade Linux

import QtQuick
import QtQuick.Controls

Item {
    Image {
        id: image
        x: 0
        y: 3
        width: 92
        height: 92
        opacity: 1
        source: "images/02_NORTH-UP.png"
    }

    Button {
        id: btn_map_direction
        width: 100
        height: 100
        icon.source: ""
        opacity: 0
        visible: true
        clip: false
        state: "NorthUp"



        function settleState() {
            if(root.st_heading_up){
                btn_map_direction.state = "NorthUp"
                car_position_mapitem.state = "NorthUp"
                root.st_heading_up = false
            } else {
                btn_map_direction.state = "HeadingUp"
                car_position_mapitem.state = "HeadingUp"
                root.st_heading_up = true
            }
            map.rotateMapSmooth()
        }

        onClicked: { settleState() }

        states: [
            State {
                name: "HeadingUp"
                PropertyChanges { target: image; source: "images/01_HEADING-UP.png" }
            },
            State {
                name: "NorthUp"
                PropertyChanges { target: image; source: "images/02_NORTH-UP.png" }
            }
        ]
    }

}

/*##^##
Designer {
    D{i:0;autoSize:true;height:480;width:640}
}
##^##*/