Index: sources/gui/qml/compounds/TouchGrid.qml =================================================================== diff -u -r65558208e4968de9a5470ff5fda1ee2a9d00c793 -r5e3b27057e9c7dedf9c46e3881609b7e96c3fb71 --- sources/gui/qml/compounds/TouchGrid.qml (.../TouchGrid.qml) (revision 65558208e4968de9a5470ff5fda1ee2a9d00c793) +++ sources/gui/qml/compounds/TouchGrid.qml (.../TouchGrid.qml) (revision 5e3b27057e9c7dedf9c46e3881609b7e96c3fb71) @@ -26,21 +26,34 @@ Item { id: _root objectName: "_TouchGrid" - property var itemsText : [] - property var itemsEnabled : [] - property int itemWidth : 350 - property int itemHeight : 50 - property alias layoutOrder : _grid.flow + property var itemsText : [] + property var itemsValue : [] + property var itemsUnit : [] - property bool hasImage : true - property bool hasLine : true - readonly property int rowCount : 5 // rowCount should be readonly because it depends on the available space on the screen - readonly property int colCount : itemsText.length > rowCount ? Math.ceil(itemsText.length / rowCount) : 1 + property var itemsEnabled : [] + property var itemsHasImage : [] + property var itemsHasLine : [] + property var itemsTouchable : [] + + property int itemWidth : 350 + property int itemHeight : 50 + property alias layoutOrder : _grid.flow + property alias rowSpacing : _grid.rowSpacing + property alias columnSpacing : _grid.columnSpacing + property color lineColor : Colors.borderButtonHalfDarker + property real lineThickness : 1.5 + property real itemsValueLeftMargin : itemWidth / 2 + property real itemsUnitLeftMargin : itemWidth / 4 + + property int rowCount : Math.floor( _root.height / itemHeight ) + property int colCount : itemsText.length > rowCount ? Math.ceil(itemsText.length / rowCount) : 1 readonly property int titleTopMargin: 110 signal itemClicked(int vIndex) + height: parent.height + Grid { id: _grid flow: Grid.TopToBottom anchors.centerIn: _root @@ -51,33 +64,49 @@ Repeater { model : _root.itemsText TouchRect { id: _touchItem + clip : true + touchable : _root.itemsTouchable[index] !== undefined ? _root.itemsTouchable[index] : true text.anchors.horizontalCenter: undefined - text.leftPadding: 15 - + 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) - - Image { - visible : _root.hasImage && _touchItem.enabled && ! _touchItem.isPressed && _root.itemsText[index] + Image { id: _image + visible : _touchItem.touchable && ( _root.itemsHasImage[index] !== undefined ? _root.itemsHasImage[index] : true ) && _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" } - - Line { - visible : hasLine && ! _touchItem.isPressed && _root.itemsText[index] - color : _touchItem.enabled ? Colors.borderButtonHalfDarker : Colors.borderDisableButton + Line { id: _line + visible : /*_touchItem.enabled &&*/ ( _root.itemsHasLine[index] !== undefined ? _root.itemsHasLine[index] : true ) && ! _touchItem.isPressed && _root.itemsText[index] + 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 + } } } }