Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.13.2
-
None
Description
On iOS, the code in qtbase/src/plugins/platforms/ios/qiosinputcontext.mm will auto scroll the root view such that the input text field that is focused is not obscured by the keyboard. This works pretty well in simple applications but causes difficulties when you want more sophisticated handling. For instance:
1. If you want to anchor a QML toolbar to the top of the keyboard while it is open.
2. If you want to use the Flickable bottomMargin to keep a background showing behind the translucent keyboard instead of black.
3. If you want to use the Flickable bottomMargin so you can allow the content area to scroll fully and/or programmatically bring any different text field into view.
In QML, I would like to just change the Flickable bottomMargin when the keyboard comes up using the information in Qt.inputMethod.keyboardRectangle and am willing to position textfields on my own within the Flickable. However, because the autoscrolling behavior translates the entire root view, I would have to do tricky translations to undo the effects of the root view translation so that the resulting Flickable content area actually lands in the viewable area above the keyboard. On top of that, the amount of translation actually happening is hidden within this class. I think I can back it out by seeing where the bottom of the keyboard is compared to the bottom of my QML root view and also set Flickable topMargin, but that's ugly and seems an error prone way to try and negate the effects of the y translation.
Ideally, I would like some setting on QInputMethod that would let me disable this behavior so I can manage it myself.
In the meantime, can anybody suggest a workaround? It doesn't seem to be possible to modify this behavior on the C++ side without doing a custom build of Qt which I would really like to avoid.
I might be able to throw a category on QIOSKeyboardListener and monkey patch the methods calling scrollToCursor() but that seems pretty ugly and fragile.
Any suggested workarounds that are simple and likely to work?
Attachments
Issue Links
- relates to
-
QTBUG-125323 Android Keyboard hides QML Text Edit Box
- Closed