Qt Code:
  1. #include <QtCore>
  2.  
  3. int main(int argc, char *argv[])
  4. {
  5. QCoreApplication app(argc, argv);
  6. QBuffer buf;
  7. buf.open(QIODevice::ReadWrite);
  8. buf.write("Hello!\n");
  9. qDebug() << buf.data(); // prints Hello!\n
  10. qDebug() << buf.canReadLine(); // returns false!
  11. qDebug() << buf.readLine(); // returns an empty string!
  12. }
To copy to clipboard, switch view to plain text mode 

I'm using QBuffer for a unit test and I've found this behaviour. I'm using 4.6.2. The Qt docs state you can use readLine() but in fact it returns an empty string. Is this correct or a Qt bug?