summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2012-03-22 10:53:45 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-26 11:41:07 +0200
commit8660f6e385b2070db1b33dab85b5686a00fec06b (patch)
tree6046c82010c5e29454cfe071be0ca80ec70e683a /src/corelib/tools
parentbc0b37d6b61fc8ab83026d6a5e515666e58d7938 (diff)
Fix measurement system for the UK
THe UK still uses the Imperial system at least for distances and many other things. Change-Id: I99379de35620114328ad6a7fc9b226a46692bedd Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qlocale.cpp2
-rw-r--r--src/corelib/tools/qlocale.h7
-rw-r--r--src/corelib/tools/qlocale.qdoc8
-rw-r--r--src/corelib/tools/qlocale_data_p.h10
4 files changed, 18 insertions, 9 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index e40917c5d8..2d1444c315 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -2080,7 +2080,7 @@ QLocale::MeasurementSystem QLocalePrivate::measurementSystem() const
for (int i = 0; i < ImperialMeasurementSystemsCount; ++i) {
if (ImperialMeasurementSystems[i].languageId == m_language_id
&& ImperialMeasurementSystems[i].countryId == m_country_id) {
- return QLocale::ImperialSystem;
+ return ImperialMeasurementSystems[i].system;
}
}
return QLocale::MetricSystem;
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index c029f627b2..6c97a05ba8 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -565,7 +565,12 @@ public:
};
// GENERATED PART ENDS HERE
- enum MeasurementSystem { MetricSystem, ImperialSystem };
+ enum MeasurementSystem {
+ MetricSystem,
+ ImperialUSSystem,
+ ImperialUKSystem,
+ ImperialSystem = ImperialUSSystem // Qt 4 compatibility
+ };
enum FormatType { LongFormat, ShortFormat, NarrowFormat };
enum NumberOption {
diff --git a/src/corelib/tools/qlocale.qdoc b/src/corelib/tools/qlocale.qdoc
index 8e90d7d94e..02a6ef1c6d 100644
--- a/src/corelib/tools/qlocale.qdoc
+++ b/src/corelib/tools/qlocale.qdoc
@@ -672,9 +672,11 @@
\value MetricSystem This value indicates metric units, such as meters,
centimeters and millimeters.
- \value ImperialSystem This value indicates imperial units, such as inches and
- miles. There are several distinct imperial systems in the world; this
- value stands for the official United States imperial units.
+ \value ImperialUSSystem This value indicates imperial units, such as inches and
+ miles as they are used in the United States.
+ \value ImperialUKSystem This value indicates imperial units, such as inches and
+ miles as they are used in the United Kingdom.
+ \value ImperialSystem Provided for compatibility. Same as ImperialUSSystem
\since 4.4
*/
diff --git a/src/corelib/tools/qlocale_data_p.h b/src/corelib/tools/qlocale_data_p.h
index 1508b982f1..db19e5bcd6 100644
--- a/src/corelib/tools/qlocale_data_p.h
+++ b/src/corelib/tools/qlocale_data_p.h
@@ -62,12 +62,14 @@ struct CountryLanguage
{
quint16 languageId;
quint16 countryId;
+ QLocale::MeasurementSystem system;
};
static const CountryLanguage ImperialMeasurementSystems[] = {
- { 31, 225 },
- { 31, 226 },
- { 111, 225 },
- { 163, 225 }
+ { QLocale::English, QLocale::UnitedStates, QLocale::ImperialUSSystem },
+ { QLocale::English, QLocale::UnitedStatesMinorOutlyingIslands, QLocale::ImperialUSSystem },
+ { QLocale::Spanish, QLocale::UnitedStates, QLocale::ImperialUSSystem },
+ { QLocale::Hawaiian, QLocale::UnitedStates, QLocale::ImperialUSSystem },
+ { QLocale::English, QLocale::UnitedKingdom, QLocale::ImperialUKSystem }
};
static const int ImperialMeasurementSystemsCount =
sizeof(ImperialMeasurementSystems)/sizeof(ImperialMeasurementSystems[0]);