[Interest] TextField QML auto keyboard hiding/lose focus on touch events
md at rpzdesign.com
md at rpzdesign.com
Mon Jan 25 19:48:39 CET 2016
Gian:
Thank you for the input.
I tried it a little bit and found that mousearea onPressed would not
trigger up past Loader, so as a universal pattern it will not work.
In fact, many controls (Listview,etc) suck up the mouse events when
those mouse/touch events SHOULD cause the keyboard to retract.
I am going to put a registration into my custom controls that
application wide will register themselves -> onFocusFocusChanged:
C++Invokable(thisqmlobject,thisqmlobject.activefocus)
and every time a specific control gains focus, it will register itself
and then I will filter on events to compare the QMouseEvent/QTouchEvent
with the registered QObject* (Qml Item) to see whether the keyboard
should retract.
This will separate my code from all the event snarfing components in the
QML item stack.
I think this is a PC legacy behavior not suited to touch.
Thanks,
md
On 1/25/2016 11:20 AM, Gian Maxera wrote:
> Hello Mark,
> I achieve that on mobile using a simple MouseArea that cover all the screen and it’s under all other active elements.
> When that MouseArea is touched, I call Qt.inputMethod.hide() … and that’s it.
> So, if the user touch outside any button, textfield, etc… then that touch will reach the underlying MouseArea that will call the hide on keyboard.
>
> Ciao,
> Gianluca.
>
>
>> On 25 Jan 2016, at 17:16, mark diener <rpzrpzrpz at gmail.com> wrote:
>>
>> Hello List:
>>
>> Anybody have a tip or suggestion for IOS/Android Qt 5.5.1 -> Qt 5.6.0 Beta
>>
>> I am using a TextField and the keyboard pops up whenever the input control
>> receives focus.
>>
>> But I want the TextField to lose focus whenever you click/touch
>> outside of the control.
>>
>> Not Just Tab & Enter that are VERY PC centric, not tablet/smartphone concepts.
>>
>> Right now, the blinking cursor remains on the field and the
>> Android/IOS keyboard remains visible
>> when you use your finger and touch some where outside of the TextField.
>>
>> Obviously, I want the keyboard to REMAIN if the user clicks on ANOTHER
>> TextField.
>>
>> Is there a QML way to do this?
>>
>> I have some C++ and event filter ideas to make this happen, but those
>> are brute force ideas and there might be something that I don't see in
>> the QML TextField documentation.
>>
>> Thanks,
>>
>> md
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list