Index: sources/gui/qml/components/GridSelection.qml =================================================================== diff -u -r5605f930ab5cd1a62b96347f4b4300ef30a830ee -r2ef03b2ce51b4dc507f66e9671953a8e0824bde9 --- sources/gui/qml/components/GridSelection.qml (.../GridSelection.qml) (revision 5605f930ab5cd1a62b96347f4b4300ef30a830ee) +++ sources/gui/qml/components/GridSelection.qml (.../GridSelection.qml) (revision 2ef03b2ce51b4dc507f66e9671953a8e0824bde9) @@ -1,13 +1,13 @@ /*! * - * Copyright (c) 2020-2022 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 GridSelection.qml * \author (last) Behrouz NematiPour - * \date (last) 29-Nov-2021 + * \date (last) 12-Jan-2024 * \author (original) Peter Lucia * \date (original) 25-Sep-2020 * @@ -35,21 +35,33 @@ property int optionWidth : Variables.gridSelectionButtonWidth property alias title : _title.text property var labels : [] + property bool active : false + property bool valid : true readonly property int _itemCount: labels.length readonly property int _rowCount : Math.ceil( _itemCount / _colCount ) readonly property int _colCount : 2 anchors.horizontalCenter: parent.horizontalCenter color : Colors.transparent - height : _root.rowCount * _root.optionHeight + height : _root.rowCount * _root.optionHeight + _title.height + _grid.anchors.topMargin width : _root.colCount * _root.optionWidth signal clicked(int vIndex) + function clear() { + _root.curIndex = -1 + _root.active = false + } + + function reset(vIndex) { + _root.curIndex = vIndex + _root.active = true + } + Text { id : _title text : "" - color : Colors.textMain; + color : _root.valid ? Colors.textMain : Colors.createTreatmentInvalidParam font.pixelSize : Fonts.fontPixelFluidText } @@ -70,13 +82,11 @@ height : _root.optionHeight width : _root.optionWidth radius : Variables.dialogRadius - Binding on selected { - when : _root.curIndex > -1 - value : index === _root.curIndex - } + selected : _root.curIndex > -1 ? index === _root.curIndex : false onClicked: { _root.curIndex = index _root.clicked ( index ) + _root.active = true } } }