Index: sources/gui/qml/components/TouchRect.qml =================================================================== diff -u -r56e378f7504701b9e9a9dccaf205aef2fd52c58e -r4fab8841b1040c8eaa406713ff9bdc8c65b7b6ac --- sources/gui/qml/components/TouchRect.qml (.../TouchRect.qml) (revision 56e378f7504701b9e9a9dccaf205aef2fd52c58e) +++ sources/gui/qml/components/TouchRect.qml (.../TouchRect.qml) (revision 4fab8841b1040c8eaa406713ff9bdc8c65b7b6ac) @@ -6,8 +6,8 @@ * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * \file TouchRect.qml - * \author (last) Behrouz NemaiPour - * \date (last) 15-Jun-2020 + * \author (last) Peter Lucia + * \date (last) 06-Oct-2020 * \author (original) Behrouz NematiPour * \date (original) 18-Oct-2019 * @@ -33,6 +33,8 @@ property int duration : 200 property bool disabled : false + property bool selectable : false + property bool selected : false property color textColor : Colors.textButton property color borderColor : Colors.borderButton @@ -82,10 +84,26 @@ color: textColor font.pixelSize: Fonts.fontPixelButton } + + function setSelected(isSelected) { + _root.selected = isSelected + if (_root.selected) { + _root.color = Colors.backgroundButtonSelectDark + } + else { + _root.color = backgroundColor + } + } + MouseArea { id: _mouseArea anchors.fill: parent onClicked : { if ( disabled ) { return } + if (selectable) { + setSelected(!selected) + _root.clicked() + return + } animate(true) _root.clicked() }