Make the stage menu in the preview using 85 percent of the total width in order to prevent the print setup panel to be in the middle

This commit is contained in:
Diego Prado Gesto 2018-12-11 15:19:40 +01:00
parent 742fc34e75
commit c804610fa6
3 changed files with 54 additions and 43 deletions

View File

@ -2,6 +2,7 @@
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7 import QtQuick 2.7
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import UM 1.3 as UM import UM 1.3 as UM
@ -19,56 +20,67 @@ Item
name: "cura" name: "cura"
} }
// Item to ensure that all of the buttons are nicely centered.
Row Item
{ {
id: stageMenuRow anchors.horizontalCenter: parent.horizontalCenter
anchors.centerIn: parent width: stageMenuRow.width
height: parent.height height: parent.height
Cura.ViewsSelector RowLayout
{ {
id: viewsSelector id: stageMenuRow
width: Math.round(0.85 * previewMenu.width)
height: parent.height height: parent.height
width: UM.Theme.getSize("views_selector").width spacing: 0
headerCornerSide: Cura.RoundedRectangle.Direction.Left
}
// Separator line Cura.ViewsSelector
Rectangle {
{ id: viewsSelector
height: parent.height headerCornerSide: Cura.RoundedRectangle.Direction.Left
// If there is no viewPanel, we only need a single spacer, so hide this one. Layout.minimumWidth: UM.Theme.getSize("views_selector").width
visible: viewPanel.source != "" Layout.maximumWidth: UM.Theme.getSize("views_selector").width
width: visible ? UM.Theme.getSize("default_lining").width : 0 Layout.fillWidth: true
Layout.fillHeight: true
}
color: UM.Theme.getColor("lining") // Separator line
} Rectangle
{
height: parent.height
// If there is no viewPanel, we only need a single spacer, so hide this one.
visible: viewPanel.source != ""
width: UM.Theme.getSize("default_lining").width
Loader color: UM.Theme.getColor("lining")
{ }
id: viewPanel
height: parent.height
width: childrenRect.width
source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : ""
}
// Separator line Loader
Rectangle {
{ id: viewPanel
height: parent.height Layout.fillHeight: true
width: UM.Theme.getSize("default_lining").width Layout.fillWidth: true
color: UM.Theme.getColor("lining") 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 : ""
}
Item // Separator line
{ Rectangle
id: printSetupSelectorItem {
// This is a work around to prevent the printSetupSelector from having to be re-loaded every time height: parent.height
// a stage switch is done. width: UM.Theme.getSize("default_lining").width
children: [printSetupSelector] color: UM.Theme.getColor("lining")
height: childrenRect.height }
width: childrenRect.width
Item
{
id: printSetupSelectorItem
// This is a work around to prevent the printSetupSelector from having to be re-loaded every time
// a stage switch is done.
children: [printSetupSelector]
height: childrenRect.height
width: childrenRect.width
}
} }
} }
} }

View File

@ -15,7 +15,6 @@ Cura.ExpandableComponent
{ {
id: base id: base
width: UM.Theme.getSize("layerview_menu_size").width
contentHeaderTitle: catalog.i18nc("@label", "Color scheme") contentHeaderTitle: catalog.i18nc("@label", "Color scheme")
Connections Connections

View File

@ -380,7 +380,7 @@
"machine_selector_widget_content": [25.0, 32.0], "machine_selector_widget_content": [25.0, 32.0],
"machine_selector_icon": [2.66, 2.66], "machine_selector_icon": [2.66, 2.66],
"views_selector": [16.0, 4.5], "views_selector": [23.0, 4.0],
"printer_type_label": [3.5, 1.5], "printer_type_label": [3.5, 1.5],
@ -450,7 +450,7 @@
"slider_handle": [1.5, 1.5], "slider_handle": [1.5, 1.5],
"slider_layerview_size": [1.0, 26.0], "slider_layerview_size": [1.0, 26.0],
"layerview_menu_size": [15, 20], "layerview_menu_size": [16.0, 4.0],
"layerview_legend_size": [1.0, 1.0], "layerview_legend_size": [1.0, 1.0],
"layerview_row": [11.0, 1.5], "layerview_row": [11.0, 1.5],
"layerview_row_spacing": [0.0, 0.5], "layerview_row_spacing": [0.0, 0.5],