[Development] Development Digest, Vol 20, Issue 50

Simon Lees Simon.Lees at codan.com.au
Fri May 24 06:46:45 CEST 2013


On 24/05/13 14:07, development-request at qt-project.org wrote:
> Date: Thu, 23 May 2013 07:58:42 -0700
> From: Thiago Macieira<thiago.macieira at intel.com>
> Subject: Re: [Development] Undocumented change in behavior of QLocale
>          toInt() between Qt4 and Qt5
> To:development at qt-project.org
> Message-ID: <31941258.asBcdyDE2l at tjmaciei-mobl2>
> Content-Type: text/plain; charset="us-ascii"
>
> 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:-)

I Agree, the reason i picked it up is because in our Qt4 code we had to 
force base 10 as it was desirable for us to have leading zero's in some 
cases. When porting i noticed the base was no longer there and went 
diging to figure out what it was.

>
> 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




More information about the Development mailing list