Hello,

i don't quite understand how QTextStream works together with QStrings. I've got this code:

Qt Code:
  1. QTextStream ts(&s);
  2. ts<<11<<" Freunde";
  3. std::cout<<"1."<<ts.readAll().toStdString()<<'\n'<<"2."<<s.toStdString();
To copy to clipboard, switch view to plain text mode 

That produces this output:
1.11 Freunde

Why doesn't QTextStream write to the String, as intended? I would be happy with this behaviour, too, but why do I have to specify a string as an argument with the constructor? Is there a function that needs to be called? I didn't find one and in the examples it works without one - but the examples work with devices rather than QStrings.
Thanks.