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
c4b864aa
Unverified
Commit
c4b864aa
authored
Jan 23, 2020
by
Gus Grubba
Committed by
GitHub
Jan 23, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8256 from mavlink/pr-ui-scaling
UI Scaling
parents
0b5aba44
da62ead1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
74 deletions
+86
-74
QGCComboBox.qml
src/QmlControls/QGCComboBox.qml
+7
-4
ScreenTools.qml
src/QmlControls/ScreenTools.qml
+26
-30
App.SettingsGroup.json
src/Settings/App.SettingsGroup.json
+1
-2
GeneralSettings.qml
src/ui/preferences/GeneralSettings.qml
+52
-38
No files found.
src/QmlControls/QGCComboBox.qml
View file @
c4b864aa
...
...
@@ -21,6 +21,8 @@ T.ComboBox {
id
:
control
padding
:
ScreenTools
.
comboBoxPadding
spacing
:
ScreenTools
.
defaultFontPixelWidth
font.pointSize
:
ScreenTools
.
defaultFontPointSize
font.family
:
ScreenTools
.
normalFontFamily
implicitWidth
:
Math
.
max
(
background
?
background
.
implicitWidth
:
0
,
contentItem
.
implicitWidth
+
leftPadding
+
rightPadding
+
padding
)
implicitHeight
:
Math
.
max
(
background
?
background
.
implicitHeight
:
0
,
...
...
@@ -38,12 +40,12 @@ T.ComboBox {
TextMetrics
{
id
:
textMetrics
font
:
control
.
font
}
onModelChanged
:
{
if
(
sizeToContents
)
{
_largestTextWidth
=
0
textMetrics
.
font
=
control
.
font
for
(
var
i
=
0
;
i
<
model
.
length
;
i
++
){
textMetrics
.
text
=
model
[
i
]
_largestTextWidth
=
Math
.
max
(
textMetrics
.
width
,
_largestTextWidth
)
...
...
@@ -60,6 +62,7 @@ T.ComboBox {
TextMetrics
{
id
:
popupItemMetrics
font
:
control
.
font
text
:
_text
}
...
...
src/QmlControls/ScreenTools.qml
View file @
c4b864aa
...
...
@@ -31,6 +31,7 @@ Item {
//-- The point and pixel font size values are computed at runtime
property
real
defaultFontPointSize
:
10
property
real
platformFontPointSize
:
10
/// You can use this property to position ui elements in a screen resolution independent manner. Using fixed positioning values should not
/// be done. All positioning should be done using anchors or a ratio of the defaultFontPixelHeight and defaultFontPixelWidth values. This way
...
...
@@ -105,7 +106,6 @@ Item {
Connections
{
target
:
QGroundControl
.
settingsManager
.
appSettings
.
appFontPointSize
onValueChanged
:
{
if
(
ScreenToolsController
.
isDebug
)
_setBasePointSize
(
QGroundControl
.
settingsManager
.
appSettings
.
appFontPointSize
.
value
)
}
}
...
...
@@ -158,40 +158,36 @@ Item {
property
real
fontWidth
:
contentWidth
property
real
fontHeight
:
contentHeight
Component.onCompleted
:
{
var
_appFontPointSizeFact
=
QGroundControl
.
settingsManager
.
appSettings
.
appFontPointSize
var
baseSize
=
_appFontPointSizeFact
.
value
//-- If this is the first time (not saved in settings)
if
(
baseSize
<
_appFontPointSizeFact
.
min
||
baseSize
>
_appFontPointSizeFact
.
max
)
{
//-- Init base size base on the platform
//-- First, compute platform, default size
if
(
ScreenToolsController
.
isMobile
)
{
//-- Check iOS really tiny screens (iPhone 4s/5/5s)
if
(
ScreenToolsController
.
isiOS
)
{
if
(
ScreenToolsController
.
isiOS
&&
Screen
.
width
<
570
)
{
// For iPhone 4s size we don't fit with additional tweaks to fit screen,
// we will just drop point size to make things fit. Correct size not yet determined.
base
Size
=
12
;
// This will be lowered in a future pull
platformFontPoint
Size
=
12
;
// This will be lowered in a future pull
}
else
{
base
Size
=
14
;
platformFontPoint
Size
=
14
;
}
}
else
if
((
Screen
.
width
/
realPixelDensity
)
<
120
)
{
base
Size
=
11
;
platformFontPoint
Size
=
11
;
// Other Android
}
else
{
base
Size
=
14
;
platformFontPoint
Size
=
14
;
}
}
else
{
base
Size
=
_defaultFont
.
font
.
pointSize
;
platformFontPoint
Size
=
_defaultFont
.
font
.
pointSize
;
}
_appFontPointSizeFact
.
_setIgnoreQGCRebootRequired
(
true
)
//-- See if we are using a custom size
var
_appFontPointSizeFact
=
QGroundControl
.
settingsManager
.
appSettings
.
appFontPointSize
var
baseSize
=
_appFontPointSizeFact
.
value
//-- Sanity check
if
(
baseSize
<
_appFontPointSizeFact
.
min
||
baseSize
>
_appFontPointSizeFact
.
max
)
{
baseSize
=
platformFontPointSize
;
_appFontPointSizeFact
.
value
=
baseSize
_appFontPointSizeFact
.
_setIgnoreQGCRebootRequired
(
false
)
//-- Release build doesn't get signal
if
(
!
ScreenToolsController
.
isDebug
)
_screenTools
.
_setBasePointSize
(
baseSize
);
}
else
{
}
//-- Set size saved in settings
_screenTools
.
_setBasePointSize
(
baseSize
);
}
}
}
}
src/Settings/App.SettingsGroup.json
View file @
c4b864aa
...
...
@@ -146,8 +146,7 @@
"units"
:
"pt"
,
"min"
:
6
,
"max"
:
48
,
"defaultValue"
:
0
,
"qgcRebootRequired"
:
true
"defaultValue"
:
0
},
{
"name"
:
"indoorPalette"
,
...
...
src/ui/preferences/GeneralSettings.qml
View file @
c4b864aa
...
...
@@ -36,7 +36,7 @@ Rectangle {
property
Fact
_userBrandImageIndoor
:
QGroundControl
.
settingsManager
.
brandImageSettings
.
userBrandImageIndoor
property
Fact
_userBrandImageOutdoor
:
QGroundControl
.
settingsManager
.
brandImageSettings
.
userBrandImageOutdoor
property
real
_labelWidth
:
ScreenTools
.
defaultFontPixelWidth
*
20
property
real
_comboFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
28
property
real
_comboFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_valueFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10
property
string
_mapProvider
:
QGroundControl
.
settingsManager
.
flightMapSettings
.
mapProvider
.
value
property
string
_mapType
:
QGroundControl
.
settingsManager
.
flightMapSettings
.
mapType
.
value
...
...
@@ -206,49 +206,46 @@ Rectangle {
indexModel
:
false
visible
:
_followTarget
.
visible
}
QGCLabel
{
text
:
qsTr
(
"
UI Scaling
"
)
visible
:
_appFontPointSize
.
visible
Layout.alignment
:
Qt
.
AlignVCenter
}
}
Item
{
id
:
miscColItem
anchors.margins
:
_margins
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
comboGridItem
.
bottom
height
:
miscCol
.
height
ColumnLayout
{
id
:
miscCol
anchors.horizontalCenter
:
parent
.
horizontalCenter
spacing
:
_margins
RowLayout
{
Layout.fillWidth
:
false
Layout.alignment
:
Qt
.
AlignHCenter
width
:
_comboFieldWidth
height
:
baseFontEdit
.
height
*
1.5
visible
:
_appFontPointSize
.
visible
QGCLabel
{
text
:
qsTr
(
"
Font Size:
"
)
}
Layout.alignment
:
Qt
.
AlignVCenter
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.verticalCenter
:
parent
.
verticalCenter
QGCButton
{
Layout.preferredWidth
:
height
Layout.preferredHeight
:
baseFontEdit
.
height
width
:
height
height
:
baseFontEdit
.
height
*
1.5
text
:
"
-
"
anchors.verticalCenter
:
parent
.
verticalCenter
onClicked
:
{
if
(
_appFontPointSize
.
value
>
_appFontPointSize
.
min
)
{
_appFontPointSize
.
value
=
_appFontPointSize
.
value
-
1
}
}
}
FactTextField
{
QGCLabel
{
id
:
baseFontEdit
Layout.preferredWidth
:
_valueFieldWidth
fact
:
QGroundControl
.
settingsManager
.
appSettings
.
appFontPointSize
width
:
ScreenTools
.
defaultFontPixelWidth
*
6
text
:
(
QGroundControl
.
settingsManager
.
appSettings
.
appFontPointSize
.
value
/
ScreenTools
.
platformFontPointSize
*
100
).
toFixed
(
0
)
+
"
%
"
horizontalAlignment
:
Text
.
AlignHCenter
anchors.verticalCenter
:
parent
.
verticalCenter
}
Text
{
}
QGCButton
{
Layout.preferredWidth
:
height
Layout.preferredHeight
:
baseFontEdit
.
height
width
:
height
height
:
baseFontEdit
.
height
*
1.5
text
:
"
+
"
anchors.verticalCenter
:
parent
.
verticalCenter
onClicked
:
{
if
(
_appFontPointSize
.
value
<
_appFontPointSize
.
max
)
{
_appFontPointSize
.
value
=
_appFontPointSize
.
value
+
1
...
...
@@ -256,6 +253,23 @@ Rectangle {
}
}
}
}
}
}
Item
{
id
:
miscColItem
anchors.margins
:
_margins
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
comboGridItem
.
bottom
anchors.topMargin
:
ScreenTools
.
defaultFontPixelHeight
height
:
miscCol
.
height
ColumnLayout
{
id
:
miscCol
anchors.horizontalCenter
:
parent
.
horizontalCenter
spacing
:
_margins
FactCheckBox
{
text
:
qsTr
(
"
Use Vehicle Pairing
"
)
...
...
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