Index: sources/gui/qml/compounds/TouchGrid.qml =================================================================== diff -u -r5e3b27057e9c7dedf9c46e3881609b7e96c3fb71 -re125bd5cf13750eaf241d518b9c846139afaa81c --- sources/gui/qml/compounds/TouchGrid.qml (.../TouchGrid.qml) (revision 5e3b27057e9c7dedf9c46e3881609b7e96c3fb71) +++ sources/gui/qml/compounds/TouchGrid.qml (.../TouchGrid.qml) (revision e125bd5cf13750eaf241d518b9c846139afaa81c) @@ -26,11 +26,10 @@ Item { id: _root objectName: "_TouchGrid" - property var itemsText : [] property var itemsValue : [] + property var itemsText : [] property var itemsUnit : [] - property var itemsEnabled : [] property var itemsHasImage : [] property var itemsHasLine : [] @@ -54,6 +53,13 @@ height: parent.height + function undef(vValue, vOtherwise) { + if ( vValue === undefined ) { + return vOtherwise + } + return vValue + } + Grid { id: _grid flow: Grid.TopToBottom anchors.centerIn: _root @@ -64,49 +70,56 @@ Repeater { model : _root.itemsText TouchRect { id: _touchItem - clip : true - touchable : _root.itemsTouchable[index] !== undefined ? _root.itemsTouchable[index] : true + clip : true + touchable : undef( _root.itemsTouchable[index], true ) text.anchors.horizontalCenter: undefined - text.leftPadding: Variables.minVGap - text.text : modelData - border.width: 0 - height : _root.itemHeight - width : _root.itemWidth - radius : 5 - enabled : _root.itemsEnabled[index] !== undefined ? _root.itemsEnabled[index] : true - onClicked : _root.itemClicked(index) + text.leftPadding : Variables.minVGap + text.text : modelData + border.width : 0 + height : _root.itemHeight + width : _root.itemWidth + radius : 5 + enabled : undef( _root.itemsEnabled[index], true ) + onClicked : _root.itemClicked(index) + Text { id : _itemsValue + text : undef( _root.itemsValue[index], "") + font.pixelSize : _touchItem.pixelSize + color : _touchItem.fgColor + anchors.left : parent.left + anchors.leftMargin : _root.itemsValueLeftMargin + anchors.verticalCenter : _touchItem.verticalCenter + } + Text { id: _itemsUnit + text : undef( _root.itemsUnit[index], "" ) + font.pixelSize : _touchItem.pixelSize + color : _touchItem.fgColor + anchors.left : parent.left + anchors.leftMargin : _root.itemsUnitLeftMargin + anchors.verticalCenter : _touchItem.verticalCenter + } Image { id: _image - visible : _touchItem.touchable && ( _root.itemsHasImage[index] !== undefined ? _root.itemsHasImage[index] : true ) && _touchItem.enabled && ! _touchItem.isPressed && _root.itemsText[index] + visible : undef( _root.itemsHasImage[index] , true ) + && _touchItem.touchable + && _touchItem.enabled + && ! _touchItem.isPressed + && _root.itemsText[index] anchors.right : _touchItem.right anchors.verticalCenter : _touchItem.verticalCenter - width : Variables.arrowWidth - height : Variables.arrowHeight - source : "qrc:/images/iArrowRight" + width : Variables.arrowWidth + height : Variables.arrowHeight + source : "qrc:/images/iArrowRight" } Line { id: _line - visible : /*_touchItem.enabled &&*/ ( _root.itemsHasLine[index] !== undefined ? _root.itemsHasLine[index] : true ) && ! _touchItem.isPressed && _root.itemsText[index] + visible : undef( _root.itemsHasLine[index], true ) + // && ! _touchItem.isPressed + && _root.itemsText[index] + // && _touchItem.enabled thickness : _root.lineThickness color : _touchItem.enabled ? _root.lineColor : Colors.borderDisableButton anchors.left : _touchItem.left anchors.right : _touchItem.right anchors.bottom : _touchItem.bottom } - Text { id : _itemsValue - text : _root.itemsValue[index] !== undefined ? _root.itemsValue[index] : "" - font.pixelSize : _touchItem.pixelSize - color : _touchItem.fgColor - anchors.left: parent.left - anchors.leftMargin: _root.itemsValueLeftMargin - anchors.verticalCenter: _touchItem.verticalCenter - } - Text { id : _itemsUnit - text : _root.itemsUnit[index] !== undefined ? _root.itemsUnit[index] : "" - font.pixelSize : _touchItem.pixelSize - color : _touchItem.fgColor - anchors.left: parent.left - anchors.leftMargin: _root.itemsUnitLeftMargin - anchors.verticalCenter: _touchItem.verticalCenter - } } } }