Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to prevent keyboard events(win key,Alt,Ctrl,Esc) in main window?



  • Hey bros,
    I have an Qt written application in full screen mode.Only a mouse an numeric keys are needed to deal with the application. I need to prevent the operator to close my application or open another program in the operating system.
    How is it possible??
    Thanks a lot.


  • Moderators

    This is highly platform and OS dependent task and as so is often beyond what a language like c++ can do. The best you could do is capture some keystrokes or system events but that's not nearly enough.

    For example on Windwos 8 you would need to disable the different overlays the system provides like charms (see my response in "another thread":http://qt-project.org/forums/viewthread/23607).

    Apart from that there is no way to enforce that at all if for example your app is running in a virtual machine, as the input can be reverted to the host at any time. There are many many more considerations.

    All in all it's a complicated problem and way beyond what Qt is for. Depending on the platform you might need a special application manifest, installation mode, app location, tweaking system settings/registry, using a dedicated "kiosk mode" providing software or other voodoo stuff.

    For an example how to setup a kiosk mode in Windows 8 see "here":http://blogs.msdn.com/b/hyperyash/archive/2013/10/25/enable-kiosk-mode-in-windows-8-1.aspx
    This requires system administration tasks and is beyond what an app can do on its own.


Log in to reply