Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.7.0
-
QTCreator 4.0.2
QT 5.7.0
gcc-4.9.1
Debian
Description
I was trying to create zero-filled hex strings (like sprintf( buf, "%02X", 123 )) and discovered that QString.arg(...) with a non-zero width and base 16 acts like sprintf( buf, "%.32f", 123 ):
Sample code:
QString ok = QString( "%1" ).arg( 123, 0, 16 );
QString ng = QString( "%1" ).arg( 123, 2, 16, '0' );
cerr << ok.toStdString( ) << endl;
cerr << ng.toStdString( ) << endl;
Sample output:
7b
123.000000000000000000000000000000000000000000000000