mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-02 15:21:15 -07:00
Pull mode list model out of SidebarHeader and put it into Sidebar
This helps with code readability
This commit is contained in:
parent
e53e74d093
commit
0c156fdf42
2 changed files with 12 additions and 8 deletions
|
|
@ -48,6 +48,7 @@ UM.AngledCornerRectangle {
|
|||
|
||||
addMachineAction: base.addMachineAction;
|
||||
configureMachinesAction: base.configureMachinesAction;
|
||||
modesModel: modesListModel;
|
||||
}
|
||||
|
||||
Loader {
|
||||
|
|
@ -56,7 +57,7 @@ UM.AngledCornerRectangle {
|
|||
Layout.fillWidth: true;
|
||||
Layout.fillHeight: true;
|
||||
|
||||
source: header.currentModeFile;
|
||||
source: modesListModel.get(header.currentModeIndex).file;
|
||||
|
||||
property Item sidebar: base;
|
||||
|
||||
|
|
@ -86,4 +87,10 @@ UM.AngledCornerRectangle {
|
|||
SidebarTooltip {
|
||||
id: tooltip;
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: modesListModel;
|
||||
ListElement { text: QT_TR_NOOP("Simple"); file: "SidebarSimple.qml" }
|
||||
ListElement { text: QT_TR_NOOP("Advanced"); file: "SidebarAdvanced.qml" }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import UM 1.0 as UM
|
|||
Column {
|
||||
id: base;
|
||||
|
||||
property string currentModeFile: modeModel.get(modeMenu.currentIndex).file;
|
||||
property variant modesModel;
|
||||
property alias currentModeIndex: modeMenu.currentIndex;
|
||||
property Action addMachineAction;
|
||||
property Action configureMachinesAction;
|
||||
|
||||
|
|
@ -28,7 +29,7 @@ Column {
|
|||
}
|
||||
|
||||
ToolButton {
|
||||
text: qsTr(modeModel.get(modeMenu.currentIndex).text);
|
||||
text: base.modesModel ? qsTr(base.modesModel.get(modeMenu.currentIndex).text) : "";
|
||||
|
||||
style: UM.Theme.styles.sidebar_header_button;
|
||||
|
||||
|
|
@ -40,11 +41,7 @@ Column {
|
|||
property int currentIndex: 0;
|
||||
|
||||
Instantiator {
|
||||
model: ListModel {
|
||||
id: modeModel;
|
||||
ListElement { text: QT_TR_NOOP("Simple"); file: "SidebarSimple.qml" }
|
||||
ListElement { text: QT_TR_NOOP("Advanced"); file: "SidebarAdvanced.qml" }
|
||||
}
|
||||
model: base.modesModel;
|
||||
|
||||
MenuItem {
|
||||
text: qsTr(model.text);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue