mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 03:55:56 +08:00
Merge pull request #4986 from Ultimaker/CURA-6028_preview_stage_doesnt_switch
Cura 6028 preview stage doesnt switch
This commit is contained in:
commit
d435f21193
@ -54,16 +54,23 @@ Item
|
||||
{
|
||||
text: model.name.toUpperCase()
|
||||
checkable: true
|
||||
checked: model.active
|
||||
checked: model.id == UM.Controller.activeStage.stageId
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
exclusiveGroup: mainWindowHeaderMenuGroup
|
||||
style: UM.Theme.styles.main_window_header_tab
|
||||
height: UM.Theme.getSize("main_window_header_button").height
|
||||
onClicked: UM.Controller.setActiveStage(model.id)
|
||||
iconSource: model.stage.iconSource
|
||||
|
||||
property color overlayColor: "transparent"
|
||||
property string overlayIconSource: ""
|
||||
|
||||
// This is a trick to assure the activeStage is correctly changed. It doesn't work propertly if done in the onClicked (see CURA-6028)
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: UM.Controller.setActiveStage(model.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ Item
|
||||
{
|
||||
target: Cura.QualityProfilesDropDownMenuModel
|
||||
onItemsChanged: qualityModel.update()
|
||||
onDataChanged: qualityModel.update()
|
||||
}
|
||||
|
||||
Connections {
|
||||
|
@ -14,24 +14,28 @@ Cura.ExpandablePopup
|
||||
contentPadding: UM.Theme.getSize("default_lining").width
|
||||
contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
|
||||
|
||||
property var viewModel: UM.ViewModel { }
|
||||
|
||||
property var activeView:
|
||||
property var viewModel: UM.ViewModel
|
||||
{
|
||||
for (var i = 0; i < viewModel.count; i++)
|
||||
onDataChanged: updateActiveView()
|
||||
}
|
||||
|
||||
property var activeView: null
|
||||
|
||||
function updateActiveView()
|
||||
{
|
||||
for (var index in viewModel.items)
|
||||
{
|
||||
if (viewModel.items[i].active)
|
||||
if (viewModel.items[index].active)
|
||||
{
|
||||
return viewModel.items[i]
|
||||
activeView = viewModel.items[index]
|
||||
return
|
||||
}
|
||||
}
|
||||
return null
|
||||
activeView = null
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
// Nothing was active, so just return the first one (the list is sorted by priority, so the most
|
||||
// important one should be returned)
|
||||
if (activeView == null)
|
||||
{
|
||||
UM.Controller.setActiveView(viewModel.getItem(0).id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user