Browse Source

PhotoVideoControl.qml: fix Slider setting some facts to minimum:

Sliders with a non 0 minimum value have this
issue where the default minimum is 0, so if
setting a new minimum value changes, and thus
we have an onValueChanged, setting the value
of the slider to minimum even before
onCompleted, so if they need to be initialized
to something it doesn't work.

This commit fixes it setting a bool variable
so onValueChanged doesn't take effect until
initialized
QGC4.4
davidsastresas 4 years ago committed by Don Gagne
parent
commit
b52c86cf1b
  1. 15
      src/FlightMap/Widgets/PhotoVideoControl.qml

15
src/FlightMap/Widgets/PhotoVideoControl.qml

@ -467,8 +467,19 @@ Rectangle { @@ -467,8 +467,19 @@ Rectangle {
stepSize: parent._fact.increment
visible: parent._isSlider
updateValueWhileDragging: false
onValueChanged: parent._fact.value = value
Component.onCompleted: value = parent._fact.value
property bool initialized: false
onValueChanged: {
if (!initialized) {
return
}
parent._fact.value = value
}
Component.onCompleted: {
value = parent._fact.value
initialized = true
}
}
QGCSwitch {
checked: parent._fact ? parent._fact.value : false

Loading…
Cancel
Save