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
f19c3cfc
Commit
f19c3cfc
authored
Sep 12, 2015
by
Don Gagne
Browse files
Merge pull request #1869 from DonLakeFlyer/TestHighDPI
Add --test-high-dpi command line option
parents
cd2d960a
ae7becb5
Changes
5
Show whitespace changes
Inline
Side-by-side
src/QGCApplication.cc
View file @
f19c3cfc
...
...
@@ -154,6 +154,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
,
_styleIsDark
(
true
)
,
_fakeMobile
(
false
)
,
_useNewMissionEditor
(
false
)
#ifdef QT_DEBUG
,
_testHighDPI
(
false
)
#endif
{
Q_ASSERT
(
_app
==
NULL
);
_app
=
this
;
...
...
@@ -172,6 +175,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
{
"--clear-settings"
,
&
fClearSettingsOptions
,
QString
()
},
{
"--full-logging"
,
&
fullLogging
,
QString
()
},
{
"--fake-mobile"
,
&
_fakeMobile
,
QString
()
},
#ifdef QT_DEBUG
{
"--test-high-dpi"
,
&
_testHighDPI
,
QString
()
},
#endif
// Add additional command line option flags here
};
...
...
src/QGCApplication.h
View file @
f19c3cfc
...
...
@@ -109,6 +109,10 @@ public:
bool
useNewMissionEditor
(
void
)
{
return
_useNewMissionEditor
;
}
void
setUseNewMissionEditor
(
bool
use
);
#ifdef QT_DEBUG
bool
testHighDPI
(
void
)
{
return
_testHighDPI
;
}
#endif
public
slots
:
/// You can connect to this slot to show an information message box from a different thread.
void
informationMessageBoxOnMainThread
(
const
QString
&
title
,
const
QString
&
msg
);
...
...
@@ -180,6 +184,10 @@ private:
bool
_useNewMissionEditor
;
///< true: Use new Mission Editor
#ifdef QT_DEBUG
bool
_testHighDPI
;
///< true: double fonts sizes for simulating high dpi devices
#endif
/// Unit Test have access to creating and destroying singletons
friend
class
UnitTest
;
};
...
...
src/QmlControls/ScreenTools.qml
View file @
f19c3cfc
...
...
@@ -8,9 +8,9 @@ import QGroundControl.ScreenToolsController 1.0
Item
{
signal
repaintRequested
readonly
property
real
defaultFontPixelSize
:
_textMeasure
.
conte
ntHeight
*
ScreenToolsController
.
defaultFontPixelSizeRatio
readonly
property
real
defaultFontPixelSize
:
_textMeasure
.
fo
ntHeight
*
ScreenToolsController
.
defaultFontPixelSizeRatio
readonly
property
real
defaultFontPixelHeight
:
defaultFontPixelSize
readonly
property
real
defaultFontPixelWidth
:
_textMeasure
.
conte
ntWidth
readonly
property
real
defaultFontPixelWidth
:
_textMeasure
.
fo
ntWidth
readonly
property
real
smallFontPixelSize
:
defaultFontPixelSize
*
ScreenToolsController
.
smallFontPixelSizeRatio
readonly
property
real
mediumFontPixelSize
:
defaultFontPixelSize
*
ScreenToolsController
.
mediumFontPixelSizeRatio
readonly
property
real
largeFontPixelSize
:
defaultFontPixelSize
*
ScreenToolsController
.
largeFontPixelSizeRatio
...
...
@@ -30,6 +30,9 @@ Item {
Text
{
id
:
_textMeasure
text
:
"
X
"
property
real
fontWidth
:
contentWidth
*
(
ScreenToolsController
.
testHighDPI
?
2
:
1
)
property
real
fontHeight
:
contentHeight
*
(
ScreenToolsController
.
testHighDPI
?
2
:
1
)
}
Connections
{
...
...
src/QmlControls/ScreenToolsController.cc
View file @
f19c3cfc
...
...
@@ -60,5 +60,13 @@ double ScreenToolsController::getQmlDefaultFontPixelSize(void)
qmlWidgetHolder
.
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/ScreenToolsFontQuery.qml"
));
}
return
_qmlDefaultFontPixelSize
;
double
qmlDefaultFontPixelSize
=
_qmlDefaultFontPixelSize
;
#ifdef QT_DEBUG
if
(
qgcApp
()
->
testHighDPI
())
{
qmlDefaultFontPixelSize
*=
2
;
}
#endif
return
qmlDefaultFontPixelSize
;
}
src/QmlControls/ScreenToolsController.h
View file @
f19c3cfc
...
...
@@ -50,6 +50,7 @@ public:
Q_PROPERTY
(
bool
isAndroid
READ
isAndroid
CONSTANT
)
Q_PROPERTY
(
bool
isiOS
READ
isiOS
CONSTANT
)
Q_PROPERTY
(
bool
isMobile
READ
isMobile
CONSTANT
)
Q_PROPERTY
(
bool
testHighDPI
READ
testHighDPI
CONSTANT
)
//! Used to trigger a \c Canvas element repaint.
/*!
...
...
@@ -113,6 +114,12 @@ public:
bool
isMobile
()
{
return
qgcApp
()
->
fakeMobile
();
}
#endif
#ifdef QT_DEBUG
bool
testHighDPI
(
void
)
{
return
qgcApp
()
->
testHighDPI
();
}
#else
bool
testHighDPI
(
void
)
{
return
false
;
}
#endif
signals:
void
repaintRequested
(
void
);
...
...
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