-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.qml
149 lines (125 loc) · 4.74 KB
/
main.qml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.2
import QtQuick.Controls.Styles 1.4
import QtQuick.Window 2.2
import "qrc:/Dashboard"
import "qrc:/Components"
ApplicationWindow {
id:root
visible: true
visibility: "FullScreen"
width: 375
height: 667
title: qsTr("qeeptrack")
Item {
id: screen
width: root.width
height: root.height
property var mode: 4
property bool portrait: (root.width<=root.height)
property bool landscape: (root.width>root.height)
property double widthscale: (landscape)? root.width/667: root.width/375
property double heightscale: (portrait)? root.height/667: root.height/375
property double scale: (widthscale>heightscale)? heightscale: widthscale
property double pointSize: 18
property int shortside: landscape? root.height: root.width
property int longside: portrait? root.height: root.width
property double buttonwidth: shortside/10
property string optionitembordercolor: "grey"
property string optiontextcolor: "black"
property string optionradiobuttontickedimage: "qrc:/Components/ticked.png"
property string optionradiobuttonuntickedimage: "qrc:/Components/unticked.png"
property string optionlistcolor: "white"
property string optionlistimage: "qrc:/Components/options-bg.png"
property string optionpagecolor: "white"
property string optionpagecancelimage: "qrc:/Gauges/backc.png"
property string optionpageconfirmimage: "qrc:/Gauges/confirmc.png"
property string optionmenuitemimage: "qrc:/Components/forward.png"
function layout() {
var small = portrait? root.width: root.height
var big = portrait? root.height: root.width
var divider = big/small
if (divider >= 21/9) // 2.333
screen.mode = 5
else if (divider >= 16/9) // 1.777
screen.mode = 4
else if (divider >= 16/10) // 1.6
screen.mode = 3
else if (divider >= 3/2) // 1.333
screen.mode = 2
else if (divider >= 4/3) // 1.5
screen.mode = 1
else
screen.mode = 0
console.log("main.screen.layout() divider:",screen.mode,big,small,divider)
//qml: main.screen.layout() divider: 4 667 375 1.7786666666666666
}
}
MapView {
id: mapview
stack: pagestack
onQuit: close()
}
PageStack {
id: pagestack
anchors.fill: parent
animate: true
}
Item {
id: activePalette
property var light: "#444444"
property var dark: "#222222"
//property var highlight: ""
//property var highlightedText: ""
//property var mid: ""
//property var midlight: ""
//property var shadow: ""
//property var text: ""
//property var window: ""
//property var windowText: ""
}
onWidthChanged: screen.layout()
onHeightChanged: screen.layout()
Component.onCompleted: {
screen.layout()
//pagestack.push(dashboard)
pagestack.push(mapview)
console.log("Screen.width: ", Screen.width)
console.log("Screen.height: ", Screen.height)
console.log("Screen.pixelDensity: ", Screen.pixelDensity)
console.log("Screen.logicalPixelDensity: ", Screen.logicalPixelDensity)
console.log("Screen.devicePixelRatio: ", Screen.devicePixelRatio)
console.log("screen.width:", screen.width)
console.log("screen.height:", screen.height)
console.log("screen.portrait:", screen.portrait)
console.log("screen.mode:", screen.mode)
/*
iPad 3:
qml: Screen.width: 768
qml: Screen.height: 1024
qml: Screen.pixelDensity: 5.196850393700786
qml: Screen.logicalPixelDensity: 2.834645669291339
qml: Screen.devicePixelRatio: 2
iPhone 6s:
qml: Screen.width: 375
qml: Screen.height: 667
qml: Screen.pixelDensity: 6.41732283464567
qml: Screen.logicalPixelDensity: 2.834645669291339
qml: Screen.devicePixelRatio: 2
Macbook Retina:
qml: Screen.width: 1440
qml: Screen.height: 900
qml: Screen.pixelDensity: 4.350393766123761
qml: Screen.logicalPixelDensity: 2.834645669291339
qml: Screen.devicePixelRatio: 2
Hp EliteBook:
qml: Screen.width: 1600
qml: Screen.height: 900
qml: Screen.pixelDensity: 2.833534055934698
qml: Screen.logicalPixelDensity: 3.7795275590551185
qml: Screen.devicePixelRatio: 1
*/
}
}