Prevent the setting items from being recreated every stage switch

CURA-5785
This commit is contained in:
Jaime van Kessel 2018-11-19 11:42:04 +01:00
parent 6fe89e3d54
commit a490e420f0
3 changed files with 27 additions and 16 deletions

View file

@ -13,6 +13,7 @@ Item
signal showTooltip(Item item, point location, string text) signal showTooltip(Item item, point location, string text)
signal hideTooltip() signal hideTooltip()
UM.I18nCatalog UM.I18nCatalog
{ {
id: catalog id: catalog
@ -71,7 +72,7 @@ Item
{ {
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width - 2 * UM.Theme.getSize("default_lining").width Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width
} }
// Separator line // Separator line
@ -82,17 +83,14 @@ Item
color: UM.Theme.getColor("lining") color: UM.Theme.getColor("lining")
} }
Cura.PrintSetupSelector Item
{ {
id: printSetupSelector id: printSetupSelectorItem
// This is a work around to prevent the printSetupSelector from having to be re-loaded every time
onShowTooltip: prepareMenu.showTooltip(item, location, text) // a stage switch is done.
onHideTooltip: prepareMenu.hideTooltip() children: [printSetupSelector]
height: childrenRect.height
Layout.minimumWidth: UM.Theme.getSize("print_setup_widget").width width: childrenRect.width
Layout.maximumWidth: UM.Theme.getSize("print_setup_widget").width
Layout.fillWidth: true
Layout.fillHeight: true
} }
} }
} }

View file

@ -138,12 +138,14 @@ Item
color: UM.Theme.getColor("lining") color: UM.Theme.getColor("lining")
} }
Cura.PrintSetupSelector Item
{ {
width: UM.Theme.getSize("print_setup_widget").width id: printSetupSelectorItem
height: parent.height // This is a work around to prevent the printSetupSelector from having to be re-loaded every time
onShowTooltip: previewMenu.showTooltip(item, location, text) // a stage switch is done.
onHideTooltip: previewMenu.hideTooltip() children: [printSetupSelector]
height: childrenRect.height
width: childrenRect.width
} }
} }
} }

View file

@ -40,6 +40,7 @@ UM.MainWindow
tooltip.hide(); tooltip.hide();
} }
Component.onCompleted: Component.onCompleted:
{ {
CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size")) CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
@ -249,6 +250,16 @@ UM.MainWindow
height: UM.Theme.getSize("stage_menu").height height: UM.Theme.getSize("stage_menu").height
source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : "" source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : ""
// The printSetupSelector is defined here so that the setting list doesn't need to get re-instantiated
// Every time the stage is changed.
property var printSetupSelector: Cura.PrintSetupSelector
{
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
width: UM.Theme.getSize("print_setup_widget").width
height: UM.Theme.getSize("stage_menu").height
}
} }
UM.MessageStack UM.MessageStack