[Qt-interest] QNetworkReply *reply = networkManager->get(request); can't get the response in the reply
Meir Yanovich
meiry242 at gmail.com
Fri Apr 16 16:12:25 CEST 2010
sorry for this post but i still didn't finish the question so i will start
all over :
i have this simple http request and im trying to get the response in the
reply variable but i can't and i don't know why
here is what i have :
in the constructor i init the manager and the signal slot
:
HttpClient::HttpClient()
{
m_networkManager = new QNetworkAccessManager(this);
connect(m_networkManager, SIGNAL(finished(QNetworkReply*
)),
this, SLOT(finishedSlot(QNetworkReply*)));
}
then in one of the HttpClient methods i do the get request
QNetworkRequest request;
request.setUrl(url);
QString ApiResponse
QEventLoop loop;
QNetworkReply *reply = networkManager->get(request);
QByteArray data=reply->readAll();
ApiResponse.append(data); <--- the data here is empty
but the strange thing or it is not strange but mybe i dont understand how it
works
i do get the response and all the info in the finishedSlot "callback
function"
but then i losing my application flow beacose i need that data in the reply
= = networkManager->get(request); variable
Thanks for the help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100416/b7069afe/attachment.html
More information about the Qt-interest-old
mailing list