2023-07-17 10:49:06 +02:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Controls
|
|
|
|
|
import QtQuick.Controls.Material
|
2021-04-06 01:53:46 +02:00
|
|
|
|
2023-03-06 16:47:19 +01:00
|
|
|
Pane {
|
2023-01-02 17:00:40 +01:00
|
|
|
id: root
|
2021-04-06 01:53:46 +02:00
|
|
|
signal next
|
2024-02-05 11:13:58 +01:00
|
|
|
signal finish
|
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
|
2023-12-11 15:17:45 +01:00
|
|
|
property string wizard_title: ''
|
2022-11-08 17:45:57 +01:00
|
|
|
property string title: ''
|
2023-04-29 13:45:28 +02:00
|
|
|
property bool securePage: false
|
2022-10-04 19:47:29 +02:00
|
|
|
|
2023-03-06 16:47:19 +01:00
|
|
|
leftPadding: constants.paddingXLarge
|
|
|
|
|
rightPadding: constants.paddingXLarge
|
|
|
|
|
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
color: Material.dialogColor
|
2023-09-25 16:58:27 +02:00
|
|
|
TapHandler {
|
|
|
|
|
onTapped: root.forceActiveFocus()
|
|
|
|
|
}
|
2023-03-06 16:47:19 +01:00
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|