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.and...@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@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@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest >
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest