[Interest] QVariant toString locale

Thiago Macieira thiago.macieira at intel.com
Wed Oct 17 17:10:47 CEST 2018

On Wednesday, 17 October 2018 07:10:04 PDT Etienne Sandré-Chardonnal wrote:
>  1) Handle all possible QVariant subtypes in a big switch block, I'd like
> to avoid...
> So as you see, it seems there is a hole in Qt's otherwise excellent
> handling of locales. Am I wrong? Is there a good solution?

Yeah, but our handling of QVariant is nowhere as good. That big switch is 
something we've also tried to avoid, but to the point that we know it's 
lacking and improperly done. There are a few updates for 5.12 that remove some 
of the old code, but nothing that would help you.

The light at the end of the tunnel is that you don't need to handle all types, 
only those that do get affected by the locale. That's usually those containing 
floating point. I'd handle those first in your conversion and everything else 
simply pass to QVariant::toString

Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center

More information about the Interest mailing list