[Qt-interest] QNetworkReply *reply =networkManager->get(request); can't get the response in the reply

Scott Aron Bloom Scott.Bloom at onshorecs.com
Fri Apr 16 23:55:17 CEST 2010


You should read the documentation J


You need to connect to the finished signal of the manager, then read from the reply.

 

Or, if you want to do it incrementally, connect to the readyReady signal of the reply.

 

But you have let the event loop run..

 

Scott

 

From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Meir Yanovich
Sent: Friday, April 16, 2010 2:46 PM
To: Thiago Macieira
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] QNetworkReply *reply =networkManager->get(request); can't get the response in the reply

 

so what should i do ?

On Sat, Apr 17, 2010 at 12:22 AM, Thiago Macieira <thiago at kde.org> wrote:

Em Sexta-feira 16. Abril 2010, às 16.12.25, Meir Yanovich escreveu:

>      QEventLoop loop;
>      QNetworkReply *reply = networkManager->get(request);
>      QByteArray data=reply->readAll();
>      ApiResponse.append(data); <--- the data here is empty

The data is empty there on line 4 because you didn't let the reply process.
You have to wait for the finished() signal between line 2 (the get() ) and the
attempt at reading.


--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
 Senior Product Manager - Nokia, Qt Development Frameworks
     PGP/GPG: 0x6EF45358; fingerprint:
     E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358


_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100416/a990e96d/attachment.html 


More information about the Qt-interest-old mailing list