QAction keyboard shortcut failure after menu use – application focus issue? Qt 5.1 / Win7 / Mingw64

  • I’ve run into something that has me completely stumped, and am desperately hoping that someone can help me out.

    I’ve got an OpenGL renderer application that used to run fine under Qt4.8 – I’m now porting it to 5.1, and have a persistent problem with keyboard shortcuts. My application uses QActions with keyboard shortcuts, some defined in the ui file, others created in code. All are application-level shortcuts. They worked under Qt4.8. I find now that when I use the menus (specifically when I close them) the shortcuts stop working. They start again if I interact with the program using the mouse, e.g. click into a widget. They also start again if I change focus to another application (e.g. by alt-tabbing), then change back. Using a timer to force focus into a particular widget does not solve the problem. Clicking in the status bar of the mainwindow also seems to stop the actions working.

    I’ve tried intercepting the keyboard events at various places, but nothing has worked – they simply don’t seem to be visible to anything once this problem kicks in. The only idea I have is that the application is somehow losing focus, although visually Windows does not seem to indicate that this is the case.

    Any ideas anyone? I’m running out of even ugly kludgey ideas for trying to fix this or get any further with it…

    Thanks in advance

  • Lifetime Qt Champion


    Since this looks like a regression, you might better ask on the mailing list, you'll find Qt maintainers/developers there. This forum is more user oriented.

  • OK, thanks, probably good advice - I'm not absolutely sure that this is Qt's fault rather than mine, but it's certainly possible. Ignorant question though - what mailing list exactly, and how do I join/post to it?


Log in to reply