merge github
[apps/navigation.git] / app / BtnMapDirection.qml
1 import QtQuick 2.0\r
2 import QtQuick.Controls 1.5\r
3 \r
4 Item {\r
5     Button {\r
6                 id: btn_map_direction\r
7                 width: 100\r
8                 height: 100\r
9 \r
10                 function settleState() {\r
11             if(root.st_heading_up){\r
12                 btn_map_direction.state = "NorthUp"\r
13                 car_position_mapitem.state = "NorthUp"\r
14                 root.st_heading_up = false\r
15                         } else {\r
16                 btn_map_direction.state = "HeadingUp"\r
17                 car_position_mapitem.state = "HeadingUp"\r
18                 root.st_heading_up = true\r
19                         }\r
20             map.rotateMapSmooth()\r
21         }\r
22 \r
23                 onClicked: { settleState() }\r
24 \r
25                 Image {\r
26                         id: image\r
27                         width: 92\r
28                         height: 92\r
29                         anchors.verticalCenter: parent.verticalCenter\r
30                         anchors.horizontalCenter: parent.horizontalCenter\r
31             source: "images/202px-Compass-icon_bb_N.svg.png"\r
32                 }\r
33 \r
34                 states: [\r
35                         State {\r
36                                 name: "HeadingUp"\r
37                 PropertyChanges { target: image; source: "images/240px-Compass_icon_NE.svg.png" }\r
38                         },\r
39                         State {\r
40                                 name: "NorthUp"\r
41                 PropertyChanges { target: image; source: "images/202px-Compass-icon_bb_N.svg.png" }\r
42             }\r
43                 ]\r
44     }\r
45 }\r