mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-12-01 06:41:06 -07:00
Fix the simulation view not being selected as default
CURA-6028
This commit is contained in:
parent
c4700b2752
commit
1b3cb32334
1 changed files with 16 additions and 9 deletions
|
|
@ -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
|
||||||
|
|
||||||
property var activeView:
|
|
||||||
{
|
{
|
||||||
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:
|
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…
Add table
Add a link
Reference in a new issue