mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 23:29:07 +08:00
Fix qml binding loops
This commit is contained in:
parent
84002a70d0
commit
6fa4dd0a97
@ -188,7 +188,11 @@ Item
|
||||
Item {
|
||||
id: buttonsRow
|
||||
height: abortButton.height
|
||||
width: Math.min(childrenRect.width, base.width - 2 * UM.Theme.getSize("sidebar_margin").width)
|
||||
width: {
|
||||
// using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect
|
||||
var children_width = additionalComponentsRow.width + pauseResumeButton.width + abortButton.width + 3 * UM.Theme.getSize("default_margin").width;
|
||||
return Math.min(children_width, base.width - 2 * UM.Theme.getSize("sidebar_margin").width);
|
||||
}
|
||||
anchors.top: progressBar.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
|
||||
anchors.right: parent.right
|
||||
|
@ -91,7 +91,19 @@ Item {
|
||||
|
||||
Item {
|
||||
id: saveRow
|
||||
width: Math.min(childrenRect.width + UM.Theme.getSize("sidebar_margin").width, base.width - UM.Theme.getSize("sidebar_margin").width)
|
||||
width: {
|
||||
// using childrenRect.width directly causes a binding loop, because setting the width affects the childrenRect
|
||||
var children_width = UM.Theme.getSize("default_margin").width;
|
||||
for (var index in children)
|
||||
{
|
||||
var child = children[index];
|
||||
if(child.visible)
|
||||
{
|
||||
children_width += child.width + child.anchors.rightMargin;
|
||||
}
|
||||
}
|
||||
return Math.min(children_width, base.width - UM.Theme.getSize("sidebar_margin").width);
|
||||
}
|
||||
height: saveToButton.height
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height
|
||||
@ -102,7 +114,7 @@ Item {
|
||||
id: additionalComponentsRow
|
||||
anchors.top: parent.top
|
||||
anchors.right: saveToButton.visible ? saveToButton.left : parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user