Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
80547955
Commit
80547955
authored
Aug 08, 2018
by
Gus Grubba
Browse files
Deal with unreliable Device Pixel Ratio on mobile platforms.
parent
bac7281f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/QmlControls/ScreenTools.qml
View file @
80547955
...
...
@@ -54,7 +54,20 @@ Item {
readonly
property
real
largeFontPointRatio
:
1.5
property
real
realPixelDensity
:
QGroundControl
.
corePlugin
.
options
.
devicePixelDensity
!=
0
?
QGroundControl
.
corePlugin
.
options
.
devicePixelDensity
:
Screen
.
pixelDensity
property
real
realPixelRatio
:
QGroundControl
.
corePlugin
.
options
.
devicePixelRatio
!=
0
?
QGroundControl
.
corePlugin
.
options
.
devicePixelRatio
:
(
isMobile
?
1
:
Screen
.
devicePixelRatio
)
property
real
realPixelRatio
:
{
//-- If a plugin defines it, just use what it tells us
if
(
QGroundControl
.
corePlugin
.
options
.
devicePixelRatio
!=
0
)
return
QGroundControl
.
corePlugin
.
options
.
devicePixelRatio
//-- Mobile is rather unreliable. They all return 1 for Screen.devicePixelRatio.
if
(
isMobile
)
{
// Lets assume it's unlikely you have a tablet over 300mm wide
if
((
Screen
.
width
/
Screen
.
pixelDensity
*
Screen
.
devicePixelRatio
)
>
300
)
return
2
}
//-- Use whatever the system tells us
return
Screen
.
devicePixelRatio
}
property
bool
isAndroid
:
ScreenToolsController
.
isAndroid
property
bool
isiOS
:
ScreenToolsController
.
isiOS
...
...
src/ui/preferences/DebugWindow.qml
View file @
80547955
...
...
@@ -160,13 +160,13 @@ QGCView {
font.family
:
ScreenTools
.
normalFontFamily
}
Text
{
text
:
Screen
.
pixelDensity
.
toFixed
(
4
)
color
:
qgcPal
.
text
text
:
Screen
.
pixelDensity
.
toFixed
(
4
)
color
:
qgcPal
.
text
font.family
:
ScreenTools
.
normalFontFamily
}
Text
{
text
:
qsTr
(
"
Font Point Size 13.5
"
)
color
:
qgcPal
.
text
text
:
qsTr
(
"
Font Point Size 13.5
"
)
color
:
qgcPal
.
text
font.pointSize
:
13.5
font.family
:
ScreenTools
.
normalFontFamily
}
...
...
@@ -218,6 +218,38 @@ QGCView {
font.pointSize
:
15
font.family
:
ScreenTools
.
normalFontFamily
}
Text
{
text
:
qsTr
(
"
Computed Screen Height:
"
)
color
:
qgcPal
.
text
font.family
:
ScreenTools
.
normalFontFamily
}
Text
{
text
:
(
Screen
.
height
/
Screen
.
pixelDensity
*
Screen
.
devicePixelRatio
).
toFixed
(
0
)
color
:
qgcPal
.
text
font.family
:
ScreenTools
.
normalFontFamily
}
Text
{
text
:
qsTr
(
"
Font Point Size 15.5
"
)
color
:
qgcPal
.
text
font.pointSize
:
15.5
font.family
:
ScreenTools
.
normalFontFamily
}
Text
{
text
:
qsTr
(
"
Computed Screen Width:
"
)
color
:
qgcPal
.
text
font.family
:
ScreenTools
.
normalFontFamily
}
Text
{
text
:
(
Screen
.
width
/
Screen
.
pixelDensity
*
Screen
.
devicePixelRatio
).
toFixed
(
0
)
color
:
qgcPal
.
text
font.family
:
ScreenTools
.
normalFontFamily
}
Text
{
text
:
qsTr
(
"
Font Point Size 16
"
)
color
:
qgcPal
.
text
font.pointSize
:
16
font.family
:
ScreenTools
.
normalFontFamily
}
}
Rectangle
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment