[Development] Undocumented change in behavior of QLocale toInt() between Qt4 and Qt5
Thiago Macieira
thiago.macieira at intel.com
Thu May 23 16:58:42 CEST 2013
On quinta-feira, 23 de maio de 2013 17.13.59, Simon Lees wrote:
> 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.
Hi Simon
Locale-based base encoding does not make sense. There's no language that does
that, not even the "C" language speaks hexadecimal :-)
But sure, the porting guide should be updated. I was working on this code in
QLocale a month ago and I had not even realised that it had changed from Qt 4.
Thanks for the heads-up.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130523/190d42ab/attachment.sig>
More information about the Development
mailing list