summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/tools/qcollator.cpp6
-rw-r--r--src/corelib/tools/qcollator_p.h9
2 files changed, 6 insertions, 9 deletions
diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp
index a198208966..1cf223aae6 100644
--- a/src/corelib/tools/qcollator.cpp
+++ b/src/corelib/tools/qcollator.cpp
@@ -77,9 +77,8 @@ QT_BEGIN_NAMESPACE
\sa setLocale()
*/
QCollator::QCollator(const QLocale &locale)
- : d(new QCollatorPrivate)
+ : d(new QCollatorPrivate(locale))
{
- d->locale = locale;
d->init();
}
@@ -158,8 +157,7 @@ QCollator &QCollator::operator=(const QCollator &other)
void QCollator::detach()
{
if (d->ref.load() != 1) {
- QCollatorPrivate *x = new QCollatorPrivate;
- x->locale = d->locale;
+ QCollatorPrivate *x = new QCollatorPrivate(d->locale);
if (!d->ref.deref())
delete d;
d = x;
diff --git a/src/corelib/tools/qcollator_p.h b/src/corelib/tools/qcollator_p.h
index 71095f845d..18a43f0de6 100644
--- a/src/corelib/tools/qcollator_p.h
+++ b/src/corelib/tools/qcollator_p.h
@@ -104,19 +104,18 @@ public:
CollatorType collator = 0;
+ QCollatorPrivate(const QLocale &locale) : locale(locale) {}
+ ~QCollatorPrivate() { cleanup(); }
+
void clear() {
cleanup();
collator = 0;
}
+ // Implemented by each back-end, in its own way:
void init();
void cleanup();
- QCollatorPrivate()
- { cleanup(); }
-
- ~QCollatorPrivate() { cleanup(); }
-
private:
Q_DISABLE_COPY(QCollatorPrivate)
};