Index: sources/gui/qml/components/MainMenu.qml =================================================================== diff -u -rc9f8f8cf3c6c37fc6460d8675c62c9442c4d4263 -r65bff6538499d8a7592f5b664982b69d90d102c2 --- sources/gui/qml/components/MainMenu.qml (.../MainMenu.qml) (revision c9f8f8cf3c6c37fc6460d8675c62c9442c4d4263) +++ sources/gui/qml/components/MainMenu.qml (.../MainMenu.qml) (revision 65bff6538499d8a7592f5b664982b69d90d102c2) @@ -31,6 +31,7 @@ } property var titles : [] + property var visibleItems : [] property bool hidden : false property int position : MainMenu.Position.Bottom property bool hasRightText : false @@ -54,8 +55,17 @@ } } - onCurrentIndexChanged: itemPressed(currentIndex) + function isItemVisible ( vIndex ) { + return visibleItems [ vIndex ] !== false // used "!== false" to cover undefined as true. + } + function emit_itemPressed ( vIndex ) { + if ( isItemVisible ( vIndex ) ) + itemPressed ( vIndex ) + } + + onCurrentIndexChanged: emit_itemPressed(currentIndex) + /*! * this section olds somkind of the private sections of the object * this section is used as the calculation section whcih soppose not to be changed by user. @@ -109,18 +119,18 @@ animated : false width : partitionWidth height : parent.height - text.text : modelData + text.text : isItemVisible(index) ? modelData : "" // didn't change the visibility to preserve the button location and just didn't display the title and highlihgt bar. border.width: 0 onPressed: { - itemPressed(index) + emit_itemPressed(index) } } } } // the right outer most text with vertical line as a separator Line { - visible: hasRightText + visible: hasRightText && isItemVisible(_rightTouchRect.index) orientation: Line.Orientation.Vertical length: parent.height - rightTextGaps anchors.right: _rightTouchRect.left @@ -132,10 +142,10 @@ visible : hasRightText width : partitionWidth + rightTextGaps height : parent.height - text.text : _private.rightText + text.text : isItemVisible(index) ? _private.rightText : "" // didn't change the visibility to preserve the button location and just didn't display the title and highlihgt bar. border.width: 0 onPressed: { - itemPressed(index) + emit_itemPressed(index) } anchors.right: parent.right anchors.rightMargin: parent.rightPdding