Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to use void QTextStream::setRealNumberNotation
I need to use
void QTextStream::setRealNumberNotation(RealNumberNotat ion notation). I looked at so-called Docs for it, but there is no example for beginners! (It's here:)
QString ss; QTextStream (&ss); // here to use it
How to use it please?
ss.setRealNumberNotation(QTextStream::ScientificNotation) or ss.setRealNumberNotation(QTextStream::FixedNotation) or
Thank you. Please have a look at these:
QString s; QTextStream ss(&s); ss.setRealNumberNotation(QTextStream::SmartNotation); ss << 1000000; result_box -> setText(s);
Here the result is:
But in this one:
QString s; double d = 1000000; QTextStream ss(&s); ss.setRealNumberNotation(QTextStream::SmartNotation); ss << d; result_box -> setText(s);
The result is:
Why? And how to solve it please?
You're not using the same types in both code sample. Once you send an integer and next a double. setRealNumberNotation affects float and double, not integers.
You're welcome !
If that answers your question then please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)