Index: sources/gui/qml/components/RangeBar.qml =================================================================== diff -u -r2230a5b1b891f47b64165164710aa680ddfc7040 -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/gui/qml/components/RangeBar.qml (.../RangeBar.qml) (revision 2230a5b1b891f47b64165164710aa680ddfc7040) +++ sources/gui/qml/components/RangeBar.qml (.../RangeBar.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,15 +1,15 @@ /*! * - * Copyright (c) 2019-2020 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 RangeBar.qml - * \author (last) Behrouz NematiPour - * \date (last) 16-Oct-2020 - * \author (original) Behrouz NematiPour - * \date (original) 27-Jan-2020 + * \file RangeBar.qml + * \author (last) Behrouz NematiPour + * \date (last) 13-Sep-2023 + * \author (original) Behrouz NematiPour + * \date (original) 27-Jan-2020 * */ @@ -32,9 +32,18 @@ property alias rangebar : _rangeRect + QtObject { id: _private + property int val : isOutLower ? min : isOutUpper ? max : value + property int min : minimum + property int max : maximum + property bool isOutLower : value < min + property bool isOutUpper : value > max + property bool isOutRange : isOutLower || isOutUpper + } + property int markerHeight: Variables.rangeMarkerHeightMidle - property color markerColor : markerOutRangeNotify ? (value >= lowerBound && value <= upperBound ? Colors.rangeMarker : Colors.red) : Colors.rangeMarker - property bool markerOutRangeNotify: false + property color markerColor : markerOutRangeNotify ? ( _private.isOutRange ? Colors.red : Colors.rangeMarker) : Colors.rangeMarker + property bool markerOutRangeNotify: true property bool markerVisible : true property int markerBoundHeight : Variables.rangeMarkerHeightShort @@ -55,7 +64,7 @@ minimum : lowerBound maximum : upperBound - minText.visible: true + minText.visible: minimum != maximum // when min==max, only show the maximum label to avoid overlap maxText.visible: true minText.anchors.leftMargin : lowerTextHorizontalCenter ? -minText.width / 2 : 0 @@ -83,7 +92,7 @@ visible: _root.markerVisible decimal: _root.decimal value : parent.value - x : ((parent.width * (parent.value - minimum)) / (maximum - minimum)) + x : ((parent.width * (_private.val - _private.min)) / (_private.max - _private.min)) text.visible: true text.font.pixelSize: _root.markerFontSize hasHandle : true