[Development] New feature to qstring | QString::toBool()

Andre Somers andre at familiesomers.nl
Thu Oct 27 21:25:28 CEST 2011

Op 27-10-2011 20:13, Andreas Aardal Hanssen schreef:
> 2011/10/26 Christoph Feck<christoph at maxiom.de>
>> As far as I remember, POSIX locales offer strings or regexps for YES
>> and NO, so it might be possible to add something to QLocale to access
>> those strings.
> By auto-converting a QString to a bool we'll be adding ambiguity to Qt
> APIs. If there's no intuitive way to convert a QString to a boolean,
> then QString IMO should not provide that as a function... I find it
> especially disturbing that translatability and locale is considered.
> Literal interpretation of a string needs to be completely unambiguous,
> just like QString("123").toInt() is.
QString("1,234").toDouble() also isn't all that clear either, only the 
QLocale version of those is localized.
With a US locale, that would result in 1234.0 (more than a thousand), 
while in the Netherlands, it would be 1.234 (one and a bit).

*If* QString::toBool is introduced, there needs to be a properly 
localized or at least localizable version in QLocale as well, I think.


More information about the Development mailing list