Avoid processing invalid input in Contact List example
Originally, the onAccepted handler was designed to simply emit the finished signal whenever the OK button was clicked, without any checks. This meant that the dialog would proceed even if some fields were left blank. Now we just check that the strings are not empty before emitting. Fixes: QTBUG-119147 Pick-to: 6.5 6.6 Change-Id: Ie8d3a711e139ac824a45cb5c6cfd39248a7bf117 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
d6335043e1
commit
b51ba46225
|
@ -41,5 +41,9 @@ Dialog {
|
|||
id: form
|
||||
}
|
||||
|
||||
onAccepted: finished(form.fullName.text, form.address.text, form.city.text, form.number.text)
|
||||
onAccepted: {
|
||||
if (form.fullName.text && form.address.text && form.city.text && form.number.text) {
|
||||
finished(form.fullName.text, form.address.text, form.city.text, form.number.text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue