blob: 684cc709b497185f9e1b3058b0d8b49a0109bae8 (
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
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
|
import QtQuick 2.0
import QtWebKit 3.0
Item {
property var test
property var preferredMinimumContentsWidth
function formatScale(value) {
return "<b>" + parseFloat(value.toFixed(4)) + "</b>x";
}
function formatSize(value) {
return "<b>" + value.width.toFixed() + "x" + value.height.toFixed() + "</b>px"
}
function formatBool(value) {
return "<b>" + (value ? "yes" : "no") + "</b>"
}
Rectangle {
id: title;
anchors {
top: parent.top
left: parent.left
margins: 10
}
height: 50
width: 250
color: "blue"
Text {
id: viewportInfoLabel
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: 10
}
text: "Viewport Info"
color: "white"
font.family: "Nokia Pure"
font.pointSize: 24
}
}
Rectangle {
color: "gray"
opacity: 0.9
anchors {
top: title.bottom
left: title.left
topMargin: 10
}
width: 340
height: 270
Item {
id: textBox
anchors {
fill: parent
margins: 10
}
property string fontFamily: "Nokia Pure"
property color fontColor: "black"
Column {
anchors.fill: parent
spacing: 20
Column {
Text {
text: "Current scale: " + formatScale(test.contentsScale)
font.family: textBox.fontFamily
color: textBox.fontColor
}
}
Column {
Text {
text: "Minimum scale: " + formatScale(test.viewport.minimumScale)
font.family: textBox.fontFamily
color: textBox.fontColor
}
Text {
text: "Maximum scale: " + formatScale(test.viewport.maximumScale)
font.family: textBox.fontFamily
color: textBox.fontColor
}
}
Column {
Text {
text: "Device pixel ratio: " + formatScale(test.devicePixelRatio)
font.family: textBox.fontFamily
color: textBox.fontColor
}
Text {
text: "Contents size: " + formatSize(test.contentsSize)
font.family: textBox.fontFamily
color: textBox.fontColor
}
Text {
text: "Viewport layout size: " + formatSize(test.viewport.layoutSize)
font.family: textBox.fontFamily
color: textBox.fontColor
}
}
Column {
Text {
text: "Adapt for small screens: " + formatBool(preferredMinimumContentsWidth)
font.family: textBox.fontFamily
color: textBox.fontColor
}
Text {
text: "Allows scaling: " + formatBool(test.viewport.isScalable)
font.family: textBox.fontFamily
color: textBox.fontColor
}
}
}
}
}
}
|