One the possible ways, is to format your data before you add into QTextDocument / QTextEdit
str
= QString("Decimal 63 is %1 in hexadecimal") .arg(63, 0, 16);
// str == "Decimal 63 is 3f in hexadecimal"
.arg(12345)
.arg(12345)
.arg(12345, 0, 16);
// str == "12345 12,345 3039"
QString str;
str = QString("Decimal 63 is %1 in hexadecimal")
.arg(63, 0, 16);
// str == "Decimal 63 is 3f in hexadecimal"
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
str = QString("%1 %L2 %L3")
.arg(12345)
.arg(12345)
.arg(12345, 0, 16);
// str == "12345 12,345 3039"
To copy to clipboard, switch view to plain text mode
Bookmarks