Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
40d3d6fd
Unverified
Commit
40d3d6fd
authored
Jul 05, 2018
by
Gus Grubba
Committed by
GitHub
Jul 05, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6678 from mavlink/customPixelRatio
Allow plugin to override pixel ratio and density
parents
4536b1d7
d8fed905
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
ScreenTools.qml
src/QmlControls/ScreenTools.qml
+16
-6
QGCOptions.h
src/api/QGCOptions.h
+8
-0
No files found.
src/QmlControls/ScreenTools.qml
View file @
40d3d6fd
...
...
@@ -53,12 +53,15 @@ Item {
readonly
property
real
mediumFontPointRatio
:
1.25
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
:
Screen
.
devicePixelRatio
property
bool
isAndroid
:
ScreenToolsController
.
isAndroid
property
bool
isiOS
:
ScreenToolsController
.
isiOS
property
bool
isMobile
:
ScreenToolsController
.
isMobile
property
bool
isWindows
:
ScreenToolsController
.
isWindows
property
bool
isDebug
:
ScreenToolsController
.
isDebug
property
bool
isTinyScreen
:
(
Screen
.
width
/
Screen
.
p
ixelDensity
)
<
120
// 120mm
property
bool
isTinyScreen
:
(
Screen
.
width
/
realP
ixelDensity
)
<
120
// 120mm
property
bool
isShortScreen
:
ScreenToolsController
.
isMobile
&&
((
Screen
.
height
/
Screen
.
width
)
<
0.6
)
// Nexus 7 for example
property
bool
isHugeScreen
:
Screen
.
width
>=
1920
*
2
...
...
@@ -91,6 +94,14 @@ Item {
}
}
onRealPixelDensityChanged
:
{
_setBasePointSize
(
defaultFontPointSize
)
}
onRealPixelRatioChanged
:
{
_setBasePointSize
(
defaultFontPointSize
)
}
function
printScreenStats
()
{
console
.
log
(
'
ScreenTools: Screen.width:
'
+
Screen
.
width
+
'
Screen.height:
'
+
Screen
.
height
+
'
Screen.pixelDensity:
'
+
Screen
.
pixelDensity
)
}
...
...
@@ -114,14 +125,13 @@ Item {
smallFontPointSize
=
defaultFontPointSize
*
_screenTools
.
smallFontPointRatio
mediumFontPointSize
=
defaultFontPointSize
*
_screenTools
.
mediumFontPointRatio
largeFontPointSize
=
defaultFontPointSize
*
_screenTools
.
largeFontPointRatio
minTouchPixels
=
Math
.
round
(
minTouchMillimeters
*
Screen
.
pixelDensity
)
minTouchPixels
=
Math
.
round
(
minTouchMillimeters
*
realPixelDensity
*
realPixelRatio
)
if
(
minTouchPixels
/
Screen
.
height
>
0.15
)
{
// If using physical sizing takes up too much o
f
the vertical real estate fall back to font based sizing
// If using physical sizing takes up too much o
f
the vertical real estate fall back to font based sizing
minTouchPixels
=
defaultFontPixelHeight
*
3
}
//console.log(minTouchPixels / Screen.height)
toolbarHeight
=
isMobile
?
minTouchPixels
:
defaultFontPixelHeight
*
3
toolbarHeight
=
toolbarHeight
*
QGroundControl
.
corePlugin
.
options
.
toolbarHeightMultiplier
}
Text
{
...
...
@@ -151,7 +161,7 @@ Item {
}
else
{
baseSize
=
14
;
}
}
else
if
((
Screen
.
width
/
Screen
.
p
ixelDensity
)
<
120
)
{
}
else
if
((
Screen
.
width
/
realP
ixelDensity
)
<
120
)
{
baseSize
=
11
;
// Other Android
}
else
{
...
...
src/api/QGCOptions.h
View file @
40d3d6fd
...
...
@@ -50,6 +50,8 @@ public:
Q_PROPERTY
(
bool
showMissionAbsoluteAltitude
READ
showMissionAbsoluteAltitude
NOTIFY
showMissionAbsoluteAltitudeChanged
)
Q_PROPERTY
(
bool
showSimpleMissionStart
READ
showSimpleMissionStart
NOTIFY
showSimpleMissionStartChanged
)
Q_PROPERTY
(
bool
disableVehicleConnection
READ
disableVehicleConnection
CONSTANT
)
Q_PROPERTY
(
float
devicePixelRatio
READ
devicePixelRatio
NOTIFY
devicePixelRatioChanged
)
Q_PROPERTY
(
float
devicePixelDensity
READ
devicePixelDensity
NOTIFY
devicePixelDensityChanged
)
/// Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)?
/// @return true if QGC should consolidate both menus into one.
...
...
@@ -104,6 +106,10 @@ public:
/// the Advanced options.
virtual
QString
firmwareUpgradeSingleURL
()
const
{
return
QString
();
}
/// Device specific pixel ratio/density (for when Qt doesn't properly read it from the hardware)
virtual
float
devicePixelRatio
()
const
{
return
0
.
0
f
;
}
virtual
float
devicePixelDensity
()
const
{
return
0
.
0
f
;
}
signals:
void
showSensorCalibrationCompassChanged
(
bool
show
);
void
showSensorCalibrationGyroChanged
(
bool
show
);
...
...
@@ -119,6 +125,8 @@ signals:
void
showOfflineMapImportChanged
();
void
showMissionAbsoluteAltitudeChanged
();
void
showSimpleMissionStartChanged
();
void
devicePixelRatioChanged
();
void
devicePixelDensityChanged
();
private:
CustomInstrumentWidget
*
_defaultInstrumentWidget
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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