Important: Please read the Qt Code of Conduct -

QProcess messaging and hidden?

  • I am not sure if this is possible but would love to get some ideas how to make this happen.

    Basically I would like to start a process as a hidden window and be able to communicate send keyboard/mouse events to it and at the same time capture its window into pixels. Think capturing any app and then sending it to OpenGL for example to render it in a 3D environment or to capture a screenshot of this app.

    Of course all this has to happen in steps so the first part is how can I simply send mouse/keyboard events to the process? Easily enough I have started the process using QProcess:start but from here I do not see anything obvious about how proceed next.



  • I don't think Qt helps you there. I would write platform specific code.
    Under X11, the COMPOSITE and the XTEST extensions come to mind.

  • Hi,

    Qt won't do it. And to do it in platform specific code, could get complicated, if you want to face different platforms. On Windows you would have to emulate key/mouse events but those are always send to the currently active window. Or you have to simulate it completely.

    What could be a solution is how squish does it (that's the test automation tool for Qt from frogligic). They can simulate mouse and keyboard for processes, but don't ask me how they do it.

  • Any idea how to get the window handle for the process created in both OSX and Windows?

    Thanks for the responses so far.


  • bq. Some people have been asking how to embed Qt painted content (and especially Qt widgets) in a 3d scene.


    Is that what you're looking for? Qt Widgets in 3d scene?

  • Jim: Thanks for the suggestion. I have seen this before and from the looks of it the widgets are still being drawn to the 2D screen as an overlay to the 3D engine, maybe I am wrong here? Ultimately however I need pixel access to the app in question.

    Lukas: Thanks, I am aware of winId() however I need to get that from a QProcess which gives me the process handle as opposed to the window handle. As Gerolf suggests I will most likely need to branch platform specific code at this point which is ok; was hoping to avoid it if possible however.



Log in to reply