Skip to content

Commit

Permalink
chore: make it possible to customize/remove the back button
Browse files Browse the repository at this point in the history
  • Loading branch information
caybro committed Apr 4, 2023
1 parent 3252eaf commit c964e99
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions ui/StatusQ/src/StatusQ/Popups/StatusStackModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ StatusModal {
readonly property int itemsCount: stackLayout.count
readonly property var currentItem: stackLayout.currentItem

property Item backButton: StatusBackButton {
visible: replaceItem || stackLayout.currentIndex > 0
onClicked: {
if (replaceItem) {
replaceItem = null;
} else {
let prevAction = stackLayout.currentItem.prevAction
stackLayout.currentIndex--;
if (typeof(prevAction) == "function") {
prevAction()
}
}
}
}

property Item nextButton: StatusButton {
text: qsTr("Next")
onClicked: root.currentIndex++
Expand Down Expand Up @@ -52,21 +67,7 @@ StatusModal {
? replaceLoader.item.title : stackTitle
padding: 16

leftButtons: StatusBackButton {
id: backButton
visible: replaceItem || stackLayout.currentIndex > 0
onClicked: {
if (replaceItem) {
replaceItem = null;
} else {
let prevAction = stackLayout.currentItem.prevAction
stackLayout.currentIndex--;
if (typeof(prevAction) == "function") {
prevAction()
}
}
}
}
leftButtons: [ backButton ]

rightButtons: [ nextButton, finishButton ]

Expand Down

0 comments on commit c964e99

Please sign in to comment.