QTextStream simply gives you an interface where you can use << and >> operators on things.
Now that I look over it, that's probably not the most intuitive way to use QTextStream. The following is much better imo.
1 2 3 4 5 6
|
QTextStream output;
for(int index = 0; index != 10; ++index)
output << "C: " << index << " F:" << convertToF(index) << "\n";
QMessageBox::information(this, "Output", output.string(), QMessageBox::Ok);
|
The first example I gave you is only different in that 'stream' is operating on an existing QString, which I'm just deciding isn't necessary.
If you're familiar at all with the STL's stringstream, it's pretty much used for concatenating strings from various data types, such as ints and other things that an std::string doesn't handle directly. QTextStream does the same thing (and much much more cool things once you dig into it) for QStrings.
So yes, the above will result in the same thing you would get by using cout in a console. The actual string looks like
C: 1 F: 1\nC: 2 F: 2\nC: 3 F: 3\nC:4 F:4\n |
However, like the console, QMessageBox handles escape characters like \n, and will display it properly.
Displaying the message box should yield something like
C: 1 F: 1
C: 2 F: 2
C: 3 F: 3
C: 4 F: 4
|
And give you an "Ok" button to close the QMessageBox and continue execution.
You can check out the docs for QTextStream at
http://qt-project.org/doc/qt-5.0/qtcore/qtextstream.html
Also, this page is a really good thing to bookmark when you're working with Qt:
http://qt-project.org/doc/qt-5.0/qtdoc/classes.html
EDIT:
Overall, though, i would be weary of using QT5. They've made some significant changes on some core framework stuff that I just do not like after working with 4.8.4 for ages. The most aggravating to me so far is that it's exceptionally difficult to go about handling native OS events when you need to. That and you can't build libqxt (a super handy extension of Qt) for Qt5 (yet). That, and because Qt5 is so new, there's not many resources or solved problems on the internet for you to reference; it's almost impossible to find good third party references.
Just giving you a heads up in the event that you run into issues with Qt5, it might be easier just to revert to Qt4.8.4, which has
all the same functionality, minus C++11 support.