Important: Please read the Qt Code of Conduct -

Use VirtualKeyboard in Android

  • Is it possible to use qtvirtualkeyboard in Android?

    I cloned the qt/virtualkeyboard repo
    checked out 5.10.1
    compiled release build (edited)
    ran make install in the build directory
    I checked the files Qt/5.10.1/android_armv7/plugins/platforminputcontexts/ and Qt/5.10.1/android_armv7/qml/QtQuick/VirtualKeyboard/Styles/ are created
    then built my project and deployed it
    when I run it I still get: module "QtQuick.VirtualKeyboard" is not installed
    I extracted the apk file and the .so plugins where present there in libs directory and assets/--Added-by-androiddeployqt--/qml/QtQuick/VirtualKeyboard/qmldir, etc were there.
    the error message is not informative and I can't see any other error messages in logcat

    Any suggestion?

  • Moderators

    hi @sassanh ,
    from my understanindg VirtualKeyboard is not available for Android and iOS


  • Lifetime Qt Champion

    @sassanh Why do you need it on Android?

  • I'm building a station app and it'd be nice if I could have the custom keyboard for it (I built a custom layout which works on my desktop.)
    I wonder why would it not work on Android?

  • Lifetime Qt Champion

    @sassanh said in Use VirtualKeyboard in Android:

    I wonder why would it not work on Android?

    Probably because Android already has one

  • Moderators

    to be honest I would love for the keyboard to work also on android&iOS,

    because I have a number of textinputs that expect a formated number somewhere between -99.9 and 99.9

    but Qt::ImhFormattedNumbersOnly has, atm., the same functionality as ImhDigitsOnly, meaning no decimal point no minus sign no done button etc.

    Therefore I'm forced to use Qt::ImhPreferNumbers that brings up the whole keyboard, but with the numbers in the top most row.

    Would I be able to use the Virtualkeyboard one could circumvent the whole problem. And it would give it a more unified look across OS'es

  • @jsulm

    1. The one that android "already" has is not customizable.
    2. Qt has the code to provide a virtual keyboard that's fully customizable which works for Desktop and Embedded devices.
    3. Open, I see this tag in head element of the page:
      <title>Qt | Cross-platform software development for embedded & desktop</title>
      which implies that Qt's main feature and main promise is being "Cross-platform"

    So I guess instead of asking "why some code written with Qt should work in some platform?" we should ask "why a particular code written in Qt and present in official Qt releases doesn't work for a particular platform?". If it's working for embedded devices then it looks like someone blocked it to work for Android devices and I wonder why.

    Other than the ability to customize the keyboard, when I compile my apk as a Launcher application in immersive mode and deploy it to my tablet after using my installed keyboards on the device, navigation keys bring back to the screen and don't hide anymore which ruins the whole immersive mode experience. qtvirtualkeyboard could help me with that too.

  • Moderators

    @sassanh said in Use VirtualKeyboard in Android:

    If it's working for embedded devices then it looks like someone blocked it to work for Android devices and I wonder why

    I suppose it's because it would take time and effort to support it on 2 additional platforms. Keyboards are highly platform-specific stuff. And in this case, most people don't need a custom Qt keyboard on Android, so the cost vs. benefit is won by "cost".

    We're investigating porting Qt keyboard to Android in my company currently, if we succeed, perhaps we'll push the changes upstream (not sure if that will be possible at this point, but hopefully yes).

  • @sierdzio , if your company is investigating on it then probably you have evidence that there are obstacles for having qtvirtualkeyboard on Android. I hope you decide to push the changed upstream and it's possible for you to do it. I also hope these changes find their way to next releases of Qt itself.
    Thanks for info.

  • Moderators

    @sassanh said in Use VirtualKeyboard in Android:

    @sierdzio , if your company is investigating on it then probably you have evidence that there are obstacles for having qtvirtualkeyboard on Android

    I don't, at least not yet. We've just started like literally last week :D

    I anticipate huge amount of issues with input events - most probably we'd have to block all input events and handle them internally (because otherwise, Android's keyboard would show up), but that will in turn cause massive amount of issues (sleep timer not resetting, copy paste not working etc.). At this point, though, I'm only guessing.

  • @sierdzio Fortunately my problem with the launcher app is solved. I wish things go well on your side and you don't face huge obstacles. I appreciate you sharing this info here and your will to push your android keyboard upstream.

  • Hi, I can confirm that with some changes in Qt sources it is possible to run Qt Virtual Keyboard on iOS and Android. If someone is still interested, take a look on this information from KDAB:

    especially page 13 of the document. To make Virtual Keyboard component work on Android, Qt library should be modified in qandroidplatformintegration class and in qiosintegration class for iOS.

    For example here is the code that may be added to qandroidplatformintegration class constructor:

    QString icStr = QPlatformInputContextFactory::requested();
    m_platformInputContext.reset(icStr.isNull() ? new QAndroidInputContext() : QPlatformInputContextFactory::create(icStr));

    If "QT_IM_MODULE" environmental variable will be set then icStr will be not null and QPlatformInputContextFactory::create(icStr) will create appropriate virtual keyboard plugin.

    What is also important on iOS devices virtual keyboard needs to be linked statically:


Log in to reply