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

Frans Klaver fransklaver at gmail.com
Wed Oct 26 13:01:52 CEST 2011

On Wed, Oct 26, 2011 at 12:50 PM, Andre Somers <andre at familiesomers.nl> wrote:

> Note that the verification flag would be optional anyway. If you return
> false if ok is false, then you can easily choose if you need
> verification or not. It just needs to be clearly documented.

As always.

> However, if
> you think that it would be good for readability, wouldn't it then make
> sense to have a way to do this in a localized way as well? The various
> true & false strings could conceivably be in QLocale? Otherwise, you
> still end up in the same situation if your application needs
> localization (and most do, I think).

The localized way should be done the same way as one would handle
localized numbers (like properly handling 1,234.56 and 1.234,56).

>> What would you do if you couldn't parse string. Make the assumption
>> you can, and enable the super fast renderer?
> I *might* want to bail out and warn the user, but it depends on the
> situation, of course.

Of course. I would think however that in these cases you shouldn't
really be explicitly relying on QString::toBool(), but that is a
completely different discussion altogether.

More information about the Development mailing list