PDA

View Full Version : int to hex code



nowire75
14th January 2008, 15:33
Hi,

I would like to trasform a int value in a corresponding QString hex value.
For example I have int value 10, and I want a QString "A".

jacek
14th January 2008, 15:41
Have you tried searching QString docs for "hex"?

nowire75
14th January 2008, 15:50
yes, I have tried, and I have used the "toHex()" member function, but it not work for me, I don't know why...

jacek
14th January 2008, 15:54
yes, I have tried, and I have used the "toHex()" member function, but it not work for me, I don't know why...
Because that's a QByteArray's method.

Try again with this page: http://doc.trolltech.com/4.3/qstring.html

nowire75
14th January 2008, 16:38
yes yes, sorry...

sometimes we only need to have the correct clue :-)

Thanks

jacek
14th January 2008, 17:00
Just in case you have ended with QString( "%1" ).arg( ... ), if you dig a bit more in the docs, you'll find QString::number( ... ) which works in a similar way, but doesn't need a QString instance.