QNetworkReply asycn problem
I am trying in get a xml response from a server using QNetworkReply and because the response is done async, when i need the value returned by an object and i put it in a string, the value from string si empty "".
someone could help me with a sugestion in how i can fix this async problem ?
Refer this link will help you
you can also try this:-
@ QNetworkRequest request; request.setUrl(QUrl(fileURL)); QNetworkAccessManager *downloadmanager = new QNetworkAccessManager(this); downloadreply = downloadmanager->get(request); connect(downloadreply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(onDownloadProgress(qint64,qint64))); connect(downloadmanager,SIGNAL(finished(QNetworkReply*)),this,SLOT(onFinished(QNetworkReply*)));
void class::onFinished(QNetworkReply * reply )
//you have all the data in Data
ok, I already have done this.
But , for example, if i want to move Data in a method named QString getData() and then i create a new object and after this i call getData() the return string will be empty .