[Qt-interest] qNetworkReply waitForReadyRead()
Srikanth Kavoori
srikanth.kavoori at gmail.com
Wed Feb 18 22:13:56 CET 2009
Hi,
>>Reading in response to readyRead() is the right way. What is your problem
when
>>doing that?
inside the slot connected to readyRead i use QXMLStreeamReader's function
readNext() , to read the incoming stream data from QNetworkReply device.
i used bytesAvailable() which always returns me the value equal to
"Content Length" whenever content length is less than 1500 bytes
when content length is more than this , i found that it returr ins approx.
1200 bytes. .so i was expecting QNetworkReply to automatically append data
to Reply Object. ( which it does not do in my case for some mysterious
reason )
my parser reads data from the _NetworkReply's device and stops after
reading 1200 bytes( this number is same as bytesAvailable() but far less
than the headers->contentLength() ) in the case of Large Responses.So i was
expecting the data to be automatically appended to reply object by
QNetworkReply.
the atEnd() function of QXMLStreamReader returns true at this point and my
parser exits as there is no further data appended by qNetworkReply.
in essence , i am loosing some data when i read with readyRead for larger
response sizes. i observe that if i start my parser from the slot connected
to finished i have complete data readily available. so my parser exits
properly.
some notes:
1. i did not use ReadAll inside the slot connected to ReadyRead. Instead ,
i set the QNetowrkReply as device to read from to QXMLStreamReader'ss
inherited Object
2. i used "Qt::QueedConnection" for connect , to connect my slot to
QNetworkReply's readyRead() ....
Best Regards,
Srikanth Kavoori
On Mon, Feb 16, 2009 at 9:50 PM, <qt-interest-request at trolltech.com> wrote:
> Send Qt-interest mailing list submissions to
> qt-interest at trolltech.com
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.trolltech.com/mailman/listinfo/qt-interest
> or, via email, send a message with subject or body 'help' to
> qt-interest-request at trolltech.com
>
> You can reach the person managing the list at
> qt-interest-owner at trolltech.com
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Qt-interest digest..."
>
> Today's Topics:
>
> 1. Re: qNetworkReply waitForReadyRead() (Srikanth Kavoori)
> 2. Re: qNetworkReply waitForReadyRead() (Thiago Macieira)
> 3. Re: Embed pixmaps at runtime (Constantin Makshin)
> 4. redirect stdout to QTextEdit widget (NARCISO, Rui)
> 5. Re: Embed pixmaps at runtime (Frank Hemer)
>
>
> ---------- Forwarded message ----------
> From: Srikanth Kavoori <srikanth.kavoori at gmail.com>
> To: qt-interest at trolltech.com
> Date: Mon, 16 Feb 2009 19:39:45 +0200
> Subject: Re: [Qt-interest] qNetworkReply waitForReadyRead()
> hi ,
>
> thanks for your quick response.
>
> >>No, it doesn't. It will always return false.
> >>This is intentional and will never work.
>
> . now how do i stop my reader from reading the data from device when there
> is no data available and restart reading when the data is available. is
> there an alternative. right now i am able to start reading the complete data
> in the signal finished() , but would like to start reading in readyRead() as
> soon as the data has arrived.
>
>
> thanks for your help.
>
> Best Regards,
> Srikanth Kavoori
>
>
>
>>
>> ---------- Forwarded message ----------
>> From: Srikanth Kavoori <srikanth.kavoori at gmail.com>
>> To: qt-interest at trolltech.com
>> Date: Mon, 16 Feb 2009 13:58:52 +0200
>> Subject: [Qt-interest] qNetworkReply waitForReadyRead()
>> Hi all ,
>>
>> Does anyone has any idea if waitForReadyRead works with QNetworkReply as a
>> device.
>>
>> i connected my function to QNetworkReply's readyRead to get trigger to
>> start reading my data.
>> If i get all data in one readyRead everything works fine.
>>
>> but if readyRead gets connected only after a chunk of data even though i
>> wait using waitForReadyRead , it never works. waitForReadyRead always
>> returns False even though bytesAvailable() is less than contentLength from
>> the reply's headers.
>>
>> When i debugged the code , it always refers the base class
>> waitForReadyRead() ( in this case QIODevice's function ) which has a default
>> implementation to return FALSE.
>>
>> has anyone able QNetworkReply's readyRead function with multiple chunks of
>> data without using waitForReadyRead ?
>>
>> Thanks in advance for your help.
>>
>> Best Regards,
>> Srikanth Kavoori
>> Sent from: Tampere Ls Finland.
>>
>>
>> ---------- Forwarded message ----------
>> From: Thiago Macieira <thiago.macieira at trolltech.com>
>> To: qt-interest at trolltech.com
>> Date: Mon, 16 Feb 2009 14:33:56 +0100
>> Subject: Re: [Qt-interest] qNetworkReply waitForReadyRead()
>> Em Segunda-feira 16 Fevereiro 2009, às 12:58:52, Srikanth Kavoori
>> escreveu:
>> > Does anyone has any idea if waitForReadyRead works with QNetworkReply as
>> a
>> > device.
>>
>> No, it doesn't. It will always return false.
>>
>> This is intentional and will never work.
>>
>> --
>> Thiago Macieira - thiago.macieira (AT) nokia.com
>> Senior Product Manager - Nokia, Qt Software
>> Sandakerveien 116, NO-0402 Oslo, Norway
>>
>>
>
>
> ---------- Forwarded message ----------
> From: Thiago Macieira <thiago.macieira at trolltech.com>
> To: qt-interest at trolltech.com
> Date: Mon, 16 Feb 2009 19:15:29 +0100
> Subject: Re: [Qt-interest] qNetworkReply waitForReadyRead()
> Em Segunda-feira 16 Fevereiro 2009, às 18:39:45, Srikanth Kavoori escreveu:
> > . now how do i stop my reader from reading the data from device when
> there
> > is no data available and restart reading when the data is available. is
> > there an alternative. right now i am able to start reading the complete
> > data in the signal finished() , but would like to start reading in
> > readyRead() as soon as the data has arrived.
>
> Reading in response to readyRead() is the right way. What is your problem
> when
> doing that?
>
> --
> Thiago Macieira - thiago.macieira (AT) nokia.com
> Senior Product Manager - Nokia, Qt Software
> Sandakerveien 116, NO-0402 Oslo, Norway
>
>
> ---------- Forwarded message ----------
> From: "Constantin Makshin" <dinosaur-rus at users.sourceforge.net>
> To: Qt-interest <qt-interest at trolltech.com>
> Date: Mon, 16 Feb 2009 21:58:59 +0300
> Subject: Re: [Qt-interest] Embed pixmaps at runtime
> Thanks for the notice, Frank. I've never had a need to add something to the
> application's executable at runtime and thus hadn't looked for such feature
> in any of Qt tools. :)
>
> But, anyway, modifying executables may be a tricky process (you may need to
> go through the code and fix pointers) and OS may not allow you to do so (no
> permissions, treating executable of a running application as a read-only
> file, etc.).
>
> On Mon, 16 Feb 2009 05:29:13 +0300, Frank Hemer <frank at hemer.org> wrote:
>
>> On Sunday 15 February 2009 18:51:36 Constantin Makshin wrote:
>>
>>> Qt resources are embedded right into the code of the application, so you
>>> can't easily add Qt resources at runtime. Even if you could, it's likely
>>> that your application won't have permissions to modify its executable
>>> file.
>>>
>>> P.S.: And rcc has nothing to do with the application's executable. It
>>> only
>>> generates a C++ header file with all required information about embedded
>>> files. Final "embedding" is done by the compiler.
>>>
>>
>> Hmm - no, rcc allows for compiling a resource into a binary format that
>> can be loaded at runtime. Still - except for running rcc via QProcess and
>> adding the resource via QResource::registerResource (...) - there is
>> currently no way to achive a runtime resource extension.
>> You might take a look at the rcc source - and maybe include parts of it
>> into your application but beware of future changes ...
>>
>> Btw. there is still a feature request pending on this issue.
>>
>> Frank
>>
>> On Sun, 15 Feb 2009 17:49:44 +0300, Nadia Pio <nadiapio at gmail.com>
>>> wrote:
>>>
>>>> Hello everybody,
>>>> in my application I use some icons that are embedded into the
>>>> application's executable through the Qt Resource System.
>>>> At runtime the user can import from the file system other icons and
>>>> I'd like to add them dynamically (at runtime) to the resource file and
>>>> embed them in the application. Is there a way to do this?
>>>> I know that I can register external binary resources, but I need to
>>>> create the resource data before to register them; is there a way to
>>>> run the rcc at runtime?
>>>> Thank you.
>>>> Nadia
>>>>
>>>
> --
> Constantin "Dinosaur" Makshin
>
>
>
> ---------- Forwarded message ----------
> From: "NARCISO, Rui" <RUI.NARCISO at airbus.com>
> To: "PyQt (E-mail)" <pyqt at riverbankcomputing.com>, "Qt Interest (E-mail)"
> <qt-interest at trolltech.com>
> Date: Mon, 16 Feb 2009 19:59:09 +0100
> Subject: [Qt-interest] redirect stdout to QTextEdit widget
>
> Hi all,
>
> I would to redirect the standard output to a QTextEdit but I would like it
> to be dynamic, ie, as soon as something is printed to the stdout the
> contents of QTextEdit should be updated..
>
> Changing the output of the ocde I'm running directly to the QTextEdit is
> not an option.
>
> I have tried to do it by reassigning the sys.stdout file descriptor but I'm
> encountering "memory fault" errors when trying to write to the QtextEdit.
>
> Would anyone have a webpage or some code I could use?
>
> Thanks in advance
> Rui
>
> The information in this e-mail is confidential. The contents may not be
> disclosed or used by anyone other then the addressee. Access to this e-mail
> by anyone else is unauthorised.
> If you are not the intended recipient, please notify Airbus immediately and
> delete this e-mail.
> Airbus cannot accept any responsibility for the accuracy or completeness of
> this e-mail as it has been sent over public networks. If you have any
> concerns over the content of this message or its Accuracy or Integrity,
> please contact Airbus immediately.
> All outgoing e-mails from Airbus are checked using regularly updated virus
> scanning software but you should take whatever measures you deem to be
> appropriate to ensure that this message and any attachments are virus free.
>
>
>
>
>
> ---------- Forwarded message ----------
> From: Frank Hemer <frank at hemer.org>
> To: qt-interest at trolltech.com
> Date: Mon, 16 Feb 2009 20:50:17 +0100
> Subject: Re: [Qt-interest] Embed pixmaps at runtime
> On Monday 16 February 2009 19:58:59 Constantin Makshin wrote:
> > Thanks for the notice, Frank. I've never had a need to add something to
> > the application's executable at runtime and thus hadn't looked for such
> > feature in any of Qt tools. :)
> >
> > But, anyway, modifying executables may be a tricky process (you may need
> > to go through the code and fix pointers) and OS may not allow you to do
> so
> > (no permissions, treating executable of a running application as a
> > read-only file, etc.).
>
> QResource::registerResource (...) does not modify the executable - it loads
> the resource into memory. Same is done with the compiled-in resources. At
> runtime they're cached in memory.
>
> Still its a pity qt doesn't provide a way to register resources at runtime
> without running them through rcc. This would ease access to
> default-contained
> (compiled-in) but user-modifyable resources a lot.
>
> Frank
>
>
> _______________________________________________
> 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/20090218/9c8e3e27/attachment.html
More information about the Qt-interest-old
mailing list