I also needed this but there was no answer for it anywhere.
Here is my solution:
Dialog {
id: loginDialog
title: "Login"
modal: true
LoginDialog {
id: loginPage
anchors.fill: parent
}
footer: DialogButtonBox {
id: buttons
Button {
id: okButton
text: qsTr("Ok")
DialogButtonBox.buttonRole: DialogButtonBox.InvalidRole
Connections {
target: okButton
function onClicked() {
if (CONDITION){
loginDialog.accept()
} else {
}
}
}
}
Button {
id: cancelButton
text: qsTr("Cancel")
DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
}
}
}
So my answer is replace standard buttons and handle button clicks yourself.