Search code examples
androidandroid-virtual-keyboardqtvirtualkeyboardqt5.15

Soft keyboard is not visible on Android with Qt 5.15 on any input


We migrated from 5.12.9 to 5.15.2 and now soft Android keyboard is not visible (does not popup) on active focus for any of our inputs or text fields. Is it a bug (QTBUG-88069) or some workaround exists?

Following Stackoverflow solution or setting/clearing window flags does not work for me.


Solution

  • So the problem was obvious because of following lines:

    #ifdef Q_OS_LINUX
        qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
    #endif
    

    Changed to

    #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
        qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
    #endif
    

    as on Android both constants are defined: Q_OS_LINUX and Q_OS_ANDROID. And voila: Android keyboard works! :)