mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 01:29:00 +08:00
Fix the simulation view not being selected as default
CURA-6028
This commit is contained in:
parent
c4700b2752
commit
1b3cb32334
@ -14,24 +14,31 @@ 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
|
updateActiveView()
|
||||||
// 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