[Interest] running Qt main event loop in secondary thread

Stefan Seefeld stefan at seefeld.name
Tue Mar 28 22:23:58 CEST 2023


Hi Thiago,

if you have a look at the little sample script I attached to my mail you'll
see that I'm actually constructing the application object within the
function that is executed in the other thread.
I do however import PyQt5 modules at the top of my script, and if I move
those imports into the function the warning goes away.
Does this suggest that PyQt5 itself instantiates a QApplication as a global
object ?

On Tue, Mar 28, 2023 at 4:16 PM Thiago Macieira <thiago.macieira at intel.com>
wrote:

> On Tuesday, 28 March 2023 06:16:52 PDT Stefan Seefeld wrote:
> > First I see
> > the error / warning message
> >
> >   `WARNING: QApplication was not created in the main() thread.`
> >
> > the main window appears, but isn't fully constructed and it doesn't look
> > like the event loop is ever started. (The window's content isn't updated,
> > no button appears, and the app isn't receiving input events.)
> > What am I doing wrong ?
>
> You must create the QCoreApplication (including QApplication) in the
> thread
> that the first QObject is created in. That warning message tells you that
> you
> didn't.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Cloud Software Architect - Intel DCAI Cloud Engineering
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>


-- 

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


More information about the Interest mailing list