[Qt-interest] QString::toInt

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Mon Sep 5 14:39:50 CEST 2011


> “If base is 0, the C language convention is used: If the string begins with
> "0x", base 16 is used; if the string begins with "0", base 8 is used;
> otherwise, base 10 is used.”
>
> However this is not the case.

However, it is! :)

> QString str2 = "0xFF";
>
> qDebug()<<str2.toInt(); //0 zero

This is working correctly.

Hint: What is the default value of 'base' in QString::toInt() ? ;)

HTH,
-mandeep



More information about the Qt-interest-old mailing list