[Development] Undocumented change in behavior of QLocale toInt() between Qt4 and Qt5

Simon Lees Simon.Lees at codan.com.au
Thu May 23 09:43:59 CEST 2013


Hi All,
Seen as i don't have points to make doc notes or edit the wiki and 
within 3 minutes of searching i couldn't find a easy way to reach the 
doc team ill send this here.

QLocale toInt in Qt 4 took a default paramater for base = 0, this means 
that the default behavior is to handle the conversion as octal if there 
is a leading 0 or has hex etc, etc. In our code we force base 10 because 
the behavior of base 0 is undesirable for us.
In Qt5 QLocale does not have a paramater for base, it is also not 
documented whether the conversion is handled as base 0 or 10. Having 
spent 5 mins digging through source code i can confirm it is 10. It 
would be nice if someone could update the porting guide and QLocale 
documentation to mention this as it is a change of behavior that has 
probably gone left unnoticed by alot of people although in my case i 
think the Qt5 handling is more sensible.

Cheers,

Simon



More information about the Development mailing list