Index: sources/gui/qml/components/MainMenu.qml =================================================================== diff -u -rcbf070d3a5b274700f8831ab50dd95986a533477 -rd4b731494a05087a763afff95b91c675bb417347 --- sources/gui/qml/components/MainMenu.qml (.../MainMenu.qml) (revision cbf070d3a5b274700f8831ab50dd95986a533477) +++ sources/gui/qml/components/MainMenu.qml (.../MainMenu.qml) (revision d4b731494a05087a763afff95b91c675bb417347) @@ -27,57 +27,32 @@ 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 : isMainTreatment ? _mainTreatmentModel.get(index).screen : 0 - property color statusColor : Colors.transparent + readonly property int currentScreen : model.get(index).screen ?? 0 width : parent.width height : Variables.mainMenuHeight color : _root.backgroundColor clip : true - enum TreatmentScreen { - Treatment = 0, - Trends = 1, - Heparin = 2, - HDF = 3 - } - gradient: Gradient { GradientStop { position: 0.2; color: Qt.lighter(Colors.backgroundMain, 1.2) } GradientStop { position: 0.8; color: Qt.darker (Colors.backgroundMain, 1.2) } } signal itemPressed(int vIndex) - ListModel { id: _mainTreatmentModel - ListElement { text: qsTr("Treatment"); visible: true; screen: 0 } // MainMenu.Treatment - ListElement { text: qsTr("Trends"); visible: true; screen: 1 } // MainMenu.Trends - ListElement { text: qsTr("Heparin"); visible: true; screen: 2 } // MainMenu.Heparin - ListElement { text: qsTr("HDF"); visible: false; screen: 3 } // MainMenu.HDF - } - - ListModel { id: _mainMenuModel - ListElement { text: qsTr("Treatment") ; visible: true } - ListElement { text: qsTr("Prescriptions") ; visible: true } - ListElement { text: qsTr("Settings") ; visible: true } - } - 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 @@ -110,7 +85,7 @@ objectName : "delegateControl" width : ListView.view.count ? _delegateControl.visible ? ListView.view.width / ListView.view.count : 0 : 0 height : ListView.view.height - visible : model.screen === MainMenu.Heparin ? vSettings.heparinSyringePump : model.visible + visible : model.visible TouchRect { id : _touchRect objectName: "_touchRect" + index @@ -120,7 +95,7 @@ border.width: 0 pixelSize : titlePixelSize - Rectangle { id: _heparinStatus + Rectangle { id: _status anchors { left : parent.left leftMargin : Variables.defaultMargin * 2 @@ -131,8 +106,7 @@ height : 15 width : height radius : height - visible : _root.isMainTreatment && model.screen === MainMenu.Heparin - color : _root.statusColor + color : model.statusColor ?? Colors.transparent } onPressed: {