Control a QMainWindow remotely
-
Hello,
I want to send mouse/keyboard input to a QMainWindow from another application (combination of WinAPI PostMessage() and QApplication::postEvent).
So far it's possible to click buttons, but a QLineEdit for example will gain focus only if the QMainWindow is the "active" window.
So I have to do something likeif(event->type() == QEvent::WindowDeactivate) activateWindow();
.
Surprisingly, this seems to work. Even if a fullscreen application (which should control the QMainWindow) is above the QMainWindow, it's not disturbed.
But this approach fails as soon as the QMainWindow opens a dialog. Then, QMainWindow and the dialog "fight" for their active window status. But anyway I'd prefer a more "clean" way.
Also, the widgets don't react as soon as the QMainWindow is minimized.So I'm looking for a way to overcome those limitations.
Is there a way to tell Qt to process everything as usual if the QMainWindow is not active or even minimized?
Do I have to modify the source for that? Does anyone know more?What I know is that the QMainWindow application receives the events at least (checked with event filter on QApplication level) but I guess the widgets discard them due to window not active or minimized.
Thank you very much!