Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML TextInput and native Keyboard issues


  • Moderators

    Hi everyone,

    I'm facing some issues with TextInput item (QML) and Android

    the input method hint is set to

    inputMethodHints: Qt.ImhFormattedNumbersOnly this works fine. At least on android afaik, it's a known bug that the wrong numpad is called on ios- the one without the minus sign.

    I also do the following calls when the item gets the focus:

              onFocusChanged:{
                    if(focus){
                        focusIn()
                        cursorPosition = 0
                        selectAll()
                        forceActiveFocus()
                        Qt.inputMethod.show()
                    }
                }
    
    1. The problem arises when the textinput gets the focus. Sometimes, and frustratingly not always, an actionbar appears at the top of the screen with copy&past and cutout buttons. This was not the case in Qt 5.7 but it started to appear when I upgraded the app to 5.9 and still exists in 5.11.
      Is there any way to prevent that actionbar to appear? Do I need to write my own call to the nativ keypad, or do I have to create my own virtual keyboard. I would love to use QtVirtualKeyboard modul but that does not exists, out of the box, for android or ios.

    2. When the Keyboard appears, a resize event is triggered, that reduces the height of the screen by a factor of 2. I'm confused by that. I thought the native behaviour would be, to shift the whole app screen, when the focused item would be hidden by the keypad or do nothing when it's not. This forces a flashing of the screen (flash to white and back) and resizes elements to aspect ratios they were'nt desigend for.
      I can force it by setting a minimal size or fixed one to the widgets, but that more or less destroys any dynamic resizing for different screen sizes (differen phones and tablets). The same as problem 1 this is also inconsistent, 50% of all times this happens and 50% it does not.

    Anyone has any suggestions / solutions for these 2 problems?

    I should mention, in case it is relevant, this QML object is part of a QQuickWidget, that lives inside a QMainWindow. The whole work i'm doing is supposed to be an upgrade for legacy code, thats the reason for this approach.

    Greetings.


Log in to reply