-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResolutionFix.qml
More file actions
48 lines (43 loc) · 1.17 KB
/
Copy pathResolutionFix.qml
File metadata and controls
48 lines (43 loc) · 1.17 KB
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
import QtQuick 2.5
import QtQuick.Window 2.0
import Material 0.1
pragma Singleton
Item {
id: resolutionFix
property var devices: [
{
name:"galaxyS3Mini",
width : 480,
height : 800,
pixelDensityRnd : 6.31,
logicalPixelDensityRnd : 4.25,
multiplier: 1.4
},
{
name: "sonyXperiaJ",
width : 480,
height : 854,
pixelDensityRnd : 6.32,
logicalPixelDensityRnd : 4.25,
multiplier : 1.4
}
]
function fixDensity() {
for (var i=0;i<devices.length;i++) {
if (recognizeDevice(devices[i])) return
}
}
function recognizeDevice(device) {
var isDevice =
Screen.width == device.width &&
Screen.height == device.height &&
Screen.pixelDensity.toFixed(2) == device.pixelDensityRnd &&
Screen.logicalPixelDensity.toFixed(2) == device.logicalPixelDensityRnd
if (isDevice) {
Units.multiplier = device.multiplier
return true
} else {
return false
}
}
}