Index: sources/gui/qml/components/MainMenu.qml =================================================================== diff -u -re28183bddebf7383c1bd113e7b8ef4ea11f494fb -r5c21e83a3fdc897cb99ac62e1cec0213f411cd73 --- sources/gui/qml/components/MainMenu.qml (.../MainMenu.qml) (revision e28183bddebf7383c1bd113e7b8ef4ea11f494fb) +++ sources/gui/qml/components/MainMenu.qml (.../MainMenu.qml) (revision 5c21e83a3fdc897cb99ac62e1cec0213f411cd73) @@ -30,14 +30,15 @@ Bottom } - property var titles : [] - property bool hidden : false - property int position : MainMenu.Position.Bottom - property bool hasRightText : false - property int rightTextGaps : 20 - property bool hasLogo : false - property int currentIndex : 0 - property string currentTitle : titles[currentIndex] + property var titles : [] + property bool hidden : false + property int position : MainMenu.Position.Bottom + property bool hasRightText : false + property int rightTextGaps : 20 + property bool hasLogo : false + property int currentIndex : 0 + property string currentTitle : titles[currentIndex] + readonly property var currentItem : _private.items[currentIndex] /*! * \brief Emits when a menu item pressed @@ -46,7 +47,7 @@ signal itemPressed(int vIndex) onItemPressed: { currentIndex = vIndex - _highlightRect.x = _repeater.itemAt(vIndex).x + _highlightRect.x = _private.items[vIndex].x } onCurrentIndexChanged: itemPressed(currentIndex) @@ -59,6 +60,7 @@ readonly property var repeaterTitles: hasRightText ? titles.slice(0,titles.length - 1) : titles readonly property string rightText : titles.length ? titles[titles.length - 1] : "" readonly property int partitionWidth: _row.width / ( _private.repeaterTitles.length * 2 + 1) + property var items : [] } /*! type:int @@ -109,6 +111,7 @@ onPressed: { itemPressed(index) } + Component.onCompleted: _private.items[index] = _touchRect } } } @@ -122,17 +125,19 @@ anchors.verticalCenter: parent.verticalCenter } TouchRect { id : _rightTouchRect + property int index: titles.length ? titles.length - 1 : -1 animated : false visible : hasRightText width : partitionWidth + rightTextGaps height : parent.height text.text : _private.rightText border.width: 0 onPressed: { - itemPressed( titles.length ? titles.length - 1 : -1 ) + itemPressed(index) } anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter + Component.onCompleted: _private.items[index] = _rightTouchRect } // normal text bottom highlighter