blob: 29dcb7832ddae31b46777057abef347b08ec9ea5 (
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
|
import com.navit.graphics_qt5 1.0
import QtQuick 2.2
import QtQuick.Window 2.0
Window {
width: 200; height: 200
Item {
id: root
anchors.fill: parent
Loader {
width: root.width
height: root.height
anchors.centerIn: parent
Screen.onOrientationChanged: {
rotation = Screen.angleBetween(Screen.orientation , Screen.primaryOrientation)
switch(Screen.angleBetween(Screen.orientation , Screen.primaryOrientation))
{
case 0:
case 180:
width = root.width
height = root.height
break
case 90:
case 270:
width = root.height
height = root.width
break
}
}
id: navit_loader
focus: true
source: "graphics_qt5.qml"
objectName: "navit_loader"
}
Component.onCompleted: {
// orientation update mask is defined since QML 5.4 So make this compatible to 5.2
// by just calling this if available
if(Screen.hasOwnProperty('orientationUpdateMask')) {
Screen.orientationUpdateMask = Qt.PortraitOrientation + Qt.LandscapeOrientation + Qt.InvertedPortraitOrientation + Qt.InvertedLandscapeOrientation;
}
}
}
}
|