Here is a couple of ways (there are probably many of varying efficiency):
quint32 crc = 0x00123456;
result.prepend("00000000");
result = result.right(8);
qDebug() << result;
result = result.rightJustified(8, '0', false);
qDebug() << result;
// condense the previous to
result
= QByteArray::number(crc,
16).
rightJustified(8,
'0',
false);
qDebug() << result;
quint32 crc = 0x00123456;
QByteArray result = QByteArray::number(crc, 16);
result.prepend("00000000");
result = result.right(8);
qDebug() << result;
result = QByteArray::number(crc, 16);
result = result.rightJustified(8, '0', false);
qDebug() << result;
// condense the previous to
result = QByteArray::number(crc, 16).rightJustified(8, '0', false);
qDebug() << result;
To copy to clipboard, switch view to plain text mode
or you could use QString::arg() and an appropriate set of parameters and have a QString return.
Bookmarks