Answer the question
In order to leave comments, you need to log in
Why is the number not being converted to a string correctly?
Hello.
I recently discovered some weird QString-related crap, namely the conversion of double to QString:
std::ofstream debug("debug.txt");
debug << "QString::number(5120.0) = " << QString::number(5120.0).toStdString() << std::endl;
debug << "QString::number(5121.0) = " << QString::number(5121.0).toStdString() << std::endl;
debug << "QString::number(5122.0) = " << QString::number(5122.0).toStdString() << std::endl;
debug << "QString(\"%1\").arg(5120.0) = " << QString("%1").arg(5120.0).toStdString() << std::endl;
debug << "QString(\"%1\").arg(5121.0) = " << QString("%1").arg(5121.0).toStdString() << std::endl;
debug << "QString(\"%1\").arg(5122.0) = " << QString("%1").arg(5122.0).toStdString() << std::endl;
debug.close();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question