View Full Version : QNetworkAccessManager in multiple threads

21st June 2011, 10:12
I am using QNetworkAccessManager instance as a static member of my class. When I use my class in another thread and try to call QNetworkAccessManager::post method I receive the following text in the output: "QObject: Cannot create children for a parent that is in a different thread." However everything seems to work fine. Yes, QNetworkAccessManager belongs to a different thread than the one it is used in, but is it really an error to call the post method from another thread, because I don't see any problems except this message?

class MyClass: public QObject
static QNetworkAccessManger manager;

// my class is then used in the thread
void MyThread::run()
MyClass myclass;
myclass.callPostMethod(); // here the warning is printed

7th August 2013, 08:28
I also think the finished(QNetworkReply *) signal should be removed from QNetworkAccessManager as it provides duplicate functionality to the finished() signal in QNetworkReply, but can also cause troubles, or at least uglier code, when you want to do multiple network requests based on previous network requests.

7th August 2013, 23:14
Why are you putting QNetworkAccessManagers in threads in the first place?