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

Qt.inputMethod.visible when keyboard invoked from JS in QML WebView



  • Hello,

    My app uses a Summernote editor in a QML WebView component which I am deploying to an Android device.

    When I click in the editor window, the keyboard is displayed, however in some cases the Summernote editor area is at the bottom of the device's screen, which becomes obscurred by the keyboard. I have read here and there that content may or may not be automtically be scrolled to accomodate a keyboard, however for me, that is not happening.

    So, I thought I might catch the visibleChanged() signal which is documented for Qt.inputMethod, and then somehow push the window content up. However, I appear unable to catch the signal.

    I wonder if the root of my problem is that the keyboard is raised as a result of JS within the QML WebView component, and so invalidates Qt support for Qt.inputMethod in this case?

        property bool keyboardAnimating : Qt.inputMethod.animating;
        property bool keyboardVisible : Qt.inputMethod.visible;
    
        onKeyboardVisibleChanged: {
    // this method never called
        }
    

    Any thoughts/help appreciated!

    Chris.



  • I solved this (to an extent) by modifying the AndroidManifest.xml to override the default behaviour for handling window-softkeyboard interaction. Specifically add the following to the <activity> tag:

    android:windowSoftInputMode="stateUnspecified|adjustResize"
    

    Ref: https://developer.android.com/guide/topics/manifest/activity-element#wsoft


Log in to reply