mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Fixed view selector header not updating correctly
CURA-5785
This commit is contained in:
parent
0cdcd61ff2
commit
d74393498b
1 changed files with 14 additions and 9 deletions
|
@ -54,22 +54,27 @@ Item
|
||||||
{
|
{
|
||||||
for (var i = 0; i < viewModel.rowCount(); i++)
|
for (var i = 0; i < viewModel.rowCount(); i++)
|
||||||
{
|
{
|
||||||
if (viewModel.getItem(i).active)
|
if (viewModel.items[i].active)
|
||||||
{
|
{
|
||||||
return viewModel.getItem(i)
|
return viewModel.items[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Nothing was active, so just return the first one (the list is sorted by priority, so the most
|
return null
|
||||||
// important one should be returned)
|
|
||||||
return viewModel.getItem(0)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that the controller is synced with whatever happend here.
|
Component.onCompleted:
|
||||||
onActiveViewChanged: UM.Controller.setActiveView(activeView.id)
|
{
|
||||||
|
// 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
headerItem: Label
|
headerItem: Label
|
||||||
{
|
{
|
||||||
text: viewSelector.activeView.name
|
text: viewSelector.activeView ? viewSelector.activeView.name : ""
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
height: parent.height
|
height: parent.height
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
@ -98,7 +103,7 @@ Item
|
||||||
text: name
|
text: name
|
||||||
radius: UM.Theme.getSize("default_radius").width
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: active
|
checked: viewSelector.activeView != null ? viewSelector.activeView.id == id : false
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
viewSelector.togglePopup()
|
viewSelector.togglePopup()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue