Im trying to create an uploader that will create new threads and in every thread I have a QNetworkAccessManager. All the uploader threads have a reference to a shared list and w
QThread::start()
is what actually starts the thread
(as a different thread
). QThread::run()
is just a regular function, so if you call it without calling start()
first, you're executing it in the main thread.
The funny thing about it is that your derived class was created in the main thread, so it "belongs" in the main thread. I'm guessing you're giving your class as the parent to something else; this is what is generating the error message when you try to do this after calling start()
. Can you leave those objects parent-less?
You won't be able to create gui objects in another thread, Qt just doesn't allow it (yet?). But other objects can be created, you just can't give them a parent in a different thread.