Index: sources/gui/qml/components/RangeSlider.qml =================================================================== diff -u -r0e1e685b6d5e0f837ed42a792f9099f78a018afa -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/gui/qml/components/RangeSlider.qml (.../RangeSlider.qml) (revision 0e1e685b6d5e0f837ed42a792f9099f78a018afa) +++ sources/gui/qml/components/RangeSlider.qml (.../RangeSlider.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2020-2023 Diality Inc. - All Rights Reserved. + * Copyright (c) 2020-2024 Diality Inc. - All Rights Reserved. * \copyright * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file RangeSlider.qml * \author (last) Behrouz NematiPour - * \date (last) 14-Mar-2023 + * \date (last) 31-Mar-2023 * \author (original) Behrouz NematiPour * \date (original) 17-Sep-2020 * @@ -51,6 +51,8 @@ property real maxValueLowerBound : 0 property real maxValueUpperBound : 0 + property bool lowerBoundValid : true + property bool upperBoundValid : true property int curHandler : RangeSlider.HandlerOption.None ///< current active slider handler property int diameter : Variables.progressbarHandler ///< handlers diameter @@ -103,15 +105,15 @@ minimum : 0 maximum : 0 - /// Lable of the minimum of range + /// The label under the rangeSlider for minimum value minText { visible : true anchors.topMargin: Variables.sliderTextMargin font.pixelSize : Fonts.fontPixelSliderMarker font.bold : false } - ///< Lable of the maximum of range + /// The label under the rangeSlider for maximum value maxText { visible : true anchors.topMargin: Variables.sliderTextMargin @@ -120,17 +122,21 @@ } function incrementMax(vInStepSegments) { - updateMaxValue(vInStepSegments, true) + if ( ! maxAdjusted ) { setMaxValue(_root.maxValueUpperBound )} + else { updateMaxValue(vInStepSegments, true )} } function decrementMax(vInStepSegments) { - updateMaxValue(vInStepSegments, false) + if ( ! maxAdjusted ) { setMaxValue(_root.maxValueUpperBound )} + else { updateMaxValue(vInStepSegments, false)} } function incrementMin(vInStepSegments) { - updateMinValue(vInStepSegments, true) + if ( ! minAdjusted ) { setMinValue(_root.minValueLowerBound )} + else { updateMinValue(vInStepSegments, true )} } function decrementMin(vInStepSegments) { - updateMinValue(vInStepSegments, false) + if ( ! minAdjusted ) { setMinValue(_root.minValueLowerBound )} + else { updateMinValue(vInStepSegments, false)} } /// /// \brief grays out the rangebar and handler if not adjusted and hasAdjust set to true @@ -315,6 +321,14 @@ setBound(newX) } + function getColor(vIsActive, vIsValid) { + let color = Colors.textMain + if ( ! vIsValid ) { color = Colors.createTreatmentInvalidParam ; return color } + if ( ! vIsActive ) { color = Colors.textDisableButton ; return color } + return color + } + + /// The main range rectangle bar - This is the "highlighted" area of the slider RangeRect { id: _rangeRect property alias lowerBound : _rangeRect.minimum @@ -332,13 +346,15 @@ decimal : _root.decimal - minText { - visible: false + minText { // The minimum value label above the handle + visible : false anchors.topMargin: -60 + color : _root.getColor((_root.minAdjusted && _root.maxAdjusted), lowerBoundValid) } - maxText { - visible: false + maxText { // the maximum value label above the handle + visible : false anchors.topMargin: -60 + color : _root.getColor((_root.minAdjusted && _root.maxAdjusted), upperBoundValid) } // propagation is not working on drag !