summaryrefslogtreecommitdiff
path: root/navit/gui/qt5_qml/skins/modern/main.qml
blob: 2d05cb1b2007f55fdb51237d1c8655d362e30e72 (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
78
79
80
81
82
83
84
85
86
87
88
import com.navit.graphics_qt5 1.0
import QtQuick 2.2
import QtQuick.VirtualKeyboard 2.1

Rectangle {
	width: 800
	height: 480

	Connections {
		target: backend
		onHideMenu: {
			hideMainMenu()
		}
		onDisplayMenu: {
			mainMenu.submenu = source
			mainMenu.state = 'visible'
			console.log("showing menu with submenu " + mainMenu.submenu)
			mainMenu.source = '' // Needed when switching submenus from the code to refresh the menu
			mainMenu.source = "menu.qml"
		}
	}

	function hideMainMenu(){
		mainMenu.source = ''
		mainMenu.state = 'default'
	}

	color: "black"
	id: container

	QNavitQuick {
		id: navit1
		width: parent.width
		height: parent.height
		// focus: true
		opacity: 0;
		Component.onCompleted: {
			console.log(width + "x" + height)
			navit1.setGraphicContext(graphics_qt5_context);
			navit1.opacity = 1;
		}
		Behavior on opacity {
			NumberAnimation {
				id: opacityAnimation;duration: 1000;alwaysRunToEnd: true
			}
		}
	}

	Loader {
		id: mainMenu
		width: parent.width
		height: parent.height
		x: parent.width
		opacity: 0
		property string submenu

		states: [
			State {
				name: "visible"
				PropertyChanges {
					target: mainMenu
					x: 0
					opacity: 1
				}
			}
		]
		transitions: [
			Transition {
				NumberAnimation {
					properties: "x,y,opacity";duration: 200
				}
				onRunningChanged: {
					if ((mainMenu.opacity == 0) && (!running)){
						backend.resize(navit1.width, navit1.height);
						console.log("transition done, hiding menu window size " + navit1.width + " x " + navit1.height)
					}
				}
			}
		]
	}
        // currently requires export QT_IM_MODULE=qtvirtualkeyboard
        InputPanel {
            id: inputPanel
            y: Qt.inputMethod.visible ? parent.height - inputPanel.height : parent.height
            anchors.left: parent.left
            anchors.right: parent.right
        }
}