mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Make the middle component to have zero width if there is no component to
fill the gap. Contributes to CURA-6020.
This commit is contained in:
parent
635115a879
commit
17f0c12858
1 changed files with 44 additions and 51 deletions
|
@ -20,28 +20,22 @@ Item
|
||||||
name: "cura"
|
name: "cura"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Item to ensure that all of the buttons are nicely centered.
|
Row
|
||||||
Item
|
|
||||||
{
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
width: stageMenuRow.width
|
|
||||||
height: parent.height
|
|
||||||
|
|
||||||
RowLayout
|
|
||||||
{
|
{
|
||||||
id: stageMenuRow
|
id: stageMenuRow
|
||||||
width: Math.round(0.85 * previewMenu.width)
|
anchors.centerIn: parent
|
||||||
height: parent.height
|
height: parent.height
|
||||||
spacing: 0
|
width: childrenRect.width
|
||||||
|
|
||||||
|
// We want this row to have a preferred with equals to the 85% of the parent
|
||||||
|
property int preferredWidth: Math.round(0.85 * previewMenu.width)
|
||||||
|
|
||||||
Cura.ViewsSelector
|
Cura.ViewsSelector
|
||||||
{
|
{
|
||||||
id: viewsSelector
|
id: viewsSelector
|
||||||
|
height: parent.height
|
||||||
|
width: UM.Theme.getSize("views_selector").width
|
||||||
headerCornerSide: Cura.RoundedRectangle.Direction.Left
|
headerCornerSide: Cura.RoundedRectangle.Direction.Left
|
||||||
Layout.minimumWidth: UM.Theme.getSize("views_selector").width
|
|
||||||
Layout.maximumWidth: UM.Theme.getSize("views_selector").width
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Separator line
|
// Separator line
|
||||||
|
@ -50,17 +44,17 @@ Item
|
||||||
height: parent.height
|
height: parent.height
|
||||||
// If there is no viewPanel, we only need a single spacer, so hide this one.
|
// If there is no viewPanel, we only need a single spacer, so hide this one.
|
||||||
visible: viewPanel.source != ""
|
visible: viewPanel.source != ""
|
||||||
width: UM.Theme.getSize("default_lining").width
|
width: visible ? UM.Theme.getSize("default_lining").width : 0
|
||||||
|
|
||||||
color: UM.Theme.getColor("lining")
|
color: UM.Theme.getColor("lining")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This component will grow freely up to complete the preferredWidth of the row.
|
||||||
Loader
|
Loader
|
||||||
{
|
{
|
||||||
id: viewPanel
|
id: viewPanel
|
||||||
Layout.fillHeight: true
|
height: parent.height
|
||||||
Layout.fillWidth: true
|
width: source != "" ? (stageMenuRow.preferredWidth - viewsSelector.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width) : 0
|
||||||
Layout.preferredWidth: stageMenuRow.width - viewsSelector.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width
|
|
||||||
source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : ""
|
source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,5 +76,4 @@ Item
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue