Index: sources/gui/qml/components/MainMenu.qml =================================================================== diff -u -r0808e668ca656c86185c3fa69e4a70dbdb4192c9 -rd4b731494a05087a763afff95b91c675bb417347 --- sources/gui/qml/components/MainMenu.qml (.../MainMenu.qml) (revision 0808e668ca656c86185c3fa69e4a70dbdb4192c9) +++ sources/gui/qml/components/MainMenu.qml (.../MainMenu.qml) (revision d4b731494a05087a763afff95b91c675bb417347) @@ -27,13 +27,13 @@ Rectangle { id: _root property alias index : _listView.currentIndex + property alias model : _listView.model property bool hidden : false property bool disable : false property int titlePixelSize : 40 property color backgroundColor : Colors.backgroundMainMenu property int highlightHeight : 10 - property bool isMainMenu : false - property bool isMainTreatment : false + readonly property int currentScreen : model.get(index).screen ?? 0 width : parent.width height : Variables.mainMenuHeight @@ -47,27 +47,12 @@ signal itemPressed(int vIndex) - ListModel { id: _mainTreatmentModel - ListElement { text: qsTr("Treatment") } - ListElement { text: qsTr("Trends") } - ListElement { text: qsTr("Heparin") } - } - - ListModel { id: _mainMenuModel - ListElement { text: qsTr("Treatment") } - ListElement { text: qsTr("Prescriptions") } - ListElement { text: qsTr("Settings") } - } - ListView { id: _listView property alias index : _listView.currentIndex anchors.fill : parent anchors.leftMargin : 30 anchors.rightMargin : anchors.leftMargin - model : isMainMenu ? _mainMenuModel : - isMainTreatment ? _mainTreatmentModel : - null currentIndex : 0 highlightFollowsCurrentItem : true highlightMoveDuration : 500 @@ -89,17 +74,18 @@ bottom: parent.bottom bottomMargin: (height / 2) * -1 } - height: _root.highlightHeight - width: parent.width / 2 - radius: 10 - color: Colors.backgroundButtonSelect + height : _root.highlightHeight + width : parent.width / 2 + radius : 10 + color : Colors.backgroundButtonSelect } } delegate: Item { id: _delegateControl objectName : "delegateControl" - width : ListView.view.count ? ListView.view.width / ListView.view.count : 0 + width : ListView.view.count ? _delegateControl.visible ? ListView.view.width / ListView.view.count : 0 : 0 height : ListView.view.height + visible : model.visible TouchRect { id : _touchRect objectName: "_touchRect" + index @@ -109,6 +95,20 @@ border.width: 0 pixelSize : titlePixelSize + Rectangle { id: _status + anchors { + left : parent.left + leftMargin : Variables.defaultMargin * 2 + top : parent.top + topMargin : 10 + } + + height : 15 + width : height + radius : height + color : model.statusColor ?? Colors.transparent + } + onPressed: { if (_listView.currentIndex !== index) { _listView.currentIndex = index