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 hideTooltip()
UM.I18nCatalog
{
id: catalog
@ -71,7 +72,7 @@ Item
{
Layout.fillHeight: 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
@ -82,17 +83,14 @@ Item
color: UM.Theme.getColor("lining")
}
Cura.PrintSetupSelector
Item
{
id: printSetupSelector
onShowTooltip: prepareMenu.showTooltip(item, location, text)
onHideTooltip: prepareMenu.hideTooltip()
Layout.minimumWidth: UM.Theme.getSize("print_setup_widget").width
Layout.maximumWidth: UM.Theme.getSize("print_setup_widget").width
Layout.fillWidth: true
Layout.fillHeight: true
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

@ -138,12 +138,14 @@ Item
color: UM.Theme.getColor("lining")
}
Cura.PrintSetupSelector
Item
{
width: UM.Theme.getSize("print_setup_widget").width
height: parent.height
onShowTooltip: previewMenu.showTooltip(item, location, text)
onHideTooltip: previewMenu.hideTooltip()
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

@ -40,6 +40,7 @@ UM.MainWindow
tooltip.hide();
}
Component.onCompleted:
{
CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
@ -249,6 +250,16 @@ UM.MainWindow
height: UM.Theme.getSize("stage_menu").height
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