Files
pallectrum/electrum/gui/qml/components/wizard/WizardComponent.qml
Sander van Grieken 30079c06a8 qml: handle android back button in wizard, map to prev page action instead of closing wizard.
Also add initial focus to WCHaveSeed and WCHaveMasterKey wizard components.
2023-01-02 17:02:19 +01:00

39 lines
1.0 KiB
QML

import QtQuick 2.0
Item {
id: root
signal next
signal prev
signal accept
property var wizard_data : ({})
property bool valid
property bool last: false
property string title: ''
onAccept: {
apply()
}
// override this in descendants to put data from the view in wizard_data
function apply() { }
function checkIsLast() {
apply()
last = wizard.wiz.isLast(wizard_data)
}
Component.onCompleted: {
// 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)
// move focus to root of WizardComponent, otherwise Android back button
// might be missed in Wizard root Item.
root.forceActiveFocus()
}
}