Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QLocale class converts between numbers and their string representations in various languages. More...
Almost all the functions in this class are reentrant when Qt is built with thread support. The exception is setDefaultLocale().
#include <qlocale.h>
It is initialized with a country/language pair in its constructor and offers number-to-string and string-to-number conversion functions simmilar to those in QString.
QLocale egyptian(QLocale::Arabic, QLocale::Egypt); QString s1 = egyptian.toString(1.571429E+07, 'e'); QString s2 = egyptian.toString(10); double d = egyptian.toDouble(s1); int s2 = egyptian.toInt(s2);
Additionally, QLocale supports the concept of a default locale, which can be set with the static member setDefaultLocale(). This allows a locale to be set globally for the entire application.
QLocale::setDefaultLocale(QLocale::German, QLocale::Switzerland); QLocale swiss; // Constructor parameters default to DefaultLanguage/DefaultCountry QString s1 = swiss.toString(15714.3, 'e');
When a language/country pair is specified in the constructor, one of four things can happen:
The "C" locale is identical to English/UnitedStates.
Use language() and country() to determine the actual language and country values used.
An alternative method for constructing a QLocale object is by specifying the Unix locale name.
QLocale korean("ko"); QLocale swiss("de_CH");
This constructor converts the Unix locale name to a language/country pair; it does not use the system locale database present on Unix.
All the methods in QLocale, with the exception of setDefaultLocale(), are reentrant.
See also Text Related Classes.
This enumerated type is used to specify a country.
This enumerated type is used to specify a language.
If the string violates the Unix locale format, or language is not a valid ISO 369 code, the "C" locale is used instead. If country is not present, or is not a valid ISO 3166 code, the most appropriate country is chosen for the specified language.
The language and country codes are converted to their respective Language and Country enums. After this conversion is performed the constructor behaves exactly like QLocale(Country, Language).
This constructor is much slower than QLocale(Country, Language).
See also unixLocaleName().
QLocale might use different language/country values than specified in the constructor, depending on what's available in the database. The language and country that are actually used can be queried using language() and country().
See also setDefaultLocale(), language(), and country().
See also QLocale().
See also QLocale().
Warning: This function is not reentrant.
Sets the global default locale to language and country. These values are used when a QLocale object is constructed with DefaultLanguage and DefaultCountry.
Warning: This method is not reentrant. The default locale should be set at application startup, before any new threads are created.
See also QLocale(), language(), and country().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
See also toLongLong().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
See also toShort().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
See also toUShort().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
See also toInt().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
See also toUInt().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
See also toLong().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
See also toULong().
See also toULongLong().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
f and prec have the same meaning as in QString::number(double, char, int).
See also toDouble().
f and prec have the same meaning as in QString::number(double, char, int).
See also toDouble().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
If ok is not 0, reports failure by setting *ok to false and success by setting *ok to true.
See also toString().
See also QLocale().
This file is part of the Qt toolkit. Copyright © 1995-2003 Trolltech. All Rights Reserved.
Copyright © 2003 Trolltech | Trademarks | Qt 3.3.0b1
|