buttons: first focus, than emit clicked() signal

Otherwise a client wanting to give another QML component the focus in
reaction to a clicked button has no chance doing so because the button
will steal the focus again right after the event handler has finished
executing.

REVIEW: 104893
This commit is contained in:
Sebastian Gottfried 2012-04-23 19:29:57 +02:00
parent 26e1276738
commit 5b567230e6
2 changed files with 2 additions and 2 deletions

View File

@ -123,8 +123,8 @@ Item {
button.checked = !button.checked
}
button.clicked()
button.forceActiveFocus()
button.clicked()
}
}

View File

@ -128,7 +128,6 @@ Item {
button.checked = !button.checked
}
button.clicked()
if (button.KeyNavigation.tab || button.KeyNavigation.backtab) {
// Only focus the button if it is set up for keyboard
// navigation. This avoid getting a strange focus frame around
@ -136,6 +135,7 @@ Item {
// a toolbar.
button.forceActiveFocus();
}
button.clicked()
if (defaultAction) {
defaultAction.trigger()