From 75c7d5c4f5271d62a511b9515c6e352f580b6803 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 6 Oct 2021 16:48:52 +0200 Subject: [PATCH] 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. --- resources/qml/Preferences/Materials/MaterialsSyncDialog.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml index 7a426b836c..e038ac670d 100644 --- a/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml +++ b/resources/qml/Preferences/Materials/MaterialsSyncDialog.qml @@ -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 {