1313{
1414 id: stageMenu
1515
16- property var messageStack
17- property var stagesListContainer
18- property var applicationLogo
19-
2016 property bool is40
2117 property bool isLE44
2218 property bool isLE46
2319
24- property bool prepareStageActive: UM .Controller .activeStage .toString ().indexOf (" PrepareStage" ) > 0
20+ property bool prepareStageActive: Qt .binding (function ()
21+ {
22+ return UM .Controller .activeStage .toString ().indexOf (" PrepareStage" ) > 0
23+ })
2524 property bool preSlicedData: PrintInformation !== null && PrintInformation .preSliced
2625 property bool settingsVisible: UM .Preferences .getValue (" view/settings_visible" )
2726 property bool settingsDocked: UM .Preferences .getValue (" sidebargui/docked_sidebar" )
6463 viewOrientationControls .anchors .margins = 0
6564
6665 // adjust message stack position for sidebar
66+ var messageStack
6767 if (is40)
6868 {
69- messageStack = base .contentItem .children [0 ].children [3 ].children [7 ] // declared as property above
69+ messageStack = base .contentItem .children [0 ].children [3 ].children [7 ]
7070 }
7171 else if (isLE44)
7272 {
73- messageStack = base .contentItem .children [2 ].children [3 ].children [7 ] // declared as property above
73+ messageStack = base .contentItem .children [2 ].children [3 ].children [7 ]
7474 }
7575 else
7676 {
77- messageStack = base .contentItem .children [2 ].children [3 ].children [8 ] // declared as property above
77+ messageStack = base .contentItem .children [2 ].children [3 ].children [8 ]
7878 }
7979 messageStack .anchors .horizontalCenter = undefined
8080 messageStack .anchors .left = messageStack .parent .left
81- messageStack .anchors .leftMargin = Math .floor ((base .width - printSetupSelector .width ) / 2 )
81+ messageStack .anchors .leftMargin = Qt .binding (function ()
82+ {
83+ return Math .floor ((base .width - printSetupSelector .width ) / 2 )
84+ })
8285
8386 // adjust stages menu position for sidebar
84- stagesListContainer = mainWindowHeader .children [1 ] // declared as property above
87+ var stagesListContainer = mainWindowHeader .children [1 ]
8588 stagesListContainer .anchors .horizontalCenter = undefined
8689 stagesListContainer .anchors .left = stagesListContainer .parent .left
87- stagesListContainer .anchors .leftMargin = Math .floor ((base .width - printSetupSelector .width - stagesListContainer .width ) / 2 )
90+ stagesListContainer .anchors .leftMargin = Qt .binding (function ()
91+ {
92+ return Math .floor ((base .width - printSetupSelector .width - stagesListContainer .width ) / 2 )
93+ })
94+
8895
8996 // hide application logo if there is no room for it
90- applicationLogo = mainWindowHeader .children [0 ] // declared as property above
91- applicationLogo .visible = stagesListContainer .anchors .leftMargin > applicationLogo .width + 2 * UM .Theme .getSize (" default_margin" ).width
97+ var applicationLogo = mainWindowHeader .children [0 ]
98+ applicationLogo .visible = Qt .binding (function ()
99+ {
100+ return stagesListContainer .anchors .leftMargin > applicationLogo .width + 2 * UM .Theme .getSize (" default_margin" ).width
101+ })
92102
93103 // compensate viewport for full-height sidebar
94- base .viewportRect = Qt .rect (0 , 0 , (base .width - sidebarWidth) / base .width , 1.0 )
104+ base .viewportRect = Qt .binding (function ()
105+ {
106+ return Qt .rect (0 , 0 , (base .width - sidebarWidth) / base .width , 1.0 )
107+ })
108+
95109
96110 // make settingview take up available height
97111 var printSetupContent = printSetupSelector .contentItem
@@ -136,25 +150,6 @@ Item
136150 printSetupTooltip = tooltip // defined in Cura.qml
137151 }
138152
139- Connections
140- {
141- target: base
142- onWidthChanged:
143- {
144- // compensate viewport for full-height sidebar
145- base .viewportRect = Qt .rect (0 , 0 , (base .width - sidebarWidth) / base .width , 1.0 )
146-
147- // adjust message stack position for sidebar
148- messageStack .anchors .leftMargin = Math .floor ((base .width - printSetupSelector .width ) / 2 )
149-
150- // adjust stages menu position for sidebar
151- stagesListContainer .anchors .leftMargin = Math .floor ((base .width - printSetupSelector .width - stagesListContainer .width ) / 2 )
152-
153- // hide application logo if there is no room for it
154- applicationLogo .visible = stagesListContainer .anchors .leftMargin > applicationLogo .width + 2 * UM .Theme .getSize (" default_margin" ).width
155- }
156- }
157-
158153 Connections
159154 {
160155 target: UM .Preferences
@@ -174,15 +169,6 @@ Item
174169 }
175170 }
176171
177- Connections
178- {
179- target: UM .Controller
180- onActiveStageChanged:
181- {
182- prepareStageActive = (UM .Controller .activeStage .toString ().indexOf (" PrepareStage" ) == 0 )
183- }
184- }
185-
186172 Connections
187173 {
188174 target: tooltip
0 commit comments