Qt/QML 5.6.0, Android virtual keyboard + AA_EnableHighDpiScaling problem



  • Normally, when you have a TextField and you select it for text input, the Android virtual keyboard pops up, and the text field control is magically raised above the keyboard so you can see what you are typing. This works fine, until you enable AA_EnableHighDpiScaling. In this case, the control is covered and you can't see what you are typing. Is there a workaround for this? Btw: I tried it with Qt labs controls, same thing happens.

    Here is a minimal example:

    main.cpp

    #include <QGuiApplication>
    #include <QQmlApplicationEngine>
    
    int main(int argc, char *argv[])
    {
        QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
        QGuiApplication app(argc, argv);
        
        QQmlApplicationEngine engine;
        engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
        
        return app.exec();
    }
    

    main.qml

    import QtQuick 2.6
    import QtQuick.Controls 1.5
    import QtQuick.Dialogs 1.2
    
    ApplicationWindow {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        
        TextField {
            width:parent.width
            anchors.bottom: parent.bottom
        }
    }
    


  • I found a simple workaround (it doesn't quite "fix it" because the app works a bit differently, but at least the input areas are visible when the keyboard is visible in hdpi scaling mode):

    in AndroidManifest.xml, add in your activity section:

    <activity android:windowSoftInputMode="adjustResize">

    I guess android is selecting the "adjustPan" mode for some reason, and it just doesn't workout right in some cases.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.