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
c9419973
Commit
c9419973
authored
Sep 07, 2017
by
Jacob Walser
Committed by
Willian Galvani
Nov 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add FactTextFieldSlider control
parent
95750936
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
0 deletions
+159
-0
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
FactTextFieldSlider.qml
src/FactSystem/FactControls/FactTextFieldSlider.qml
+157
-0
qmldir
src/FactSystem/FactControls/qmldir
+1
-0
No files found.
qgroundcontrol.qrc
View file @
c9419973
...
...
@@ -146,6 +146,7 @@
<file alias="QGroundControl/FactControls/FactTextFieldGrid.qml">src/FactSystem/FactControls/FactTextFieldGrid.qml</file>
<file alias="QGroundControl/FactControls/FactTextFieldRow.qml">src/FactSystem/FactControls/FactTextFieldRow.qml</file>
<file alias="QGroundControl/FactControls/FactValueSlider.qml">src/FactSystem/FactControls/FactValueSlider.qml</file>
<file alias="QGroundControl/FactControls/FactTextFieldSlider.qml">src/FactSystem/FactControls/FactTextFieldSlider.qml</file>
<file alias="QGroundControl/FactControls/qmldir">src/FactSystem/FactControls/qmldir</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<file alias="QGroundControl/FlightDisplay/FlightDisplayViewMap.qml">src/FlightDisplay/FlightDisplayViewMap.qml</file>
...
...
src/FactSystem/FactControls/FactTextFieldSlider.qml
0 → 100644
View file @
c9419973
import
QtQuick
2.7
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.4
import
QtQuick
.
Layouts
1.2
import
QGroundControl
.
FactSystem
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
FactControls
1.0
Row
{
id
:
sliderRoot
width
:
parent
.
width
property
Fact
fact
:
null
property
var
_factValue
:
fact
?
fact
.
value
:
null
property
bool
_loadComplete
:
false
property
real
_range
:
Math
.
abs
(
fact
.
max
-
fact
.
min
)
property
real
_minIncrement
:
_range
/
50
property
int
precision
:
2
on_FactValueChanged
:
{
slide
.
value
=
fact
.
value
}
Component.onCompleted
:
{
slide
.
minimumValue
=
fact
.
min
slide
.
maximumValue
=
fact
.
max
slide
.
value
=
fact
.
value
_loadComplete
=
true
}
// Used to find width of value string
QGCLabel
{
id
:
textMeasure
visible
:
false
text
:
fact
.
value
.
toFixed
(
precision
)
}
// Param name, value, description and slider adjustment
Column
{
id
:
sliderColumn
width
:
parent
.
width
spacing
:
_margins
/
2
// Param name and value
Row
{
spacing
:
_margins
QGCLabel
{
text
:
fact
.
name
font.family
:
ScreenTools
.
demiboldFontFamily
font.pointSize
:
ScreenTools
.
defaultFontPointSize
*
1.1
anchors.verticalCenter
:
parent
.
verticalCenter
}
// Row container for Value: xx.xx +/- (different spacing than parent)
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.verticalCenter
:
parent
.
verticalCenter
QGCLabel
{
text
:
"
Value:
"
anchors.verticalCenter
:
parent
.
verticalCenter
}
FactTextField
{
anchors.verticalCenter
:
parent
.
verticalCenter
fact
:
sliderRoot
.
fact
showUnits
:
false
showHelp
:
false
text
:
fact
.
value
.
toFixed
(
precision
)
width
:
textMeasure
.
width
+
ScreenTools
.
defaultFontPixelWidth
*
2
// Fudged, nothing else seems to work
}
QGCLabel
{
text
:
fact
.
units
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCButton
{
height
:
parent
.
height
width
:
height
text
:
"
-
"
anchors.verticalCenter
:
parent
.
verticalCenter
onClicked
:
fact
.
value
=
Math
.
max
(
Math
.
min
(
fact
.
value
-
_minIncrement
,
fact
.
max
),
fact
.
min
)
}
QGCButton
{
height
:
parent
.
height
width
:
height
text
:
"
+
"
anchors.verticalCenter
:
parent
.
verticalCenter
onClicked
:
fact
.
value
=
Math
.
max
(
Math
.
min
(
fact
.
value
+
_minIncrement
,
fact
.
max
),
fact
.
min
)
}
}
// Row - container for Value: xx.xx +/- (different spacing than parent)
}
// Row - Param name and value
QGCLabel
{
text
:
fact
.
shortDescription
}
// Slider, with minimum and maximum values labeled
Row
{
width
:
parent
.
width
spacing
:
_margins
QGCLabel
{
id
:
minLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
fact
.
min
.
toFixed
(
precision
)
horizontalAlignment
:
Text
.
AlignRight
}
QGCSlider
{
id
:
slide
width
:
parent
.
width
-
minLabel
.
width
-
maxLabel
.
width
-
_margins
*
2
stepSize
:
fact
.
increment
?
Math
.
max
(
fact
.
increment
,
_minIncrement
)
:
_minIncrement
tickmarksEnabled
:
true
onValueChanged
:
{
if
(
_loadComplete
)
{
if
(
Math
.
abs
(
fact
.
value
-
value
)
>=
_minIncrement
)
{
// prevent binding loop
fact
.
value
=
value
}
}
}
MouseArea
{
anchors.fill
:
parent
onWheel
:
{
// do nothing
wheel
.
accepted
=
true
;
}
onPressed
:
{
// propogate/accept
mouse
.
accepted
=
false
;
}
onReleased
:
{
// propogate/accept
mouse
.
accepted
=
false
;
}
}
}
// Slider
QGCLabel
{
id
:
maxLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
10
text
:
fact
.
max
.
toFixed
(
precision
)
}
}
// Row - Slider with minimum and maximum values labeled
}
// Column - Param name, value, description and slider adjustment
}
// Row
src/FactSystem/FactControls/qmldir
View file @
c9419973
...
...
@@ -9,3 +9,4 @@ FactTextField 1.0 FactTextField.qml
FactTextFieldGrid 1.0 FactTextFieldGrid.qml
FactTextFieldRow 1.0 FactTextFieldRow.qml
FactValueSlider 1.0 FactValueSlider.qml
FactTextFieldSlider 1.0 FactTextFieldSlider.qml
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