diff options
author | Edward Welbourne <[email protected]> | 2024-04-05 15:50:19 +0200 |
---|---|---|
committer | Edward Welbourne <[email protected]> | 2024-04-11 23:45:36 +0200 |
commit | f57899e191acad2dcdf76cfb4d71c96379812c41 (patch) | |
tree | 100b6c9e7d7c84bb6018f514e9cc4767a389a0ff | |
parent | d6863a8028ce4f706fe7f426a8d5a5a8f6f182db (diff) |
Pass QVariant to QSystemLocale::query() as rvalue reference
QVariant is rather big for passing by value; and no caller has any
further use for the QVariant it's passing in.
File qlocale_wasm.cpp was added after 6.5, so drop its change.
Task-number: QTBUG-122619
Change-Id: I2751745e715aacfa8982ac97b4ae777fde5e88de
Reviewed-by: Thiago Macieira <[email protected]>
(cherry picked from commit b68f1009187fee473f4c6477ec64300650e29904)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
(cherry picked from commit 644eca89ed288adbcd7a4a604797be567796711d)
Reviewed-by: MÃ¥rten Nordheim <[email protected]>
-rw-r--r-- | src/corelib/text/qlocale.qdoc | 2 | ||||
-rw-r--r-- | src/corelib/text/qlocale_mac.mm | 2 | ||||
-rw-r--r-- | src/corelib/text/qlocale_p.h | 2 | ||||
-rw-r--r-- | src/corelib/text/qlocale_unix.cpp | 7 | ||||
-rw-r--r-- | src/corelib/text/qlocale_win.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidsystemlocale.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidsystemlocale.h | 2 | ||||
-rw-r--r-- | tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 2 |
8 files changed, 11 insertions, 10 deletions
diff --git a/src/corelib/text/qlocale.qdoc b/src/corelib/text/qlocale.qdoc index fcc4ab4cfb1..f81c10a87fe 100644 --- a/src/corelib/text/qlocale.qdoc +++ b/src/corelib/text/qlocale.qdoc @@ -1153,7 +1153,7 @@ */ /*! - \fn QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const + \fn QVariant QSystemLocale::query(QueryType type, QVariant &&in = QVariant()) const Generic query method for locale data. Provides indirection. Denotes the \a type of the query diff --git a/src/corelib/text/qlocale_mac.mm b/src/corelib/text/qlocale_mac.mm index 0fedc2594de..b6b4b4bb394 100644 --- a/src/corelib/text/qlocale_mac.mm +++ b/src/corelib/text/qlocale_mac.mm @@ -571,7 +571,7 @@ static QLocale::Language codeToLanguage(QStringView s) return QLocalePrivate::codeToLanguage(s); } -QVariant QSystemLocale::query(QueryType type, QVariant in) const +QVariant QSystemLocale::query(QueryType type, QVariant &&in) const { QMacAutoReleasePool pool; diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index d97f459528b..c0aad17c81a 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -98,7 +98,7 @@ public: StandaloneDayNameShort, // QString, in: int StandaloneDayNameNarrow // QString, in: int }; - virtual QVariant query(QueryType type, QVariant in = QVariant()) const; + virtual QVariant query(QueryType type, QVariant &&in = QVariant()) const; virtual QLocale fallbackLocale() const; inline qsizetype fallbackLocaleIndex() const; diff --git a/src/corelib/text/qlocale_unix.cpp b/src/corelib/text/qlocale_unix.cpp index 03e332367ed..09f46597b22 100644 --- a/src/corelib/text/qlocale_unix.cpp +++ b/src/corelib/text/qlocale_unix.cpp @@ -124,7 +124,7 @@ QLocale QSystemLocale::fallbackLocale() const return QLocale(lang); } -QVariant QSystemLocale::query(QueryType type, QVariant in) const +QVariant QSystemLocale::query(QueryType type, QVariant &&in) const { QSystemLocaleData *d = qSystemLocaleData(); @@ -258,9 +258,10 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const return d->uiLanguages.isEmpty() ? QVariant() : QVariant(d->uiLanguages); } case StringToStandardQuotation: - return lc_messages.quoteString(qvariant_cast<QStringView>(in)); + return lc_messages.quoteString(qvariant_cast<QStringView>(std::move(in))); case StringToAlternateQuotation: - return lc_messages.quoteString(qvariant_cast<QStringView>(in), QLocale::AlternateQuotation); + return lc_messages.quoteString(qvariant_cast<QStringView>(std::move(in)), + QLocale::AlternateQuotation); case ListToSeparatedString: return lc_messages.createSeparatedList(in.toStringList()); case LocaleChanged: diff --git a/src/corelib/text/qlocale_win.cpp b/src/corelib/text/qlocale_win.cpp index 7fae5585ac5..66fcea64197 100644 --- a/src/corelib/text/qlocale_win.cpp +++ b/src/corelib/text/qlocale_win.cpp @@ -837,7 +837,7 @@ QLocale QSystemLocale::fallbackLocale() const return QLocale(QString::fromLatin1(getWinLocaleName())); } -QVariant QSystemLocale::query(QueryType type, QVariant in) const +QVariant QSystemLocale::query(QueryType type, QVariant &&in) const { QSystemLocalePrivate *d = systemLocalePrivate(); switch(type) { diff --git a/src/plugins/platforms/android/qandroidsystemlocale.cpp b/src/plugins/platforms/android/qandroidsystemlocale.cpp index 1713e862804..167c6336216 100644 --- a/src/plugins/platforms/android/qandroidsystemlocale.cpp +++ b/src/plugins/platforms/android/qandroidsystemlocale.cpp @@ -39,7 +39,7 @@ void QAndroidSystemLocale::getLocaleFromJava() const m_locale = QLocale(languageCode + u'_' + countryCode); } -QVariant QAndroidSystemLocale::query(QueryType type, QVariant in) const +QVariant QAndroidSystemLocale::query(QueryType type, QVariant &&in) const { if (type == LocaleChanged) { getLocaleFromJava(); diff --git a/src/plugins/platforms/android/qandroidsystemlocale.h b/src/plugins/platforms/android/qandroidsystemlocale.h index cde62386665..381c4367f65 100644 --- a/src/plugins/platforms/android/qandroidsystemlocale.h +++ b/src/plugins/platforms/android/qandroidsystemlocale.h @@ -14,7 +14,7 @@ class QAndroidSystemLocale : public QSystemLocale public: QAndroidSystemLocale(); - QVariant query(QueryType type, QVariant in) const override; + QVariant query(QueryType type, QVariant &&in) const override; QLocale fallbackLocale() const override; private: diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 4829a361b4d..329c9402140 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -3633,7 +3633,7 @@ public: { } - QVariant query(QueryType type, QVariant /*in*/) const override + QVariant query(QueryType type, QVariant &&/*in*/) const override { switch (type) { case UILanguages: |