diff options
-rw-r--r-- | src/corelib/text/qlocale.cpp | 10 | ||||
-rw-r--r-- | src/corelib/text/qlocale.h | 5 | ||||
-rw-r--r-- | src/corelib/text/qlocale_mac.mm | 4 | ||||
-rw-r--r-- | src/corelib/text/qlocale_p.h | 6 | ||||
-rw-r--r-- | src/corelib/text/qlocale_unix.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/android/qandroidsystemlocale.cpp | 4 | ||||
-rw-r--r-- | tests/auto/corelib/text/qlocale/tst_qlocale.cpp | 1 |
7 files changed, 16 insertions, 18 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 96b6646c90..a2cf2caec0 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -1124,22 +1124,20 @@ QLocale::NumberOptions QLocale::numberOptions() const } /*! + \fn QString QLocale::quoteString(const QString &str, QuotationStyle style) const + \since 4.8 Returns \a str quoted according to the current locale using the given quotation \a style. */ -QString QLocale::quoteString(const QString &str, QuotationStyle style) const -{ - return quoteString(QStringRef(&str), style); -} /*! - \since 4.8 + \since 6.0 \overload */ -QString QLocale::quoteString(const QStringRef &str, QuotationStyle style) const +QString QLocale::quoteString(QStringView str, QuotationStyle style) const { #ifndef QT_NO_SYSTEMLOCALE if (d->m_data == systemData()) { diff --git a/src/corelib/text/qlocale.h b/src/corelib/text/qlocale.h index e501a33764..509e19b4ba 100644 --- a/src/corelib/text/qlocale.h +++ b/src/corelib/text/qlocale.h @@ -1120,8 +1120,9 @@ public: NumberOptions numberOptions() const; enum QuotationStyle { StandardQuotation, AlternateQuotation }; - QString quoteString(const QString &str, QuotationStyle style = StandardQuotation) const; - QString quoteString(const QStringRef &str, QuotationStyle style = StandardQuotation) const; + QString quoteString(const QString &str, QuotationStyle style = StandardQuotation) const + { return quoteString(QStringView(str), style); } + QString quoteString(QStringView str, QuotationStyle style = StandardQuotation) const; QString createSeparatedList(const QStringList &strl) const; diff --git a/src/corelib/text/qlocale_mac.mm b/src/corelib/text/qlocale_mac.mm index b1e067a8c2..95c8769096 100644 --- a/src/corelib/text/qlocale_mac.mm +++ b/src/corelib/text/qlocale_mac.mm @@ -380,7 +380,7 @@ static QString macFormatCurrency(const QSystemLocale::CurrencyToStringArgument & return QString::fromCFString(result); } -static QVariant macQuoteString(QSystemLocale::QueryType type, const QStringRef &str) +static QVariant macQuoteString(QSystemLocale::QueryType type, QStringView str) { QString begin, end; QCFType<CFLocaleRef> locale = CFLocaleCopyCurrent(); @@ -494,7 +494,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const } case StringToStandardQuotation: case StringToAlternateQuotation: - return macQuoteString(type, in.value<QStringRef>()); + return macQuoteString(type, in.value<QStringView>()); default: break; } diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h index 42d434eac4..751e254d53 100644 --- a/src/corelib/text/qlocale_p.h +++ b/src/corelib/text/qlocale_p.h @@ -116,8 +116,8 @@ public: CurrencyToString, // QString in: qlonglong, qulonglong or double Collation, // QString UILanguages, // QStringList - StringToStandardQuotation, // QString in: QStringRef to quote - StringToAlternateQuotation, // QString in: QStringRef to quote + StringToStandardQuotation, // QString in: QStringView to quote + StringToAlternateQuotation, // QString in: QStringView to quote ScriptId, // uint ListToSeparatedString, // QString LocaleChanged, // system locale changed @@ -515,7 +515,7 @@ Q_STATIC_ASSERT(!ascii_isspace(uchar('\377'))); QT_END_NAMESPACE -Q_DECLARE_METATYPE(QStringRef) +Q_DECLARE_METATYPE(QStringView) Q_DECLARE_METATYPE(QList<Qt::DayOfWeek>) #ifndef QT_NO_SYSTEMLOCALE Q_DECLARE_METATYPE(QSystemLocale::CurrencyToStringArgument) diff --git a/src/corelib/text/qlocale_unix.cpp b/src/corelib/text/qlocale_unix.cpp index 207331b8ac..51b23f1559 100644 --- a/src/corelib/text/qlocale_unix.cpp +++ b/src/corelib/text/qlocale_unix.cpp @@ -283,9 +283,9 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const return d->uiLanguages.isEmpty() ? QVariant() : QVariant(d->uiLanguages); } case StringToStandardQuotation: - return lc_messages.quoteString(qvariant_cast<QStringRef>(in)); + return lc_messages.quoteString(qvariant_cast<QStringView>(in)); case StringToAlternateQuotation: - return lc_messages.quoteString(qvariant_cast<QStringRef>(in), QLocale::AlternateQuotation); + return lc_messages.quoteString(qvariant_cast<QStringView>(in), QLocale::AlternateQuotation); case ListToSeparatedString: return lc_messages.createSeparatedList(in.toStringList()); case LocaleChanged: diff --git a/src/plugins/platforms/android/qandroidsystemlocale.cpp b/src/plugins/platforms/android/qandroidsystemlocale.cpp index f9d566ff1a..96f461f773 100644 --- a/src/plugins/platforms/android/qandroidsystemlocale.cpp +++ b/src/plugins/platforms/android/qandroidsystemlocale.cpp @@ -156,9 +156,9 @@ QVariant QAndroidSystemLocale::query(QueryType type, QVariant in) const return QString(); } case StringToStandardQuotation: - return m_locale.quoteString(in.value<QStringRef>()); + return m_locale.quoteString(in.value<QStringView>()); case StringToAlternateQuotation: - return m_locale.quoteString(in.value<QStringRef>(), QLocale::AlternateQuotation); + return m_locale.quoteString(in.value<QStringView>(), QLocale::AlternateQuotation); case ListToSeparatedString: return m_locale.createSeparatedList(in.value<QStringList>()); case LocaleChanged: diff --git a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp index 4078805221..073d0548fa 100644 --- a/tests/auto/corelib/text/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/text/qlocale/tst_qlocale.cpp @@ -58,7 +58,6 @@ #endif Q_DECLARE_METATYPE(QLocale::FormatType) -Q_DECLARE_METATYPE(QStringView) class tst_QLocale : public QObject { |