{"id":8255,"date":"2019-11-19T14:34:47","date_gmt":"2019-11-19T19:34:47","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=8255"},"modified":"2021-12-08T10:36:38","modified_gmt":"2021-12-08T15:36:38","slug":"show-qt-virtual-keyboard-windows-desktop","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/show-qt-virtual-keyboard-windows-desktop\/","title":{"rendered":"Qt Virtual Keyboard Not Showing in Fullscreen Mode in Windows 10 Desktop?"},"content":{"rendered":"\n
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.<\/p>\n\n\n\n
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<\/a> apps, There is a case for it where you do not have a physical keyboard.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n Normally you wouldn’t care much about the Qt<\/a> virtual keyboard because these PCs and Macs usually have physical keyboards attached to them.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n It involves simulating a fullscreen mode by decorating the application window in a non-conventional way.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n You will also need to make the width of the application the same as the screen.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n 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.<\/p>\n\n\n\n The windows decorations are removed by setting two Window flags.<\/p>\n\n\n\n Here is a sample of code showing the additionals mentioned above.<\/p>\n\n\n\n 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<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" 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…<\/p>\n","protected":false},"author":1,"featured_media":8256,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,16,17],"tags":[111,184,220,318,424,479,482,484,486,543,544,646],"yoast_head":"\nThe Qt virtual keyboard Solution<\/h2>\n\n\n\n
ApplicationWindow {\n id: root\n visible: true\n \n x: 0 \/\/ position window to the left of the screen\n y: 0 \/\/ position window to the top of the screen\n width: Screen.width \/\/ make window width same as screen\n height: Screen.height + 1 \/\/ make window height same as screen + 1. This prevents the window being trated as fullscreen\n flags: Qt.FramelessWindowHint | Qt.Window \/\/first flag removes window decorations, second flag to keeps application thumbnail in the Windows taskbar.\n\n ...\n}<\/code><\/pre>\n\n\n\n