Link anchors differently

Once this is in a scroll view, the width of the parent box isn't fixed any more. We'd have a lot of binding loops. So now this linking is not dependent on the parent width any more but rather on the theme sizes.

Contributes to issue CURA-4148.
This commit is contained in:
Ghostkeeper 2017-08-31 09:35:27 +02:00
parent 831a91afff
commit 95ba4b9368
No known key found for this signature in database
GPG Key ID: C5F96EE2BC0F7E75

View File

@ -31,7 +31,7 @@ Item
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
width: base.width * .45 - UM.Theme.getSize("sidebar_margin").width width: UM.Theme.getSize("sidebar").width * .45 - UM.Theme.getSize("sidebar_margin").width
height: childrenRect.height height: childrenRect.height
Text Text
@ -53,7 +53,7 @@ Item
id: infillCellRight id: infillCellRight
height: childrenRect.height; height: childrenRect.height;
width: base.width * .55 width: UM.Theme.getSize("sidebar").width * .55
spacing: UM.Theme.getSize("sidebar_margin").width spacing: UM.Theme.getSize("sidebar_margin").width
@ -248,22 +248,12 @@ Item
} }
} }
Item
{
id: helpersCell
anchors.top: infillCellRight.bottom
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2
anchors.left: parent.left
anchors.right: parent.right
height: childrenRect.height
Text Text
{ {
id: enableSupportLabel id: enableSupportLabel
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.verticalCenter: enableSupportCheckBox.verticalCenter anchors.verticalCenter: enableSupportCheckBox.verticalCenter
width: parent.width * .45 - 3 * UM.Theme.getSize("sidebar_margin").width
text: catalog.i18nc("@label", "Generate Support"); text: catalog.i18nc("@label", "Generate Support");
font: UM.Theme.getFont("default"); font: UM.Theme.getFont("default");
color: UM.Theme.getColor("text"); color: UM.Theme.getColor("text");
@ -274,8 +264,9 @@ Item
id: enableSupportCheckBox id: enableSupportCheckBox
property alias _hovered: enableSupportMouseArea.containsMouse property alias _hovered: enableSupportMouseArea.containsMouse
anchors.top: parent.top anchors.top: infillCellRight.bottom
anchors.left: enableSupportLabel.right anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2
anchors.left: infillCellRight.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
style: UM.Theme.styles.checkbox; style: UM.Theme.styles.checkbox;
@ -313,7 +304,6 @@ Item
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.verticalCenter: supportExtruderCombobox.verticalCenter anchors.verticalCenter: supportExtruderCombobox.verticalCenter
width: parent.width * .45 - 3 * UM.Theme.getSize("sidebar_margin").width
text: catalog.i18nc("@label", "Support Extruder"); text: catalog.i18nc("@label", "Support Extruder");
font: UM.Theme.getFont("default"); font: UM.Theme.getFont("default");
color: UM.Theme.getColor("text"); color: UM.Theme.getColor("text");
@ -351,9 +341,9 @@ Item
return 0; return 0;
} }
} }
anchors.left: supportExtruderLabel.right anchors.left: infillCellRight.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
width: parent.width * .55 width: UM.Theme.getSize("sidebar").width * .55
height: height:
{ {
if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1)) if ((supportEnabled.properties.value == "True") && (machineExtruderCount.properties.value > 1))
@ -412,7 +402,6 @@ Item
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
anchors.verticalCenter: adhesionCheckBox.verticalCenter anchors.verticalCenter: adhesionCheckBox.verticalCenter
width: parent.width * .45 - 3 * UM.Theme.getSize("sidebar_margin").width
text: catalog.i18nc("@label", "Build Plate Adhesion"); text: catalog.i18nc("@label", "Build Plate Adhesion");
font: UM.Theme.getFont("default"); font: UM.Theme.getFont("default");
color: UM.Theme.getColor("text"); color: UM.Theme.getColor("text");
@ -426,7 +415,7 @@ Item
anchors.top: supportExtruderCombobox.bottom anchors.top: supportExtruderCombobox.bottom
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2 anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2
anchors.left: adhesionHelperLabel.right anchors.left: infillCellRight.left
anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width anchors.leftMargin: UM.Theme.getSize("sidebar_margin").width
//: Setting enable printing build-plate adhesion helper checkbox //: Setting enable printing build-plate adhesion helper checkbox
@ -481,7 +470,6 @@ Item
id: extruders id: extruders
onModelChanged: populateExtruderModel() onModelChanged: populateExtruderModel()
} }
}
function populateExtruderModel() function populateExtruderModel()
{ {
@ -499,7 +487,7 @@ Item
Item Item
{ {
id: tipsCell id: tipsCell
anchors.top: helpersCell.bottom anchors.top: adhesionCheckBox.bottom
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2 anchors.topMargin: UM.Theme.getSize("sidebar_margin").height * 2
anchors.left: parent.left anchors.left: parent.left
width: parent.width width: parent.width