PDA

View Full Version : Create QTextStream



Morea
17th June 2007, 20:41
First of all, I want to create a QTextStream (in an object) that I should connect to a QTcpSocket. I wonder, what is best, to create one QTextStream that I do all read/write to, or to crate a new QTextStream eveytime I want to read/write?
Any performance hits or other problems?

If I want to have only one QTextStream in my object , what should I do to create it? Will it work with

QTextStream ts; // put in .h file

and in the cpp directly after the socket is created:

QTextStream.setDevice(my_little_socket);

Then the docs seems to say something about setString() but I'm unclear on what to call that function with? The openmode should be readwrite, but what is the string? And what will that do?

wysota
17th June 2007, 21:25
Creating an object always yields a small overhead so if you can do with a single stream object, it should be your first choice.