Re: running pyqt app event loop in secondary thread, using (Py)Qt6.5

Stefan Seefeld <[email protected]> Fri, 22 Sep 2023 18:48:53 -0400
Newsgroups gmane.comp.lib.qt.general,gmane.comp.python.pyqt-pykde
Message-ID <CAOEGfx3B0fz9i7SXvL6R51SphjEpvphVPDnBwO1P7ArRAWtMtg@mail.gmail.com>
--===============8395918102498012094==
Content-Type: multipart/alternative; boundary="0000000000005ca1020605fa6a40"

--0000000000005ca1020605fa6a40
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Jeremy,

thank you very much for following up !

On Fri, Sep 22, 2023 at 6:36=E2=80=AFPM Jeremy Katz <[email protected]> wr=
ote:

>
> I went searching for Qt 6 references to QCoreApplication.quit, as this
> has changed from Qt 5. Qt 5 makes no promises.
> https://doc.qt.io/qt-6/qcoreapplication.html#quit says:
> Thread-safety note: this function may be called from any thread to
> thread-safely cause the currently-running main application loop to exit.
> However, thread-safety is not guaranteed if the QCoreApplication object
> is being destroyed at the same time.
>

I'm not sure what "at the same time" means. At least in my sample code, I'm
really calling the `quit()` function from a different thread (while the
event loop is still running, of course), and am only destroying the
application after the `exec()` function has completed.



>
> Unless the application is setting up a connection, there is no signal
> routing involved.
>

I'm also not sure what this means. Am I supposed to connect
`Application.quit` to `Application.exit` myself ? I thought Qt would handle
that internally, and route the signal appropriately, depending on whether
the signal comes from the same thread or not.

Thanks,
--=20

      ...ich hab' noch einen Koffer in Berlin...

--0000000000005ca1020605fa6a40
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div>Hi Jeremy,</div><div><br></div><div>=
thank you very much for following up !<br></div></div><br><div class=3D"gma=
il_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Sep 22, 2023 at 6:3=
6=E2=80=AFPM Jeremy Katz &lt;<a href=3D"mailto:[email protected]">jkatz@vo=
lexity.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex"><br>
I went searching for Qt 6 references to QCoreApplication.quit, as this <br>
has changed from Qt 5. Qt 5 makes no promises.<br>
<a href=3D"https://doc.qt.io/qt-6/qcoreapplication.html#quit" rel=3D"norefe=
rrer" target=3D"_blank">https://doc.qt.io/qt-6/qcoreapplication.html#quit</=
a> says:<br>
Thread-safety note: this function may be called from any thread to <br>
thread-safely cause the currently-running main application loop to exit. <b=
r>
However, thread-safety is not guaranteed if the QCoreApplication object <br=
>
is being destroyed at the same time.<br></blockquote><div><br></div><div>I&=
#39;m not sure what &quot;at the same time&quot; means. At least in my samp=
le code, I&#39;m really calling the `quit()` function from a different thre=
ad (while the event loop is still running, of course), and am only destroyi=
ng the application after the `exec()` function has completed.<br></div><div=
><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e=
x">
<br>
Unless the application is setting up a connection, there is no signal <br>
routing involved.<br>
</blockquote></div><br clear=3D"all"><div>I&#39;m also not sure what this m=
eans. Am I supposed to connect `Application.quit` to `Application.exit` mys=
elf ? I thought Qt would handle that internally, and route the signal appro=
priately, depending on whether the signal comes from the same thread or not=
.<br></div><div><br></div><div>Thanks,<br></div><span class=3D"gmail_signat=
ure_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><div d=
ir=3D"ltr"><div><img src=3D"https://ci3.googleusercontent.com/mail-sig/AIor=
K4yh4RzsqlxV6irScDGRVZ8a7NRCh_INtpPsAHx2Y8v4Vu3VKsI54RFNs3YRZk_2xTTtMMdSCzd=
Nrf5XRUlmF4BkezmtZv-j5c3A4G0hEA"></div><div><pre>      ...ich hab&#39; noch=
 einen Koffer in Berlin...
</pre></div></div></div></div>

--0000000000005ca1020605fa6a40--

--===============8395918102498012094==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Interest mailing list
[email protected]
https://lists.qt-project.org/listinfo/interest

--===============8395918102498012094==--