There is a nice solution for Qt Enterprise version: Qt Virtual Keyboard. The documentation also comes with a good technical guide that shows how they implemented the virtual keyboard. They implemented
QPlatformInputContextPlugin and QPlatformInputContext interfaces. I googled a little bit to find a similar open source solution and found the fantastic blog post from Tomasz Olszak.
He did a virtual keyboard mockup for Qt applications on systems with a
window manager (Windows or Linux Desktop). Interesting for me was the
fact, that he also implemented QPlatformInputContextPlugin and QPlatformInputContext
to provide its on screen keyboard. So it seems to be the right way for
implementing a virtual keyboard. The UI of Tomasz implementation was
completely QML based - so it was perfectly suited for integration into
QML applications.Long story short, I simply copied his code and modified it, to enable integration into embedded QML applications without window manager. I added a little bit of functionality (i.e. character preview popup, or automatic scrolling of flickable elements if keyboard overlaps focused input element). So I have to say a big thank you to Tomasz Olszak for providing a nice virtual keyboard mockup. The example application in examples/qmlapp has been copied from the Qt Virtual Keyboard example. I only did some minor modifications to run the example with my Virtual Keyboard implementation instead of the Qt Enterprise Virtual Keyboard.
The code is available on GitHub. The implementation is far from feature complete. But I think it is a starting point for people that need to implement virtual keyboard support for QML applications. Keep in mind that I'm a QML newbie and that my QML is far from beeing perfect. So if you find something in my QML code that could be done better, then please tell me or send me a pull request.
