You are here: / Articles / Guides / How-Tos / Technology / Tips / Qt Virtual Keyboard Not Showing in Fullscreen Mode in Windows 10 Desktop?

Qt Virtual Keyboard Not Showing in Fullscreen Mode in Windows 10 Desktop?

Qt virtual keyboard

Share!



For those familiar with Qt development, there has been a long persistent problem when it comes to dealing with the Qt virtual keyboard. For the most part, it works quite well as long as you know how to implement it in your project.

The Qt virtual keyboard is ideal for use in mobile phone and tablet apps as well as embedded systems. It is, therefore, a crucial component to have when developing Qt QML apps, There is a case for it where you do not have a physical keyboard.

The problem comes in when you do have a Desktop computer most likely a PC running Windows 10, 8.1, or Windows 7. The same can be said for rare cases in Macs or even Ubuntu systems.

Read Also  All set for the Qt World Summit 2016

Normally you wouldn’t care much about the Qt virtual keyboard because these PCs and Macs usually have physical keyboards attached to them.

Some use-cases require one to use an on-screen virtual keyboard. This would include a kiosk in a public place such as a school or shopping mall. A POS system that runs in fullscreen mode or similar systems.

The problem here is the virtual keyboard works very well when the applications are run in Window mode. In fullscreen mode, the Qt virtual keyboard tends to run behind the application window making it inaccessible.

The Qt virtual keyboard Solution

You could either go the hard way and tinker with the Qt virtual keyboard plugin source code. The good news is there is an easier way around this problem.

Read Also  The C++ Standard Template Library Modifying Algorithms - Part 8

It involves simulating a fullscreen mode by decorating the application window in a non-conventional way.

You can start by creating your Qt Quick project using the tools provided by Qt Creator. Be sure to select the Qt virtual keyboard plugin as a component in your project.

In the main.qml file you will need to add some code to position your application window on the top-left corner of your screen.

You will also need to make the width of the application the same as the screen.

Do the same with the height but increase the height by one. This will stop the QML engine from treating it as a fullscreen window and cause the same problem to manifest.

At this point, your application window will cover the entire screen but it will still look like a traditional window. This can be fixed by removing the title bar and the buttons for closing, maximizing, and minimizing the window.

The windows decorations are removed by setting two Window flags.

Here is a sample of code showing the additionals mentioned above.

There you have it. You can now use the Qt virtual keyboard in fullscreen mode in all your Desktop applications in Windows. Remember the solution above also applies to Ubuntu and other Linux flavors as well as Macs. You can find out more details about the plugin including documentation here.