PDA

View Full Version : Set QLocale local once or in every class?



homerun4711
19th January 2011, 10:23
Hello!

I would like to use the following code


QLocale local;
QString test += local.toString(number, 'f', 2);


Is there something like qApp-wide variable that contains the QLocale setting or is it neccessary to use

QLocale local;
in every class it is used?

Kind regards,
HomeR

wysota
19th January 2011, 10:54
You can use a temporary:

QString test += QLocale().toString(number, 'f', 2);

or a static instance:

QString test += QLocale::system().toString(number, 'f', 2);