Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt/QML 5.6.0, Android virtual keyboard + AA_EnableHighDpiScaling problem
Forum Updated to NodeBB v4.3 + New Features

Qt/QML 5.6.0, Android virtual keyboard + AA_EnableHighDpiScaling problem

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 1 Posters 734 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • bchimpB Offline
    bchimpB Offline
    bchimp
    wrote on last edited by
    #1

    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
        }
    }
    
    1 Reply Last reply
    0
    • bchimpB Offline
      bchimpB Offline
      bchimp
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved