Scale instead of center for preview/prepare-menus. [CURA-6478]

This commit is contained in:
Remco Burema 2019-04-25 21:50:24 +02:00
parent bd262ca6c4
commit c4265c1f67
4 changed files with 26 additions and 25 deletions

View file

@ -20,11 +20,19 @@ Item
name: "cura" name: "cura"
} }
anchors
{
left: parent.left
right: parent.right
leftMargin: UM.Theme.getSize("wide_margin").width
rightMargin: UM.Theme.getSize("wide_margin").width
}
// Item to ensure that all of the buttons are nicely centered. // Item to ensure that all of the buttons are nicely centered.
Item Item
{ {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width width: parent.width - 2 * UM.Theme.getSize("wide_margin").width
height: parent.height height: parent.height
RowLayout RowLayout
@ -32,9 +40,9 @@ Item
id: itemRow id: itemRow
anchors.left: openFileButton.right anchors.left: openFileButton.right
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
width: Math.round(0.9 * prepareMenu.width)
height: parent.height height: parent.height
spacing: 0 spacing: 0

View file

@ -20,15 +20,24 @@ Item
name: "cura" name: "cura"
} }
anchors
{
left: parent.left
right: parent.right
leftMargin: UM.Theme.getSize("wide_margin").width
rightMargin: UM.Theme.getSize("wide_margin").width
}
Row Row
{ {
id: stageMenuRow id: stageMenuRow
anchors.centerIn: parent
height: parent.height
width: childrenRect.width
// We want this row to have a preferred with equals to the 85% of the parent anchors.horizontalCenter: parent.horizontalCenter
property int preferredWidth: Math.round(0.85 * previewMenu.width) width: parent.width - 2 * UM.Theme.getSize("wide_margin").width
height: parent.height
// // We want this row to have a preferred with up to the 85% of the parent
// property int preferredWidth: Math.round(0.85 * previewMenu.width)
Cura.ViewsSelector Cura.ViewsSelector
{ {
@ -49,12 +58,12 @@ Item
color: UM.Theme.getColor("lining") color: UM.Theme.getColor("lining")
} }
// This component will grow freely up to complete the preferredWidth of the row. // This component will grow freely up to complete the width of the row.
Loader Loader
{ {
id: viewPanel id: viewPanel
height: parent.height height: parent.height
width: source != "" ? (stageMenuRow.preferredWidth - viewsSelector.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width) : 0 width: source != "" ? (previewMenu.width - viewsSelector.width - printSetupSelectorItem.width - 2 * (UM.Theme.getSize("wide_margin").width + UM.Theme.getSize("default_lining").width)) : 0
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 : ""
} }

View file

@ -81,9 +81,6 @@ Item
// Prefix used for the dragged position preferences. Preferences not used if empty. Don't translate! // Prefix used for the dragged position preferences. Preferences not used if empty. Don't translate!
property string dragPreferencesNamePrefix: "" property string dragPreferencesNamePrefix: ""
// Whether this component can remain when switchin from one stage to the other (for ex. 'Prepare' to 'Preview')
property bool isMultiStage: false
function toggleContent() function toggleContent()
{ {
contentContainer.visible = !expanded contentContainer.visible = !expanded
@ -328,18 +325,6 @@ Item
updateDragPosition(); updateDragPosition();
} }
Connections
{
target: UM.Controller
onActiveStageChanged:
{
if (isMultiStage)
{
updateDragPosition();
}
}
}
// DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item. // DO NOT MOVE UP IN THE CODE: This connection has to be here, after the definition of the content item.
// Apparently the order in which these are handled matters and so the height is correctly updated if this is here. // Apparently the order in which these are handled matters and so the height is correctly updated if this is here.
Connections Connections

View file

@ -12,7 +12,6 @@ Cura.ExpandableComponent
id: printSetupSelector id: printSetupSelector
dragPreferencesNamePrefix: "view/settings" dragPreferencesNamePrefix: "view/settings"
isMultiStage: true
property bool preSlicedData: PrintInformation.preSliced property bool preSlicedData: PrintInformation.preSliced