QString cStyleResult = QString::number(valor, 'e', 6); // Set precision to 6.
cStyleResult = cStyleResult.remove(QRegExp("0+$")); // Remove trailing zeros.
cStyleResult = cStyleResult.remove(QRegExp("\\.$")); // Remove trailing dot if any.
This should give you the desired output without trailing zeros.
Moderator's note: Spam link removed. No more warnings, you will be banned.




Reply With Quote
Bookmarks