Link to USB page without depending on actual order of pages

This is more future-proof. If someone were to add a page to the end, it wouldn't immediately break these buttons any more.

An example of why self-documenting code can be good.

Contributes to issue CURA-8609.
This commit is contained in:
Ghostkeeper 2021-10-06 16:48:52 +02:00
parent d9d83b4334
commit 75c7d5c4f5
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -161,7 +161,7 @@ Window
{
anchors.left: parent.left
text: catalog.i18nc("@button", "Sync materials with USB")
onClicked: swipeView.currentIndex = swipeView.count - 1 //Go to the last page, which is USB.
onClicked: swipeView.currentIndex = removableDriveSyncPage.SwipeView.index
}
Cura.PrimaryButton
{
@ -348,7 +348,7 @@ Window
{
anchors.left: parent.left
text: catalog.i18nc("@button", "Sync materials with USB")
onClicked: swipeView.currentIndex = swipeView.count - 1 //Go to the last page, which is USB.
onClicked: swipeView.currentIndex = removableDriveSyncPage.SwipeView.index
}
Cura.PrimaryButton
{
@ -413,7 +413,7 @@ Window
{
anchors.left: parent.left
text: catalog.i18nc("@button", "Sync materials with USB")
onClicked: swipeView.currentIndex = swipeView.count - 1 //Go to the last page, which is USB.
onClicked: swipeView.currentIndex = removableDriveSyncPage.SwipeView.index
}
Cura.PrimaryButton
{