Alternatives for Virtual Keyboards
By Jeff Tranter | Wednesday, August 27, 2014
With touchscreen-based systems such as tablets, smart phones and embedded devices, there is often a need for a virtual or on-screen keyboard. Qt itself does not provide a virtual keyboard and I am often asked for recommendations on approaches for a virtual keyboard. I thought this would make a good topic for a short blog post. Let's look at some of the options available.
First, the operating system may provide a virtual keyboard for you, in which case your application will not need to worry about it. This is typically the case for desktop and mobile platforms such as Android, iOS and Windows 8. Occasionally, you may need to provide a few hints to the native virtual keyboard, but nothing more than that is required.
On embedded systems, you are typically running just one dedicated application and need to provide a virtual keyboard. One good option is Maliit (1). Maliit is a virtual keyboard (more accurately, an input method framework) for touchscreen devices. It is free software licensed under the LGPL and provides advanced features including support for multiple languages, word correction and word prediction. Originally developed by Nokia for the MeeGo platform, it is used on other platforms including KDE Plasma Active and Ubuntu Touch. Maliit was originally written for Qt 4, it now supports Qt 5 and works with both widgets and QML. There is a downside to using Maliit in that it requires the back end display server to be X11 or Wayland. Maliit is quite large and complex and therefore may be overkill when only a simple on-screen keyboard is needed. The Maliit project web site (2) has been down for some time, although the code continues to be developed. A screen shot of a Maliit keyboard is shown below.
Digia's Qt Enterprise offers a virtual keyboard (3). From what I have heard, this is a well-supported implementation. The downside is that it requires that you purchase the commercial version of Qt. While the commercial version offers a number of features and add-ons over the free version, if all you need is a virtual keyboard, then this will be an expensive option.
There are other implementations of on-screen keyboard with various features in different states of completeness and support. A Google search or browsing qt-apps.org (4) will identify a few. You may find one that is suitable for your application.
Finally, there is always the option of writing your own virtual keyboard. Qt makes this quite straightforward to do. In our consulting work at ICS, we have often found that many applications have unique requirements for keyboards, so with this approach you can tailor the implementation to what you need. For example, you may only need to support widgets or only QML. Some applications may only have a need for basic numeric input and not a full keyboard.
In a future blog post, I hope to explore how to write a virtual keyboard in Qt, including example code.
- Maliit source code repository at Gitorious, accessed August 22, 2014, gitorious.org/maliit/
- Maliit project website, down as of August 22, 2014, http://maliit.org/
- Qt Enterprise Virtual Keyboard, accessed August 22, 2014, qt.digia.com/Product/Qt-Enterprise/Qt-Virtual-Keyboard/
- Free Qt Applications website, accessed August 22, 2014, qt-apps.org