QT Android Gboard overlaps input fields

118 views Asked by At

Since the last update of the Gboard Qt seems to have issues with detecting it and push input fields above it accordingly. Gboard version: 9.7.09.323382208-tv_release-armeabi-v7a

enter image description here

I have a minimal code example in which it can be easily reproduced:

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12

ApplicationWindow {
    width: 1920
    height: 1080
    visibility: Window.Maximized
    color: "#C0C0C0"

    Item
    {
        width: 1920 * 0.7
        height: 1080 * 0.8
        Item {
            width: parent.width
            height: parent.height * 0.4
            id: we
        }
        TextField
        {
            id: input1
            width: parent.width
            focus: true
            anchors.top: we.bottom
            onAccepted: input2.focus = true

            Keys.onPressed:
            {
                switch (event.key) {
                case Qt.Key_Tab:
                case Qt.Key_Down:
                    event.accepted = true
                    input2.forceActiveFocus()
                    break
                }
            }
        }

        TextInput
        {
            id: input2
            width: parent.width
            anchors.top: input1.bottom
            maximumLength: 40

            Keys.onPressed:
            {
                switch (event.key) {
                case Qt.Key_Tab:
                case Qt.Key_Down:
                    event.accepted = true
                    break

                case Qt.Key_Up:
                    event.accepted = true
                    input1.forceActiveFocus()
                    break
                }
            }
        }
    }
}

I tried to build with Qt versions: 5.12.9, 5.13.2, 5.14.2, 5.15.1 and all have the same issue. However an empty project from Android studio will push the input fields correctly, so the issue must be Qt related.

I also tried to set android:windowSoftInputMode="adjustPan" but it had no effect at all.

What I found is the Qt showSoftwareKeyboard method in QtActivityDelegate.java, I assume it's responsible for displaying the keyboard and adjusting the layouts, so I tried to play around with it a bit (setting some hard-coded values e.g. m_layout.setLayoutParams(m_editText, new QtLayout.LayoutParams(width, 680, 30, 500), false)), rebuild Qt with the changes, but with no success or visible changes, it does print out my custom logs so the changes did apply correctly.

Any ideas how to make it push the input fields?

0

There are 0 answers