mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 23:15:52 +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()
|
text: model.name.toUpperCase()
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: model.active
|
checked: model.id == UM.Controller.activeStage.stageId
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
exclusiveGroup: mainWindowHeaderMenuGroup
|
exclusiveGroup: mainWindowHeaderMenuGroup
|
||||||
style: UM.Theme.styles.main_window_header_tab
|
style: UM.Theme.styles.main_window_header_tab
|
||||||
height: UM.Theme.getSize("main_window_header_button").height
|
height: UM.Theme.getSize("main_window_header_button").height
|
||||||
onClicked: UM.Controller.setActiveStage(model.id)
|
|
||||||
iconSource: model.stage.iconSource
|
iconSource: model.stage.iconSource
|
||||||
|
|
||||||
property color overlayColor: "transparent"
|
property color overlayColor: "transparent"
|
||||||
property string overlayIconSource: ""
|
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
|
target: Cura.QualityProfilesDropDownMenuModel
|
||||||
onItemsChanged: qualityModel.update()
|
onItemsChanged: qualityModel.update()
|
||||||
|
onDataChanged: qualityModel.update()
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -14,24 +14,28 @@ Cura.ExpandablePopup
|
|||||||
contentPadding: UM.Theme.getSize("default_lining").width
|
contentPadding: UM.Theme.getSize("default_lining").width
|
||||||
contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
|
contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
|
||||||
|
|
||||||
property var viewModel: UM.ViewModel { }
|
property var viewModel: UM.ViewModel
|
||||||
|
{
|
||||||
|
onDataChanged: updateActiveView()
|
||||||
|
}
|
||||||
|
|
||||||
property var activeView:
|
property var activeView: null
|
||||||
|
|
||||||
|
function updateActiveView()
|
||||||
{
|
{
|
||||||
for (var i = 0; i < viewModel.count; i++)
|
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:
|
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)
|
if (activeView == null)
|
||||||
{
|
{
|
||||||
UM.Controller.setActiveView(viewModel.getItem(0).id)
|
UM.Controller.setActiveView(viewModel.getItem(0).id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user