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
5b54450d
Commit
5b54450d
authored
Jun 08, 2015
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed all fonts to pixel sizes
parent
0ac8e637
Changes
37
Show whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
282 additions
and
374 deletions
+282
-374
style-dark.css
resources/styles/style-dark.css
+11
-8
AirframeComponent.qml
src/AutoPilotPlugins/PX4/AirframeComponent.qml
+2
-2
FlightModesComponent.qml
src/AutoPilotPlugins/PX4/FlightModesComponent.qml
+2
-2
PowerComponent.qml
src/AutoPilotPlugins/PX4/PowerComponent.qml
+6
-6
RadioComponent.qml
src/AutoPilotPlugins/PX4/RadioComponent.qml
+1
-1
SafetyComponent.qml
src/AutoPilotPlugins/PX4/SafetyComponent.qml
+5
-5
SensorsComponent.qml
src/AutoPilotPlugins/PX4/SensorsComponent.qml
+9
-9
QGCApplication.cc
src/QGCApplication.cc
+9
-26
ParameterEditor.qml
src/QmlControls/ParameterEditor.qml
+4
-4
QGCButton.qml
src/QmlControls/QGCButton.qml
+1
-1
QGCCheckBox.qml
src/QmlControls/QGCCheckBox.qml
+1
-1
QGCComboBox.qml
src/QmlControls/QGCComboBox.qml
+1
-1
QGCLabel.qml
src/QmlControls/QGCLabel.qml
+1
-1
QGCRadioButton.qml
src/QmlControls/QGCRadioButton.qml
+1
-1
QGCTextField.qml
src/QmlControls/QGCTextField.qml
+1
-1
QmlTest.qml
src/QmlControls/QmlTest.qml
+32
-0
ScreenTools.cc
src/QmlControls/ScreenTools.cc
+41
-77
ScreenTools.h
src/QmlControls/ScreenTools.h
+86
-35
SubMenuButton.qml
src/QmlControls/SubMenuButton.qml
+1
-1
VehicleRotationCal.qml
src/QmlControls/VehicleRotationCal.qml
+2
-4
FirmwareUpgrade.qml
src/VehicleSetup/FirmwareUpgrade.qml
+3
-3
SetupView.qml
src/VehicleSetup/SetupView.qml
+2
-2
VehicleSummary.qml
src/VehicleSetup/VehicleSummary.qml
+2
-2
MainWindow.cc
src/ui/MainWindow.cc
+0
-43
MainWindow.h
src/ui/MainWindow.h
+0
-17
FlightDisplay.cc
src/ui/flightdisplay/FlightDisplay.cc
+3
-3
FlightDisplay.qml
src/ui/flightdisplay/FlightDisplay.qml
+0
-57
QGCMapDisplay.cc
src/ui/mapdisplay/QGCMapDisplay.cc
+3
-3
QGCCompassInstrument.qml
src/ui/qmlcommon/QGCCompassInstrument.qml
+2
-2
QGCPitchWidget.qml
src/ui/qmlcommon/QGCPitchWidget.qml
+3
-3
QGCSlider.qml
src/ui/qmlcommon/QGCSlider.qml
+1
-1
QGCWaypoint.qml
src/ui/qmlcommon/QGCWaypoint.qml
+1
-1
MainToolBar.cc
src/ui/toolbar/MainToolBar.cc
+0
-8
MainToolBar.h
src/ui/toolbar/MainToolBar.h
+0
-1
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+14
-14
UASQuickView.cc
src/ui/uas/UASQuickView.cc
+10
-7
UASQuickViewTextItem.cc
src/ui/uas/UASQuickViewTextItem.cc
+21
-21
No files found.
resources/styles/style-dark.css
View file @
5b54450d
...
...
@@ -2,12 +2,16 @@
This is the master style sheet as well as the dark style. This style sheet should contain both
color and size/positioning information for all styled controls. This sheet is always loaded first
Then the user specified style sheet is loaded after it to override and color settings.
Font sizes are defined with tokens, which are parsed and replaced at run time.
*/
*
{
background-color
:
#222
;
color
:
#FFF
;
font-size
:
12pt
;
font-size
:
FONT_NORMAL
;
font-weight
:
lighter
;
}
QWidget
#viewModeWidget
{
...
...
@@ -128,7 +132,7 @@ QGroupBox::title {
subcontrol-position
:
top
center
;
margin
:
0
3px
0
3px
;
padding
:
0
3px
0
0
;
font
:
bold
8px
;
font
:
bold
FONT_SMALL
;
color
:
#DDD
;
}
...
...
@@ -149,7 +153,7 @@ QLabel:disabled {
}
QLabel
#noUas
{
font-size
:
30pt
;
font-size
:
FONT_LARGE
;
}
QMessageBox
{
...
...
@@ -158,7 +162,7 @@ QMessageBox {
}
QLabel
#tabTitleLabel
{
font-size
:
28pt
;
font-size
:
FONT_LARGE
;
font-weight
:
lighter
;
margin-top
:
16px
;
margin-bottom
:
8px
;
...
...
@@ -166,7 +170,7 @@ QLabel#tabTitleLabel {
QLabel
#instructionLabel
{
color
:
#FEC654
;
font-size
:
26pt
;
font-size
:
FONT_LARGE
;
}
QLineEdit
{
...
...
@@ -226,7 +230,7 @@ QPlainTextEdit {
border
:
1px
solid
#777
;
border-radius
:
2px
;
font-family
:
"Monospace"
;
font
:
large
;
font
:
FONT_SMALL
;
}
QProgressBar
{
...
...
@@ -529,11 +533,10 @@ UASQuickViewItem QLabel {
padding
:
0
;
margin
:
0
;
min-height
:
1em
;
font-weight
:
bold
;
}
UASQuickViewItem
QLabel
#value
{
font-size
:
20pt
;
font-size
:
FONT_LARGE
;
}
UASView
{
...
...
src/AutoPilotPlugins/PX4/AirframeComponent.qml
View file @
5b54450d
...
...
@@ -97,7 +97,7 @@ QGCView {
QGCLabel
{
id
:
header
width
:
parent
.
width
font.p
ointSize
:
ScreenTools
.
largeFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
largeFontPixel
Size
text
:
"
AIRFRAME CONFIG
"
}
...
...
src/AutoPilotPlugins/PX4/FlightModesComponent.qml
View file @
5b54450d
...
...
@@ -384,7 +384,7 @@ Item {
QGCLabel
{
text
:
"
FLIGHT MODES CONFIG
"
font.p
ointSize
:
ScreenTools
.
largeFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
largeFontPixel
Size
}
Item
{
height
:
20
;
width
:
10
}
// spacer
...
...
@@ -973,7 +973,7 @@ Item {
QGCLabel
{
text
:
"
FLIGHT MODES CONFIG
"
font.p
ointSize
:
ScreenTools
.
fontPointFactor
*
(
20
)
;
font.p
ixelSize
:
ScreenTools
.
font20
;
}
QGCLabel
{
...
...
src/AutoPilotPlugins/PX4/PowerComponent.qml
View file @
5b54450d
...
...
@@ -115,12 +115,12 @@ QGCView {
QGCLabel
{
text
:
"
POWER CONFIG
"
font.p
ointSize
:
ScreenTools
.
largeFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
largeFontPixel
Size
}
QGCLabel
{
text
:
"
Battery
"
font.p
ointSize
:
ScreenTools
.
mediumFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
mediumFontPixel
Size
}
Rectangle
{
...
...
@@ -234,7 +234,7 @@ QGCView {
QGCLabel
{
text
:
"
ESC Calibration
"
font.p
ointSize
:
ScreenTools
.
mediumFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
mediumFontPixel
Size
}
Rectangle
{
...
...
@@ -269,7 +269,7 @@ QGCView {
width: (parent.width / 2) - 5
QGCLabel {
text: "Propeller Function"
font.p
ointSize: ScreenTools.fontPointFactor * (20)
;
font.p
ixelSize: ScreenTools.font20
;
}
Rectangle {
width: parent.width
...
...
@@ -282,7 +282,7 @@ QGCView {
width: (parent.width / 2) - 5
QGCLabel {
text: "Magnetometer Distortion"
font.p
ointSize: ScreenTools.fontPointFactor * (20)
;
font.p
ixelSize: ScreenTools.font20
;
}
Rectangle {
width: parent.width
...
...
@@ -301,7 +301,7 @@ QGCView {
}
QGCLabel
{
text
:
"
Advanced Power Settings
"
font.p
ointSize
:
ScreenTools
.
fontPointFactor
*
(
20
)
;
font.p
ixelSize
:
ScreenTools
.
font20
;
visible
:
showAdvanced
.
checked
}
Rectangle
{
...
...
src/AutoPilotPlugins/PX4/RadioComponent.qml
View file @
5b54450d
...
...
@@ -258,7 +258,7 @@ QGCView {
QGCLabel
{
id
:
header
font.p
ointSize
:
ScreenTools
.
largeFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
largeFontPixel
Size
text
:
"
RADIO CONFIG
"
}
...
...
src/AutoPilotPlugins/PX4/SafetyComponent.qml
View file @
5b54450d
...
...
@@ -52,7 +52,7 @@ FactPanel {
QGCLabel
{
text
:
"
SAFETY CONFIG
"
font.p
ointSize
:
ScreenTools
.
largeFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
largeFontPixel
Size
}
Item
{
height
:
20
;
width
:
10
}
// spacer
...
...
@@ -60,7 +60,7 @@ FactPanel {
//-----------------------------------------------------------------
//-- Return Home Triggers
QGCLabel
{
text
:
"
Triggers For Return Home
"
;
font.p
ointSize
:
ScreenTools
.
mediumFontPoint
Size
;
}
QGCLabel
{
text
:
"
Triggers For Return Home
"
;
font.p
ixelSize
:
ScreenTools
.
mediumFontPixel
Size
;
}
Item
{
height
:
10
;
width
:
10
}
// spacer
...
...
@@ -119,7 +119,7 @@ FactPanel {
//-----------------------------------------------------------------
//-- Return Home Settings
QGCLabel
{
text
:
"
Return Home Settings
"
;
font.p
ointSize
:
ScreenTools
.
mediumFontPoint
Size
;
}
QGCLabel
{
text
:
"
Return Home Settings
"
;
font.p
ixelSize
:
ScreenTools
.
mediumFontPixel
Size
;
}
Item
{
height
:
10
;
width
:
10
}
// spacer
...
...
@@ -290,7 +290,7 @@ FactPanel {
QGCLabel
{
width
:
parent
.
width
font.p
ointSize
:
ScreenTools
.
mediumFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
mediumFontPixel
Size
text
:
"
Warning: You have an advanced safety configuration set using the NAV_RCL_OBC parameter. The above settings may not apply.
"
;
visible
:
fact
.
value
!==
0
wrapMode
:
Text
.
Wrap
...
...
@@ -300,7 +300,7 @@ FactPanel {
QGCLabel
{
width
:
parent
.
width
font.p
ointSize
:
ScreenTools
.
mediumFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
mediumFontPixel
Size
text
:
"
Warning: You have an advanced safety configuration set using the NAV_DLL_OBC parameter. The above settings may not apply.
"
;
visible
:
fact
.
value
!==
0
wrapMode
:
Text
.
Wrap
...
...
src/AutoPilotPlugins/PX4/SensorsComponent.qml
View file @
5b54450d
...
...
@@ -57,8 +57,8 @@ QGCView {
// Used to pass help text to the preCalibrationDialog dialog
property
string
preCalibrationDialogHelp
readonly
property
int
sideBarH1PointSize
:
(
ScreenTools
.
defaultFontP
oint
Size
*
1.3
+
0.5
)
readonly
property
int
mainTextH1PointSize
:
(
ScreenTools
.
defaultFontP
oint
Size
*
1.5
+
0.5
)
readonly
property
int
sideBarH1PointSize
:
(
ScreenTools
.
defaultFontP
izel
Size
*
1.3
+
0.5
)
readonly
property
int
mainTextH1PointSize
:
(
ScreenTools
.
defaultFontP
izel
Size
*
1.5
+
0.5
)
readonly
property
int
rotationColumnWidth
:
250
readonly
property
var
rotations
:
[
...
...
@@ -213,7 +213,7 @@ QGCView {
id
:
compass0ComponentLabel
QGCLabel
{
font.p
oint
Size
:
sideBarH1PointSize
font.p
ixel
Size
:
sideBarH1PointSize
text
:
"
External Compass Orientation
"
}
...
...
@@ -280,7 +280,7 @@ QGCView {
QGCLabel
{
text
:
"
SENSORS CONFIG
"
font.p
ointSize
:
ScreenTools
.
largeFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
largeFontPixel
Size
}
Item
{
height
:
20
;
width
:
10
}
// spacer
...
...
@@ -408,7 +408,7 @@ QGCView {
id
:
orientationCalAreaHelpText
width
:
parent
.
width
wrapMode
:
Text
.
WordWrap
font.p
ointSize
:
ScreenTools
.
fontPointFactor
*
(
22
)
;
font.p
ixelSize
:
ScreenTools
.
font22
;
anchors.top
:
orientationCalArea
.
top
anchors.left
:
orientationCalArea
.
left
anchors.topMargin
:
15
...
...
@@ -480,7 +480,7 @@ QGCView {
spacing
:
5
QGCLabel
{
font.p
oint
Size
:
sideBarH1PointSize
font.p
ixel
Size
:
sideBarH1PointSize
text
:
"
Autopilot Orientation
"
}
...
...
@@ -506,7 +506,7 @@ QGCView {
id
:
compass0ComponentLabel2
QGCLabel
{
font.p
oint
Size
:
sideBarH1PointSize
font.p
ixel
Size
:
sideBarH1PointSize
text
:
"
External Compass Orientation
"
}
}
...
...
@@ -531,7 +531,7 @@ QGCView {
id
:
compass1ComponentLabel2
QGCLabel
{
font.p
oint
Size
:
sideBarH1PointSize
font.p
ixel
Size
:
sideBarH1PointSize
text
:
"
External Compass 1 Orientation
"
}
}
...
...
@@ -556,7 +556,7 @@ QGCView {
id
:
compass2ComponentLabel2
QGCLabel
{
font.p
oint
Size
:
sidebarH1PointSize
font.p
ixel
Size
:
sidebarH1PointSize
text
:
"
Compass 2 Orientation
"
}
}
...
...
src/QGCApplication.cc
View file @
5b54450d
...
...
@@ -655,33 +655,16 @@ void QGCApplication::_loadCurrentStyle(void)
}
}
// Now that we have the styles loaded we need to dpi adjust the font point sizes
QString
dpiAdjustedStyles
;
if
(
success
)
{
QTextStream
styleStream
(
&
styles
,
QIODevice
::
ReadOnly
);
QRegularExpression
regex
(
"font-size:.+(
\\
d
\\
d)pt;"
);
while
(
!
styleStream
.
atEnd
())
{
QString
adjustedLine
;
QString
line
=
styleStream
.
readLine
();
QRegularExpressionMatch
match
=
regex
.
match
(
line
);
if
(
match
.
hasMatch
())
{
//qDebug() << "found:" << line << match.captured(1);
adjustedLine
=
QString
(
"font-size: %1pt;"
).
arg
(
ScreenTools
::
adjustFontPointSize_s
(
match
.
captured
(
1
).
toDouble
()));
//qDebug() << "adjusted:" << adjustedLine;
}
else
{
adjustedLine
=
line
;
}
// Now that we have the styles loaded we need to adjust the font sizes.
dpiAdjustedStyles
+=
adjustedLine
;
}
}
QString
fSmall
=
QString
(
"%1px;"
).
arg
(
ScreenTools
::
font10_s
())
;
QString
fNormal
=
QString
(
"%1px;"
).
arg
(
ScreenTools
::
defaultFontPizelSize_s
());
QString
fLarge
=
QString
(
"%1px;"
).
arg
(
ScreenTools
::
largeFontPixelSize_s
());
if
(
!
dpiAdjustedStyles
.
isEmpty
())
{
setStyleSheet
(
dpiAdjustedStyles
);
}
styles
.
replace
(
"FONT_SMALL"
,
fSmall
);
styles
.
replace
(
"FONT_NORMAL"
,
fNormal
);
styles
.
replace
(
"FONT_LARGE"
,
fLarge
);
setStyleSheet
(
styles
);
if
(
!
success
)
{
// Fall back to plastique if we can't load our own
...
...
src/QmlControls/ParameterEditor.qml
View file @
5b54450d
...
...
@@ -66,7 +66,7 @@ QGCView {
height
:
defaultTextHeight
+
(
ScreenTools
.
pixelSizeFactor
*
(
9
))
text
:
group
verticalAlignment
:
Text
.
AlignVCenter
font.p
ointSize
:
ScreenTools
.
fontPointFactor
*
(
16
)
;
font.p
ixelSize
:
ScreenTools
.
font16
;
}
Rectangle
{
...
...
@@ -142,7 +142,7 @@ QGCView {
height
:
firstButton
.
height
QGCLabel
{
font.p
ointSize
:
ScreenTools
.
fontPointFactor
*
(
20
)
font.p
ixelSize
:
ScreenTools
.
font20
;
visible
:
fullMode
text
:
"
PARAMETER EDITOR
"
}
...
...
@@ -202,7 +202,7 @@ QGCView {
height
:
contentHeight
+
(
ScreenTools
.
pixelSizeFactor
*
(
9
))
text
:
"
Component #:
"
+
componentId
.
toString
()
verticalAlignment
:
Text
.
AlignVCenter
font.p
ointSize
:
ScreenTools
.
fontPointFactor
*
(
16
)
;
font.p
ixelSize
:
ScreenTools
.
font16
;
}
Repeater
{
...
...
src/QmlControls/QGCButton.qml
View file @
5b54450d
...
...
@@ -104,7 +104,7 @@ Button {
id
:
text
antialiasing
:
true
text
:
control
.
text
font.p
ointSize
:
ScreenTools
.
defaultFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
defaultFontPizel
Size
anchors.verticalCenter
:
parent
.
verticalCenter
...
...
src/QmlControls/QGCCheckBox.qml
View file @
5b54450d
...
...
@@ -29,7 +29,7 @@ CheckBox {
id
:
text
text
:
control
.
text
antialiasing
:
true
font.p
ointSize
:
ScreenTools
.
defaultFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
defaultFontPizel
Size
anchors.centerIn
:
parent
...
...
src/QmlControls/QGCComboBox.qml
View file @
5b54450d
...
...
@@ -11,7 +11,7 @@ ComboBox {
property
bool
__showHighlight
:
pressed
|
hovered
style
:
ComboBoxStyle
{
font.p
ointSize
:
ScreenTools
.
defaultFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
defaultFontPizel
Size
textColor
:
__showHighlight
?
control
.
__qgcPal
.
buttonHighlightText
:
control
.
__qgcPal
.
buttonText
...
...
src/QmlControls/QGCLabel.qml
View file @
5b54450d
...
...
@@ -10,7 +10,7 @@ Text {
property
bool
enabled
:
true
font.p
ointSize
:
ScreenTools
.
defaultFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
defaultFontPizel
Size
color
:
__qgcPal
.
text
antialiasing
:
true
}
src/QmlControls/QGCRadioButton.qml
View file @
5b54450d
...
...
@@ -28,7 +28,7 @@ RadioButton {
Text
{
id
:
text
text
:
control
.
text
font.p
ointSize
:
ScreenTools
.
defaultFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
defaultFontPizel
Size
antialiasing
:
true
anchors.centerIn
:
parent
...
...
src/QmlControls/QGCTextField.qml
View file @
5b54450d
...
...
@@ -50,7 +50,7 @@ TextField {
width
:
unitsLabelWidthGenerator
.
width
text
:
control
.
unitsLabel
font.p
ointSize
:
ScreenTools
.
defaultFontPoint
Size
font.p
ixelSize
:
ScreenTools
.
defaultFontPizel
Size
antialiasing
:
true
color
:
control
.
textColor
...
...
src/QmlControls/QmlTest.qml
View file @
5b54450d
...
...
@@ -483,5 +483,37 @@ Rectangle {
}
}
}
Row
{
Column
{
Text
{
font.pixelSize
:
8
;
color
:
"
white
"
;
text
:
"
Text Test 8px
"
;
}
Text
{
font.pixelSize
:
9
;
color
:
"
white
"
;
text
:
"
Text Test 9px
"
;
}
Text
{
font.pixelSize
:
10
;
color
:
"
white
"
;
text
:
"
Text Test 10px
"
;
}
Text
{
font.pixelSize
:
11
;
color
:
"
white
"
;
text
:
"
Text Test 11px
"
;
}
Text
{
font.pixelSize
:
12
;
color
:
"
white
"
;
text
:
"
Text Test 12px
"
;
}
Text
{
font.pixelSize
:
13
;
color
:
"
white
"
;
text
:
"
Text Test 13px
"
;
}
Text
{
font.pixelSize
:
14
;
color
:
"
white
"
;
text
:
"
Text Test 14px
"
;
}
Text
{
font.pixelSize
:
15
;
color
:
"
white
"
;
text
:
"
Text Test 15px
"
;
}
Text
{
font.pixelSize
:
16
;
color
:
"
white
"
;
text
:
"
Text Test 16px
"
;
}
Text
{
font.pixelSize
:
17
;
color
:
"
white
"
;
text
:
"
Text Test 17px
"
;
}
Text
{
font.pixelSize
:
18
;
color
:
"
white
"
;
text
:
"
Text Test 18px
"
;
}
Text
{
font.pixelSize
:
19
;
color
:
"
white
"
;
text
:
"
Text Test 19px
"
;
}
Text
{
font.pixelSize
:
20
;
color
:
"
white
"
;
text
:
"
Text Test 20px
"
;
}
}
Column
{
Text
{
font.pixelSize
:
8
;
color
:
"
white
"
;
text
:
"
Text Test 8pt
"
;
}
Text
{
font.pixelSize
:
9
;
color
:
"
white
"
;
text
:
"
Text Test 9pt
"
;
}
Text
{
font.pixelSize
:
10
;
color
:
"
white
"
;
text
:
"
Text Test 10pt
"
;
}
Text
{
font.pixelSize
:
11
;
color
:
"
white
"
;
text
:
"
Text Test 11pt
"
;
}
Text
{
font.pixelSize
:
12
;
color
:
"
white
"
;
text
:
"
Text Test 12pt
"
;
}
Text
{
font.pixelSize
:
13
;
color
:
"
white
"
;
text
:
"
Text Test 13pt
"
;
}
Text
{
font.pixelSize
:
14
;
color
:
"
white
"
;
text
:
"
Text Test 14pt
"
;
}
Text
{
font.pixelSize
:
15
;
color
:
"
white
"
;
text
:
"
Text Test 15pt
"
;
}
Text
{
font.pixelSize
:
16
;
color
:
"
white
"
;
text
:
"
Text Test 16pt
"
;
}
Text
{
font.pixelSize
:
17
;
color
:
"
white
"
;
text
:
"
Text Test 17pt
"
;
}
Text
{
font.pixelSize
:
18
;
color
:
"
white
"
;
text
:
"
Text Test 18pt
"
;
}
Text
{
font.pixelSize
:
19
;
color
:
"
white
"
;
text
:
"
Text Test 19pt
"
;
}
Text
{
font.pixelSize
:
20
;
color
:
"
white
"
;
text
:
"
Text Test 20pt
"
;
}
}
}
}
}
src/QmlControls/ScreenTools.cc
View file @
5b54450d
...
...
@@ -27,35 +27,55 @@
#include "ScreenTools.h"
#include "MainWindow.h"
#include <QFont>
#include <QFontMetrics>
const
double
ScreenTools
::
_defaultFontPointSize
=
13
;
const
double
ScreenTools
::
_mediumFontPointSize
=
16
;
const
double
ScreenTools
::
_largeFontPointSize
=
20
;
// Pixel size, instead of a physical thing is actually a philosophical question when
// it comes to Qt. Fonts are that and some heavy Kabalistic Voodoo added to the mix.
// The values below came from actually measuring the elements on the screen on these
// devices. I have yet to find a constant from Qt so these things can be properly
// computed at runtime.
#if defined(Q_OS_OSX)
double
ScreenTools
::
_pixelFactor
=
1.0
;
#elif defined(__ios__)
double
ScreenTools
::
_pixelFactor
=
0.75
;
#elif defined(Q_OS_WIN)
double
ScreenTools
::
_pixelFactor
=
0.86
;
#elif defined(__android__)
double
ScreenTools
::
_pixelFactor
=
2.5
;
#elif defined(Q_OS_LINUX)
double
ScreenTools
::
_pixelFactor
=
1.0
;
#endif
#if defined(__android__)
#define FONT_FACTOR 2
#else
#define FONT_FACTOR 1
#endif
int
ScreenTools
::
_font8
=
8
*
FONT_FACTOR
;
int
ScreenTools
::
_font9
=
9
*
FONT_FACTOR
;
int
ScreenTools
::
_font10
=
10
*
FONT_FACTOR
;
int
ScreenTools
::
_font11
=
11
*
FONT_FACTOR
;
int
ScreenTools
::
_font12
=
12
*
FONT_FACTOR
;
int
ScreenTools
::
_font13
=
13
*
FONT_FACTOR
;
int
ScreenTools
::
_font14
=
14
*
FONT_FACTOR
;
int
ScreenTools
::
_font15
=
15
*
FONT_FACTOR
;
int
ScreenTools
::
_font16
=
16
*
FONT_FACTOR
;
int
ScreenTools
::
_font17
=
17
*
FONT_FACTOR
;
int
ScreenTools
::
_font18
=
18
*
FONT_FACTOR
;
int
ScreenTools
::
_font19
=
19
*
FONT_FACTOR
;
int
ScreenTools
::
_font20
=
20
*
FONT_FACTOR
;
int
ScreenTools
::
_font21
=
21
*
FONT_FACTOR
;
int
ScreenTools
::
_font22
=
22
*
FONT_FACTOR
;
ScreenTools
::
ScreenTools
()
{
MainWindow
*
mainWindow
=
MainWindow
::
instance
();
// Unit tests can run Qml without MainWindow
if
(
mainWindow
)
{
connect
(
mainWindow
,
&
MainWindow
::
repaintCanvas
,
this
,
&
ScreenTools
::
_updateCanvas
);
connect
(
mainWindow
,
&
MainWindow
::
pixelSizeChanged
,
this
,
&
ScreenTools
::
_updatePixelSize
);
connect
(
mainWindow
,
&
MainWindow
::
fontSizeChanged
,
this
,
&
ScreenTools
::
_updateFontSize
);
}
}
qreal
ScreenTools
::
adjustFontPointSize
(
qreal
pointSize
)
{
return
adjustFontPointSize_s
(
pointSize
);
}
qreal
ScreenTools
::
adjustFontPointSize_s
(
qreal
pointSize
)
{
return
pointSize
*
MainWindow
::
fontPointFactor
();
}
qreal
ScreenTools
::
adjustPixelSize
(
qreal
pixelSize
)
{
return
adjustPixelSize_s
(
pixelSize
);
...
...
@@ -63,66 +83,10 @@ qreal ScreenTools::adjustPixelSize(qreal pixelSize)
qreal
ScreenTools
::
adjustPixelSize_s
(
qreal
pixelSize
)
{
return
pixelSize
*
MainWindow
::
pixelSizeFactor
();
}
void
ScreenTools
::
increasePixelSize
()
{
MainWindow
::
instance
()
->
setPixelSizeFactor
(
MainWindow
::
pixelSizeFactor
()
+
0.025
);
}
void
ScreenTools
::
decreasePixelSize
()
{
MainWindow
::
instance
()
->
setPixelSizeFactor
(
MainWindow
::
pixelSizeFactor
()
-
0.025
);
}
void
ScreenTools
::
increaseFontSize
()
{
MainWindow
::
instance
()
->
setFontSizeFactor
(
MainWindow
::
fontPointFactor
()
+
0.025
);
}
void
ScreenTools
::
decreaseFontSize
()
{
MainWindow
::
instance
()
->
setFontSizeFactor
(
MainWindow
::
fontPointFactor
()
-
0.025
);
return
pixelSize
*
_pixelFactor
;
}
void
ScreenTools
::
_updateCanvas
()
{
emit
repaintRequestedChanged
();
}
void
ScreenTools
::
_updatePixelSize
()
{
emit
pixelSizeFactorChanged
();
}
void
ScreenTools
::
_updateFontSize
()
{
emit
fontPointFactorChanged
();
emit
fontSizesChanged
();
}
double
ScreenTools
::
fontPointFactor
()
{
return
MainWindow
::
fontPointFactor
();
}
double
ScreenTools
::
pixelSizeFactor
()
{
return
MainWindow
::
pixelSizeFactor
();
}
double
ScreenTools
::
defaultFontPointSize
(
void
)
{
return
_defaultFontPointSize
*
MainWindow
::
fontPointFactor
();
}
double
ScreenTools
::
mediumFontPointSize
(
void
)
{
return
_mediumFontPointSize
*
MainWindow
::
fontPointFactor
();
}
double
ScreenTools
::
largeFontPointSize
(
void
)
{
return
_largeFontPointSize
*
MainWindow
::
fontPointFactor
();
}
src/QmlControls/ScreenTools.h
View file @
5b54450d
...
...
@@ -80,46 +80,87 @@ public:
@endcode
*/
Q_PROPERTY
(
bool
repaintRequested
READ
repaintRequested
NOTIFY
repaintRequestedChanged
)
//! Returns the font point size factor
Q_PROPERTY
(
double
fontPointFactor
READ
fontPointFactor
NOTIFY
fontPointFactorChanged
)
//! Returns the pixel size factor
Q_PROPERTY
(
double
pixelSizeFactor
READ
pixelSizeFactor
NOTIFY
pixelSizeFactorChanged
)
//! Font sizes
Q_PROPERTY
(
int
font22
READ
font22
CONSTANT
)
Q_PROPERTY
(
int
font21
READ
font21
CONSTANT
)
Q_PROPERTY
(
int
font20
READ
font20
CONSTANT
)
Q_PROPERTY
(
int
font19
READ
font19
CONSTANT
)
Q_PROPERTY
(
int
font18
READ
font18
CONSTANT
)
Q_PROPERTY
(
int
font17
READ
font17
CONSTANT
)
Q_PROPERTY
(
int
font16
READ
font16
CONSTANT
)
Q_PROPERTY
(
int
font15
READ
font15
CONSTANT
)
Q_PROPERTY
(
int
font14
READ
font14
CONSTANT
)
Q_PROPERTY
(
int
font13
READ
font13
CONSTANT
)
Q_PROPERTY
(
int
font12
READ
font12
CONSTANT
)
Q_PROPERTY
(
int
font11
READ
font11
CONSTANT
)
Q_PROPERTY
(
int
font10
READ
font10
CONSTANT
)
Q_PROPERTY
(
int
font9
READ
font9
CONSTANT
)
Q_PROPERTY
(
int
font8
READ
font8
CONSTANT
)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY
(
double
defaultFontPointSize
READ
defaultFontPointSize
NOTIFY
fontSizesChanged
)
Q_PROPERTY
(
int
defaultFontPizelSize
READ
defaultFontPizelSize
CONSTANT
)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY
(
double
mediumFontPointSize
READ
mediumFontPointSize
NOTIFY
fontSizesChanged
)
Q_PROPERTY
(
int
mediumFontPixelSize
READ
mediumFontPixelSize
CONSTANT
)
//! Returns the system wide default font point size (properly scaled)
Q_PROPERTY
(
double
largeFontPointSize
READ
largeFontPointSize
NOTIFY
fontSizesChanged
)
Q_PROPERTY
(
int
largeFontPixelSize
READ
largeFontPixelSize
CONSTANT
)
Q_PROPERTY
(
bool
repaintRequested
READ
repaintRequested
NOTIFY
repaintRequestedChanged
)
//! Returns the pixel size factor
Q_PROPERTY
(
double
pixelSizeFactor
READ
pixelSizeFactor
CONSTANT
)
//! Utility for adjusting font point size. Not dynamic (no signals)
Q_INVOKABLE
qreal
adjustFontPointSize
(
qreal
pointSize
);
//! Utility for adjusting pixel size. Not dynamic (no signals)
Q_INVOKABLE
qreal
adjustPixelSize
(
qreal
pixelSize
);
//! Utility for increasing pixel size.
Q_INVOKABLE
void
increasePixelSize
();
//! Utility for decreasing pixel size.
Q_INVOKABLE
void
decreasePixelSize
();
//! Utility for increasing font size.
Q_INVOKABLE
void
increaseFontSize
();
//! Utility for decreasing font size.
Q_INVOKABLE
void
decreaseFontSize
();
/// Static version of adjustFontPointSize of use in C++ code
static
qreal
adjustFontPointSize_s
(
qreal
pointSize
);
/// Static version of adjustPixelSize of use in C++ code
static
qreal
adjustPixelSize_s
(
qreal
pixelSize
);
int
mouseX
()
{
return
QCursor
::
pos
().
x
();
}
int
mouseY
()
{
return
QCursor
::
pos
().
y
();
}
bool
repaintRequested
()
{
return
true
;
}
double
fontPointFactor
();
double
pixelSizeFactor
();
double
defaultFontPointSize
(
void
);
double
mediumFontPointSize
(
void
);
double
largeFontPointSize
(
void
);
double
pixelSizeFactor
()
{
return
_pixelFactor
;
}
int
font22
()
{
return
_font22
;
}
int
font21
()
{
return
_font21
;
}
int
font20
()
{
return
_font20
;
}
int
font19
()
{
return
_font19
;
}
int
font18
()
{
return
_font18
;
}
int
font17
()
{
return
_font17
;
}
int
font16
()
{
return
_font16
;
}
int
font15
()
{
return
_font15
;
}
int
font14
()
{
return
_font14
;
}
int
font13
()
{
return
_font13
;
}
int
font12
()
{
return
_font12
;
}
int
font11
()
{
return
_font11
;
}
int
font10
()
{
return
_font10
;
}
int
font9
()
{
return
_font9
;
}
int
font8
()
{
return
_font8
;
}
int
defaultFontPizelSize
()
{
return
_font12
;
}
int
mediumFontPixelSize
()
{
return
_font16
;
}
int
largeFontPixelSize
()
{
return
_font20
;
}
/// Static version for use in C++ code
static
int
font22_s
()
{
return
_font22
;
}
static
int
font21_s
()
{
return
_font21
;
}
static
int
font20_s
()
{
return
_font20
;
}
static
int
font19_s
()
{
return
_font19
;
}
static
int
font18_s
()
{
return
_font18
;
}
static
int
font17_s
()
{
return
_font17
;
}
static
int
font16_s
()
{
return
_font16
;
}
static
int
font15_s
()
{
return
_font15
;
}
static
int
font14_s
()
{
return
_font14
;
}
static
int
font13_s
()
{
return
_font13
;
}
static
int
font12_s
()
{
return
_font12
;
}
static
int
font11_s
()
{
return
_font11
;
}
static
int
font10_s
()
{
return
_font10
;
}
static
int
font9_s
()
{
return
_font9
;
}
static
int
font8_s
()
{
return
_font8
;
}
static
int
defaultFontPizelSize_s
()
{
return
_font12
;
}
static
int
mediumFontPixelSize_s
()
{
return
_font16
;
}
static
int
largeFontPixelSize_s
()
{
return
_font20
;
}
static
double
pixelSizeFactor_s
()
{
return
_pixelFactor
;
}
#if defined (__android__)
bool
isAndroid
()
{
return
true
;
}
...
...
@@ -137,19 +178,29 @@ public:
signals:
void
repaintRequestedChanged
();
void
pixelSizeFactorChanged
();