[Interest] running Qt main event loop in secondary thread

Stefan Seefeld stefan at seefeld.name
Mon Mar 27 22:23:02 CEST 2023


Hello,

I'm working on some Python tests that interact with a Qt application. I
would like to run the application's event loop in a secondary thread, so
the primary thread can perform the test itself.

I read in the past that such a use-case wasn't supported by Qt, but I can't
find that information right now, and neither do I remember the rationale
for that limitation.

Could anybody please either confirm or deny this limitation, ideally with
some background information ?

For context: my application is somewhat atypical in that the application
only has a minimal GUI, but does a lot of processing of input from TCP/IP.
The test logic I'd like to write would thus have test function (running in
the primary thread) control the data sent to the app and inspect and assert
the application's corresponding states, while the event processing would
take place in a secondary thread.

I'm unfortunately not sure that such a use-case is possible at all, i.e. I
may have to invert roles, i.e. have the actual "test scenario" be executed
in a secondary thread as the main thread is reserved for the (blocking)
event loop.

Thanks for any information & suggestions !

      ...ich hab' noch einen Koffer in Berlin...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20230327/2ed4838b/attachment.htm>


More information about the Interest mailing list