[Interest] [qt-android][qt-iOS] Is it possible to disable page scrolling when software keyboard is being shown?

Mike Krus mike.krus at kdab.com
Wed Apr 27 14:02:10 CEST 2016


the trick I used in the past is to:
- put a MouseArea as a child of the TextField to stop the focus becoming active
- onClicked, move the TextField to some location, outside where the kb will be
  positioned, can use Qt.inputMethod.keyboardRectangle to figure out the size of that
  (not sure it’s always correct though)
- when your animation finishes, set the focus explicitly in the text field, causing
  the keyboard to appear

If you decompose your animation in two, you can set the focus earlier, as long
as your text field never ends up under the keyboard

Then detect keyboard dismissal (Qt.inputMethod.visible) to move the text field back into place.

A lot of work…


> On 21 Apr 2016, at 09:30, Liang Jian <jianliang79 at gmail.com> wrote:
> Hello everyone,    
>     One of the page in our qml app have an input box(such as a TextEdit element)
> at the bottom, when user press the input box the software keyboard will show,
> and we want the background of the page keep still while the input box scroll
> to the top of software keyboard.
>      The current Qt implementation will always scroll the whole page which make
> it impossible to implement this behaviour. We have to use native UI element to
> implement this(in both android and iOS) which require too much code.
> Is it possible to disable page scrolling while showing software keyboard?
>     If that is possible then we can implement this behaviour easily.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

Mike Krus | mike.krus at kdab.com | Senior Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel: UK +44-1625-809908   Mobile: +44 7833 491941
KDAB - The Qt Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3859 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160427/03ee9813/attachment.bin>

More information about the Interest mailing list