A better (or should I say a perfect) example is available at Nokia Developer Community Wiki.
It goes like this:
/* hexadecimal 0xED8788DC is equivavelent to decimal 3985082588 */
bool ok;
uint appId = str.toUInt(&ok,16); //appId contains 3985082588
/* decimal 3985082588 is equivalent to hex ED8788DC */
uint decimal = 3985082588;
haxadecimal.setNum(decimal,16); //now hexadecimal contains ED8788DC
/* hexadecimal 0xED8788DC is equivavelent to decimal 3985082588 */
QString str = "0xED8788DC";
bool ok;
uint appId = str.toUInt(&ok,16); //appId contains 3985082588
/* decimal 3985082588 is equivalent to hex ED8788DC */
uint decimal = 3985082588;
QString hexadecimal;
haxadecimal.setNum(decimal,16); //now hexadecimal contains ED8788DC
To copy to clipboard, switch view to plain text mode
I hope this will help.
Bookmarks