Congratulations to our 2022 Qt Champions!

Alt+space shortcut on Windows can't be intercepted

  • I'm trying to intercept the system menu shortcut on Windows (alt and space).

    It appears as though Qt eats it without ever passing it to the application?!

  • Moderators

    I don't think it's Qt that eats it. It might be the OS.
    In any case, if non-portable solution isn't a problem you can dig to it using native event handler:
    #include <windows.h>

    bool MyWidget::nativeEvent(const QByteArray&, void* message, long*) {
    MSG* msg = (MSG*)message;
    if(msg->message == WM_SYSKEYDOWN) {
    // msg->wParam is the key code
    return false;

  • I can see in QKeyMapperPrivate::translateKeyEvent() that the event is being sent.

    Maybe it is the OS eating it. I'll try your suggestion :-)

Log in to reply