[Interest] [SOLVED] Re: TextField Focus onReleased
rpzrpzrpz at gmail.com
rpzrpzrpz at gmail.com
Sat Apr 23 13:00:15 CEST 2016
On 4/22/2016 8:26 PM, mark diener wrote:
> Hello:
>
> Can anybody figure out a way for a TextField which contains its own MouseArea
> to allow the TextField to gain focus when the onReleased event is
> called, not the normal behavior of focus gained when the onPressed is
> triggered.
>
> Any response appreciated,
>
> md
>
Ok, the inheritance nature of QML is not the prettiest, but there is a solution.
To take control of the focus timing and delay focus upon MouseArea -> onPressed, you must test if the control has focus, if not,
set a state pressed flag and return with mouse.accepted = true.
In the onReleased, again have mouse.accepted = true, and set focus to the control.
But now that the control has focus, you must have mouse.accepted = false for both Pressed and Released.
This is kind of a kluge, but that is the way you do it.
Hope it helps someone.
md
More information about the Interest
mailing list