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 setDefault().
#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 setDefault(). This allows a locale to be set globally for the entire application. If setDefault() is not called, the default locale is determined from the system's locale settings.
QLocale::setDefault(QLocale::Hebrew, QLocale::Israel); QLocale hebrew; // Constructs a default QLocale QString s1 = hebrew.toString(15714.3, 'e');
When a language/country pair is specified in the constructor, one of three 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 locale name.
QLocale korean("ko"); QLocale swiss("de_CH");
This constructor converts the locale name to a language/country pair; it does not use the system locale database.
All the methods in QLocale, with the exception of setDefault(), are reentrant.
The double-to-string and string-to-double conversion functions are covered by the following licenses:
Copyright (c) 1991 by AT&T.
Permission to use, copy, modify, and distribute this software for any purpose without fee is hereby granted, provided that this entire notice is included in all copies of any software which is or includes a copy or modification of this software and in all copies of the supporting documentation for such software.
THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
This product includes software developed by the University of California, Berkeley and its contributors.
See also Text Related Classes.
This enumerated type is used to specify a country.
This enumerated type is used to specify a language.
See also setDefault().
If the string violates the 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 name().
The language and country that are actually used can be queried using language() and country().
See also setDefault(), language(), and country().
Returns a QLocale object initialized to the "C" locale.
See also system().
See also QLocale().
See also QLocale().
See also QLocale().
Warning: This function is not reentrant.
Sets the global default locale to locale. These values are used when a QLocale object is constructed with no arguments. If this function is not called, the system's locale is used.
Warning: In a multithreaded application, the default locale should be set at application startup, before any non-GUI threads are created.
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().
This file is part of the Qt toolkit. Copyright © 1995-2004 Trolltech. All Rights Reserved.
Copyright © 2004 Trolltech | Trademarks | Qt 3.3.0
|