Index: sources/gui/qml/components/RangeSlider.qml =================================================================== diff -u -raac9d5d70abbd8d75c6e3782722e5daaf7355153 -r74fa9686a916c53d1549fa3733d200edb9df9d3b --- sources/gui/qml/components/RangeSlider.qml (.../RangeSlider.qml) (revision aac9d5d70abbd8d75c6e3782722e5daaf7355153) +++ sources/gui/qml/components/RangeSlider.qml (.../RangeSlider.qml) (revision 74fa9686a916c53d1549fa3733d200edb9df9d3b) @@ -118,6 +118,19 @@ font.bold : false } + function incrementMax(vInStepSegments) { + updateMaxValue(vInStepSegments, true) + } + function decrementMax(vInStepSegments) { + updateMaxValue(vInStepSegments, false) + } + + function incrementMin(vInStepSegments) { + updateMinValue(vInStepSegments, true) + } + function decrementMin(vInStepSegments) { + updateMinValue(vInStepSegments, false) + } /// /// \brief grays out the rangebar and handler if not adjusted and hasAdjust set to true /// @@ -218,7 +231,7 @@ function checkLimitsMinValueBounds ( vValue ) { if ( vValue < minValueLowerBound ) { minValue = minValueLowerBound; return } if ( vValue > minValueUpperBound ) { minValue = minValueUpperBound; return } - setMinvalue(vValue) + setMinValue(vValue) } function checkLimitsMaxValueBounds ( vValue ) { @@ -227,7 +240,7 @@ setMaxValue(vValue) } - function setMinvalue(vValue) { + function setMinValue(vValue) { minAdjusted = true minValue = vValue } @@ -237,6 +250,38 @@ maxValue = vValue } + // This is a helper function that will calculate and return a new value + // that was either incremented or decremented by 1 or step amount + function determineNewValue(vOldValue, vInStepSegments, vIsIncrementing) { + let amountChanged = 1 + if (vInStepSegments) { + amountChanged = step + } + + let newValue = Number.NaN + if(vIsIncrementing) { + newValue = vOldValue + amountChanged + } else { + newValue = vOldValue - amountChanged + } + + // Capping values based on min/max threshold + if ( newValue < minimum ) newValue = minimum + if ( newValue > maximum ) newValue = maximum + + return newValue.toFixed(decimal) + } + + function updateMaxValue(vInStepSegments, vIsIncrementing) { + let newMaxValue = determineNewValue(_root.maxValue, vInStepSegments, vIsIncrementing) + setMaxValue(newMaxValue) + } + + function updateMinValue(vInStepSegments, vIsIncrementing) { + let newMinValue = determineNewValue(_root.minValue, vInStepSegments, vIsIncrementing) + setMinValue(newMinValue) + } + /// The main range rectangle bar - This is the "highlighted" area of the slider RangeRect { id: _rangeRect property alias lowerBound : _rangeRect.minimum