Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, December 2006
QFile::readReady() problem


Message 1 in thread

Hello,

I have an interesting problem concerning QFile::readyRead(). After
connecting 
to this signal of an opened QFile, to which definitly data is written, the 
signal is never emitted.

I did a grep over the source code of QFile and QIODevice for a line of code 
emitting this signal, but I could not find one in the  latest version of Qt 
(4.2.2.).

Did anyone ever get this signal working or does someone have an idea why
this 
signal is not emitted? 

best regards,
        Dom
-- 
 [ signature omitted ] 

Message 2 in thread

Dominik Seichter wrote:
> Hello,
> 
> I have an interesting problem concerning QFile::readyRead(). After
> connecting 
> to this signal of an opened QFile, to which definitly data is written, the 
> signal is never emitted.
> 

My docs do not mention QFile::readyRead(), but QIODevice::readyRead() 
instead. Grepping over the source

 > grep -rw --include '*.cpp' readyRead * | grep -w emit

finds about 15 lines that actually emit a readyRead() signal, mainly in 
network- and process-related classes. Given the abstract nature of 
QIODevice and the , aehm, file-nature of QFile - where waiting for 
readability doesn't make sense - this comes at no surprise..


/eno

--
 [ signature omitted ] 

Message 3 in thread

Enrico Thierbach wrote:

> Dominik Seichter wrote:
>> Hello,
>> 
>> I have an interesting problem concerning QFile::readyRead(). After
>> connecting
>> to this signal of an opened QFile, to which definitly data is written,
>> the signal is never emitted.
>> 
> 
> My docs do not mention QFile::readyRead(), but QIODevice::readyRead()
> instead. Grepping over the source
Yes, that is true. But as QFile inherits QIODevice, it should be possible to
use a QFile everywhere as QIODevice. And therefore QFile should correctly
emit the readyRead() signal.

> 
>  > grep -rw --include '*.cpp' readyRead * | grep -w emit
> 
> finds about 15 lines that actually emit a readyRead() signal, mainly in
> network- and process-related classes. Given the abstract nature of
> QIODevice and the , aehm, file-nature of QFile - where waiting for
> readability doesn't make sense - this comes at no surprise..
Waiting for readability in a file makes sense:

echo "Hello World" >> /tmp/opened_file 

This will appened a line to a file. If this file is openend as a QFile it
should correcty emit a readyRead() signal. 
In my case the readyRead() signal would be useful, as I use QFile to work on
a FIFO on Unix. 

In my opinion, QFile should implement all functionallity of QIODevice. If
the readyRead() signal in QFile is missing or cannot be implemented for
some reason, it thould at least be documented.

best regards,
        Dom

-- 
 [ signature omitted ] 

Message 4 in thread

On Thu, 21 Dec 2006 12:06:22 +0100
Dominik Seichter <domseichter@xxxxxx> wrote:

> This will appened a line to a file. If this file is openend as a
> QFile it should correcty emit a readyRead() signal. 
> In my case the readyRead() signal would be useful, as I use QFile to
> work on a FIFO on Unix. 
> 
> In my opinion, QFile should implement all functionallity of
> QIODevice. If the readyRead() signal in QFile is missing or cannot be
> implemented for some reason, it thould at least be documented.

In effects, this is related to my previous post with waitReadyRead().
As you outlined, readyRead is important when QFile is in effect a device
like a serial port (/dev/ttyS0).

--
 [ signature omitted ]