QGuiApplication::postEvent while keeping the application in the background/with no focus
-
I am trying to understand if it is possible to post key events to QGuiApplication when it has no focus or when the application is in the background behind some other windows.
Right now, we use QGuiApplication::postEvent to do this, but when the application has no focus the event is not passed and due to this reason we always have to bring the application to the top to pass the events
Any pointers?
Thank you
-
Hi and welcome to devnet,
What kind of key event should that be ? Some sort of global shortcut ?
-
Hi, we are running GUI Robot automated test scripts where we keep triggering mouse clicks or key presses to QGuiApplication to run a test case.
In this process we are using QGuiApplication::postEvent for passing the events to the application and now we do that by activating the application and bringing to focus. The side effect is that this application window is brought to foreground and leaving my active window to background.
The goal now is that, while the tests are run we want to pass the events to our application keeping it in the background and still could do other things.
Thank you
-
If the test should run in the background, I would have rather used something like QtScript to automate the test processing, to avoid having to click/simulate the clicks on the screen.
You might also be interested by "froglogic's squish":http://www.froglogic.com/squish/gui-testing/