2021-04-06 01:53:46 +02:00
|
|
|
import QtQuick 2.0
|
|
|
|
|
|
|
|
|
|
Item {
|
2023-01-02 17:00:40 +01:00
|
|
|
id: root
|
2021-04-06 01:53:46 +02:00
|
|
|
signal next
|
2022-09-22 12:43:51 +02:00
|
|
|
signal prev
|
2021-11-29 16:27:33 +01:00
|
|
|
signal accept
|
2021-04-06 01:53:46 +02:00
|
|
|
property var wizard_data : ({})
|
|
|
|
|
property bool valid
|
|
|
|
|
property bool last: false
|
2022-11-08 17:45:57 +01:00
|
|
|
property string title: ''
|
2022-10-04 19:47:29 +02:00
|
|
|
|
|
|
|
|
onAccept: {
|
|
|
|
|
apply()
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-10 00:41:29 +01:00
|
|
|
// override this in descendants to put data from the view in wizard_data
|
2022-10-04 19:47:29 +02:00
|
|
|
function apply() { }
|
2022-11-10 00:41:29 +01:00
|
|
|
|
2022-10-04 19:47:29 +02:00
|
|
|
function checkIsLast() {
|
|
|
|
|
apply()
|
|
|
|
|
last = wizard.wiz.isLast(wizard_data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2022-11-10 00:41:29 +01:00
|
|
|
// NOTE: Use Qt.callLater to execute checkIsLast(), and by extension apply(),
|
|
|
|
|
// otherwise Component.onCompleted handler in descendants is processed
|
|
|
|
|
// _after_ apply() is called, which may lead to setting the wrong
|
|
|
|
|
// wizard_data keys if apply() depends on variables set in descendant
|
|
|
|
|
// Component.onCompleted handler.
|
|
|
|
|
Qt.callLater(checkIsLast)
|
2023-01-02 17:00:40 +01:00
|
|
|
|
|
|
|
|
// move focus to root of WizardComponent, otherwise Android back button
|
|
|
|
|
// might be missed in Wizard root Item.
|
|
|
|
|
root.forceActiveFocus()
|
2022-10-04 19:47:29 +02:00
|
|
|
}
|
|
|
|
|
|
2021-04-06 01:53:46 +02:00
|
|
|
}
|