PDA

View Full Version : How to change locale



memus
19th May 2010, 13:16
Hi there,
i have problem with QLocale.
When i try to set other locale:

QLocale::setDefault(QLocale::English, QLocale::UnitedStates);
qDebug() << QLocale::system().language();
Output should be 31 but is 90 (my locale). Why?

tbscope
19th May 2010, 13:20
You do not set the system locale when using the setDefault function, only the locale for your program (process)

memus
19th May 2010, 14:38
You do not set the system locale when using the setDefault function, only the locale for your program (process)
I need to get QDate::fromString from english str locale. How can i do that?

squidge
19th May 2010, 14:44
Since setDefault works on the current process, that should function correctly. The only thing you can't do is change the locale of other applications.

tbscope
19th May 2010, 14:45
Try the following:



QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));

myDate.fromString(..., Qt::DefaultLocaleShortDate);

goli
29th May 2011, 12:50
how can you change the locale from a qml application?:o