Hi all,
I spent some time trying to see the signal bytesWritten working over a QBuffer instance, but without any succes... I post here a little example of my code.
char ch;
connect(&buffer,SIGNAL(bytesWritten(qint64)),this,SLOT(test(qint64)));
buffer.write("Qt rocks!");
buffer.seek(0);
buffer.getChar(&ch); // ch == 'Q'
qDebug("%c",ch);
buffer.getChar(&ch); // ch == 't'
qDebug("%c",ch);
buffer.getChar(&ch); // ch == ' '
qDebug("%c",ch);
buffer.getChar(&ch); // ch == 'r'
qDebug("%c",ch);
QBuffer buffer;
char ch;
connect(&buffer,SIGNAL(bytesWritten(qint64)),this,SLOT(test(qint64)));
buffer.open(QBuffer::ReadWrite);
buffer.write("Qt rocks!");
buffer.seek(0);
buffer.getChar(&ch); // ch == 'Q'
qDebug("%c",ch);
buffer.getChar(&ch); // ch == 't'
qDebug("%c",ch);
buffer.getChar(&ch); // ch == ' '
qDebug("%c",ch);
buffer.getChar(&ch); // ch == 'r'
qDebug("%c",ch);
To copy to clipboard, switch view to plain text mode
this is the test SLOT:
void classname::test()
{
qDebug("test test test");
}
void classname::test()
{
qDebug("test test test");
}
To copy to clipboard, switch view to plain text mode
The code compile without any problem, but the signal bytesWritten is always absent!!!
I hope someone can help me, because I'm stuck on this annoying problem. 
In my opinion could be a Qt bug, but since I'm a novice in Qt4 programming, I like to discuss with someone expert (or guru...
) before thinking bad things!!!
A possible workaround is to define a new QIODevice subclass in which I have to reimplement the bytesWritten signal in order to create a new QBuffer working subclass!
But I hope to make the original one working!
Best regards,
Alessandro
Bookmarks