Index: sources/gui/qml/components/GridSelection.qml =================================================================== diff -u -r2230a5b1b891f47b64165164710aa680ddfc7040 -rdb92783a0a9dab0ddf2b68c51d15b1ae1cb3ddcc --- sources/gui/qml/components/GridSelection.qml (.../GridSelection.qml) (revision 2230a5b1b891f47b64165164710aa680ddfc7040) +++ sources/gui/qml/components/GridSelection.qml (.../GridSelection.qml) (revision db92783a0a9dab0ddf2b68c51d15b1ae1cb3ddcc) @@ -6,10 +6,10 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file RectSelectCreateTreatment.qml - * \author (last) Peter Lucia - * \date (last) 06-Oct-2020 - * \author (original) Peter Lucia - * \date (original) 03-Aug-2020 + * \author (last) Peter Lucia + * \date (last) 06-Oct-2020 + * \author (original) Peter Lucia + * \date (original) 03-Aug-2020 * */ @@ -27,53 +27,52 @@ * \brief A selectable grid of options with customizable number of rows and columns * where only one option is selected by the user */ -Rectangle { - id: _root +Rectangle { id: _root + property int rowCount : 2 + property int colCount : 2 + property int curIndex : -1 + property int optionHeight : Variables.gridSelectionButtonHeight + property int optionWidth : Variables.gridSelectionButtonWidth + property alias title : _title.text + property var labels : [] + anchors.horizontalCenter: parent.horizontalCenter - color: "transparent" - property int numRows : 2 - property int numCols : 2 - property int buttonHeight : Variables.gridSelectionButtonHeight - property int buttonWidth : Variables.gridSelectionButtonWidth - property var buttonNames : [] - property alias name : _text.text - property int selectedIndex : -1 + color : Colors.transparent + height : _root.rowCount * _root.optionHeight + width : _root.colCount * _root.optionWidth - height : numRows * buttonHeight - width : numCols * buttonWidth + signal clicked(int vIndex) - signal buttonClicked(int vIndex) - - Text { id: _text - text : "Title" - color : Colors.textMain; - font.pixelSize: Fonts.fontPixelFluidText + Text { id : _title + text : "" + color : Colors.textMain; + font.pixelSize : Fonts.fontPixelFluidText } - Grid { id: _grid - spacing: 5 + Grid { id : _grid + spacing : 5 anchors { - top : _text.bottom + top : _title.bottom topMargin : Variables.sliderTextMargin } - rows : parent.numRows - columns : parent.numCols - Repeater { id: _repeater - model: buttonNames + rows : _root.rowCount + columns : _root.colCount + Repeater { id : _repeater + model : labels TouchRect { id : _touchRect objectName : _root.objectName + index text.text : modelData selectable : true - height : _root.buttonHeight - width : _root.buttonWidth + height : _root.optionHeight + width : _root.optionWidth radius : Variables.dialogRadius Binding on selected { - when : _root.selectedIndex > -1 - value : index === _root.selectedIndex + when : _root.curIndex > -1 + value : index === _root.curIndex } onClicked: { - _root.selectedIndex = index - buttonClicked(index) + _root.curIndex = index + _root.clicked ( index ) } } }