[Interest] QtThread
Etienne Sandré-Chardonnal
etienne.sandre at m4x.org
Mon Jan 13 11:26:17 CET 2014
Hi,
As Andrey pointed out, there is not a single way. But if you want to use a
QThread for running QObjects with its event loop, the most simple way is
not to subclass, and moveToThread.
This is well explained here:
http://blog.qt.digia.com/blog/2010/06/17/youre-doing-it-wrong/
http://mayaposch.wordpress.com/2011/11/01/how-to-really-truly-use-qthreads-the-full-explanation/
Cheers,
Etienne
2014/1/13 Chaser <chaser.andrey at gmail.com>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> > Hi I have been reading about QtThread and there seems to be a lot
> > of discussion about how to correctly use this class. i.e. should
> > developers derive from QtThread or provide an QObject and move this
> > object to a thread. The examples provided with Qt5 derive from
> > QtThread whereas there is a lot of chatter on the web saying this
> > is not the correct way.
> >
> > Can anyone provide some definitive answers on how developers are to
> > use QtThread?
> >
> > Thanks _______________________________________________ Interest
> > mailing list Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
> >
> You must know that QThread is not the thread itself, but it's a class
> for manipulation of the thread. So, the QThread object stays in main
> thread.
>
> Derive from QThread and moveToThread() are two correctly use-case of
> QThread.
>
> IMHO, deriving from QThread is more complicated, you must understand,
> how to create objects and run code in new thread, but not in QThread's
> parent thread.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2.0.22 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iF4EAREIAAYFAlLTs1AACgkQZxvOZ+bTdZheVAD9GOwA8IsVjZZJXdCL/KR2u+lH
> 9rGA8qeZ1mY/zIqel1UA/3pB+SLGHzzA89oxF6jpcFcD0/HEAfaf2VoVVe7/n+vj
> =6OTm
> -----END PGP SIGNATURE-----
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140113/2b1004ae/attachment.html>
More information about the Interest
mailing list