Stop Button from stealing focus
I can't figure out how to avoid buttons stealing focus in QML/QtQuick.
For example, suppose (simplified case) I have a
Button(Qt Quick Controls 2). Initially the
TextFieldis focused for entry. Then, when the button is clicked, I do not want to remove focus from the
How can stop the focus from changing when the
I understood that setting
focus: truerequests focus, but setting it to
falsedoesn't seem to stop focusing. I've tried to set it back to false on
onActiveFocusChangedto no avail. Also, wrapping the
focus: falsedoesn't have any effect either: clicking the button still unfocuses the
Appreciate any insight into how to solve the problem.
(PS: In the actual application, any of many controls in the UI could have focus when the button is clicked and I'd like not to steal the focus from whichever is focused. Hence, solutions requiring keeping track of what is focused somehow are less desirable)
To answer my own question :)
Buttonand the behaviour is as desired!