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
890833b3
Commit
890833b3
authored
Apr 10, 2020
by
DoinLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
0121a26a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
ScreenTools.qml
src/QmlControls/ScreenTools.qml
+6
-2
ScreenToolsController.cc
src/QmlControls/ScreenToolsController.cc
+5
-0
ScreenToolsController.h
src/QmlControls/ScreenToolsController.h
+8
-6
No files found.
src/QmlControls/ScreenTools.qml
View file @
890833b3
pragma
Singleton
import
QtQuick
2.3
import
QtQuick
2.12
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Window
2.2
...
...
@@ -43,6 +43,9 @@ Item {
/// your ui elements will reposition themselves appropriately on varying screen sizes and resolutions.
property
real
defaultFontPixelWidth
:
10
/// QFontMetrics::descent for default font at default point size
property
real
defaultFontDescent
:
0
property
real
smallFontPointSize
:
10
property
real
mediumFontPointSize
:
10
property
real
largeFontPointSize
:
10
...
...
@@ -134,6 +137,7 @@ Item {
defaultFontPointSize
=
pointSize
defaultFontPixelHeight
=
Math
.
round
(
_textMeasure
.
fontHeight
/
2.0
)
*
2
defaultFontPixelWidth
=
Math
.
round
(
_textMeasure
.
fontWidth
/
2.0
)
*
2
defaultFontDescent
=
ScreenToolsController
.
defaultFontDescent
(
defaultFontPointSize
)
smallFontPointSize
=
defaultFontPointSize
*
_screenTools
.
smallFontPointRatio
mediumFontPointSize
=
defaultFontPointSize
*
_screenTools
.
mediumFontPointRatio
largeFontPointSize
=
defaultFontPointSize
*
_screenTools
.
largeFontPointRatio
...
...
src/QmlControls/ScreenToolsController.cc
View file @
890833b3
...
...
@@ -73,3 +73,8 @@ ScreenToolsController::boldFontFamily() const
return
QString
(
"opensans-demibold"
);
}
}
double
ScreenToolsController
::
defaultFontDescent
(
int
pointSize
)
const
{
return
QFontMetrics
(
QFont
(
normalFontFamily
(),
pointSize
)).
descent
();
}
src/QmlControls/ScreenToolsController.h
View file @
890833b3
...
...
@@ -47,6 +47,9 @@ public:
Q_INVOKABLE
int
mouseX
(
void
)
{
return
QCursor
::
pos
().
x
();
}
Q_INVOKABLE
int
mouseY
(
void
)
{
return
QCursor
::
pos
().
y
();
}
// QFontMetrics::descent for default font
Q_INVOKABLE
double
defaultFontDescent
(
int
pointSize
)
const
;
#if defined(__mobile__)
bool
isMobile
()
const
{
return
true
;
}
#else
...
...
@@ -103,8 +106,7 @@ public:
bool
isDebug
()
{
return
false
;
}
#endif
bool
hasTouch
()
const
;
bool
hasTouch
()
const
;
QString
iOSDevice
()
const
;
QString
fixedFontFamily
()
const
;
QString
normalFontFamily
()
const
;
...
...
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