QML physical keyboard open/closed detection and correct VKB usage for TextInput
For my app I have a settings screen and right at the bottom of the screen there is QML TextInput element. When clicking it the VKB opens but the virtual keyboard (VKB) hides the TextInput; so I added a Flickable element around my settings screen, and when the TextInput gets focus I scroll the flickable up to make the TextInput visible on top of the VKB.
However there are some issues with this approach:
- on N950 if the physical keyboard is open, the VKB will not appear when the TextInput is clicked (that's OK) however with my current code I am still scrolling the parent Flickable, even though this is now not necessary anymore. So is there a way to find out if the PHYSICAL keyboard is open on QML (even on C++ side)?
- The VKB is open and the TextInput has focus and scrolled on top; now if I press anywhere outside the TextInput the Flickable screen is scrolled to the original position so that now the TextInput element is back where it was originally (at the bottom of the screen) but now it is hidden by the VKB which now it is still open and the TextInput still has the focus. I can live with this behavior, this would be a way for the user to signal that it finished typing in the TextInput; so the user could say I'm finish typing in the TextInput by pressing the Return key on VKB or pressing anywhere in the screen outside the textInput and outside of VKB. But how do I detect now that the user pressed outside of the TextInput so I can hide the VKB?
- Is there a QML example/sample code that shows how to deal with this scenario? A TextInput that gets hidden when the VKB is open?
Thanks & regards,
Alicemirror last edited by
what platform are you using? It is very strange what you say. As I know the VKB should appear when you touch inside a tex input field and it gains the focus. Thus, the screen is positioned to the field immediately on top of the VKB. Then as you loose the input of the field, the keyboard disappear so you can manage scroll etc.
Are you sure that you have set correctly the focus settings ? I have read in the documentation that it is a critical aspects to have the textual input working correctly.
[quote author="Alicemirror" date="1316520058"]Hello,
Are you sure that you have set correctly the focus settings ? I have read in the documentation that it is a critical aspects to have the textual input working correctly.[/quote]
I think this is fundamental issue with QT, why input fields don't loose focus when user tapped elsewhere?
And what are the "correct focus settings" ?