diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-01-29 16:57:12 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2020-01-29 16:57:27 +0100 |
commit | a1dbdcbd6e818118f5fc28cdd39e47a02380adbd (patch) | |
tree | 0d813d9d72baeb1b5f7be048e775896c73f134f5 /src/corelib/text | |
parent | 67ea445f09db9feea4e863faa12c45fb007f53a4 (diff) | |
parent | 4cbadf699838406d14366ce61deec03cf45113f7 (diff) |
Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts:
src/corelib/Qt5CoreConfigExtras.cmake.in
src/corelib/Qt5CoreMacros.cmake
src/dbus/Qt5DBusConfigExtras.cmake.in
src/widgets/Qt5WidgetsConfigExtras.cmake.in
Change-Id: Ib782f3b177c38b2cce83beebe15be9c0baa578f7
Diffstat (limited to 'src/corelib/text')
-rw-r--r-- | src/corelib/text/qlocale.cpp | 18 | ||||
-rw-r--r-- | src/corelib/text/qlocale_unix.cpp | 12 | ||||
-rw-r--r-- | src/corelib/text/qstringlist.cpp | 10 | ||||
-rw-r--r-- | src/corelib/text/text.pri | 2 |
4 files changed, 21 insertions, 21 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 93a8abb1ce..6dbec8ba33 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -734,23 +734,23 @@ static void updateSystemPrivate() globalLocaleData.m_script_id = res.toInt(); res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_decimal = res.toString().at(0).unicode(); res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_group = res.toString().at(0).unicode(); res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_zero = res.toString().at(0).unicode(); res = sys_locale->query(QSystemLocale::NegativeSign, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_minus = res.toString().at(0).unicode(); res = sys_locale->query(QSystemLocale::PositiveSign, QVariant()); - if (!res.isNull()) + if (!res.isNull() && !res.toString().isEmpty()) globalLocaleData.m_plus = res.toString().at(0).unicode(); } #endif // !QT_NO_SYSTEMLOCALE @@ -2430,7 +2430,7 @@ QTime QLocale::toTime(const QString &string, const QString &format, QCalendar ca { QTime time; #if QT_CONFIG(datetimeparser) - QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, cal); + QDateTimeParser dt(QMetaType::QTime, QDateTimeParser::FromString, cal); dt.setDefaultLocale(*this); if (dt.parseFormat(format)) dt.fromString(string, nullptr, &time); @@ -2469,7 +2469,7 @@ QDate QLocale::toDate(const QString &string, const QString &format, QCalendar ca { QDate date; #if QT_CONFIG(datetimeparser) - QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal); + QDateTimeParser dt(QMetaType::QDate, QDateTimeParser::FromString, cal); dt.setDefaultLocale(*this); if (dt.parseFormat(format)) dt.fromString(string, &date, nullptr); @@ -2510,7 +2510,7 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCal QTime time; QDate date; - QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString, cal); + QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal); dt.setDefaultLocale(*this); if (dt.parseFormat(format) && dt.fromString(string, &date, &time)) return QDateTime(date, time); @@ -4463,6 +4463,8 @@ QStringList QLocale::uiLanguages() const for (const auto entry : qAsConst(uiLanguages)) locales.append(QLocale(entry)); } + if (locales.isEmpty()) + locales.append(systemLocale()->fallbackUiLocale()); } else #endif { diff --git a/src/corelib/text/qlocale_unix.cpp b/src/corelib/text/qlocale_unix.cpp index 5e1e47eae7..207331b8ac 100644 --- a/src/corelib/text/qlocale_unix.cpp +++ b/src/corelib/text/qlocale_unix.cpp @@ -234,16 +234,16 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const case CurrencySymbol: return lc_monetary.currencySymbol(QLocale::CurrencySymbolFormat(in.toUInt())); case CurrencyToString: { - switch (in.type()) { - case QVariant::Int: + switch (in.userType()) { + case QMetaType::Int: return lc_monetary.toCurrencyString(in.toInt()); - case QVariant::UInt: + case QMetaType::UInt: return lc_monetary.toCurrencyString(in.toUInt()); - case QVariant::Double: + case QMetaType::Double: return lc_monetary.toCurrencyString(in.toDouble()); - case QVariant::LongLong: + case QMetaType::LongLong: return lc_monetary.toCurrencyString(in.toLongLong()); - case QVariant::ULongLong: + case QMetaType::ULongLong: return lc_monetary.toCurrencyString(in.toULongLong()); default: break; diff --git a/src/corelib/text/qstringlist.cpp b/src/corelib/text/qstringlist.cpp index 4bbe424ed2..4b9dcee169 100644 --- a/src/corelib/text/qstringlist.cpp +++ b/src/corelib/text/qstringlist.cpp @@ -43,9 +43,9 @@ #if QT_CONFIG(regularexpression) # include <qregularexpression.h> #endif +#include <private/qduplicatetracker_p.h> #include <algorithm> - QT_BEGIN_NAMESPACE /*! \typedef QStringListIterator @@ -885,15 +885,13 @@ int QtPrivate::QStringList_removeDuplicates(QStringList *that) { int n = that->size(); int j = 0; - QSet<QString> seen; + + QDuplicateTracker<QString> seen; seen.reserve(n); - int setSize = 0; for (int i = 0; i < n; ++i) { const QString &s = that->at(i); - seen.insert(s); - if (setSize == seen.size()) // unchanged size => was already seen + if (seen.hasSeen(s)) continue; - ++setSize; if (j != i) that->swapItemsAt(i, j); ++j; diff --git a/src/corelib/text/text.pri b/src/corelib/text/text.pri index 25e281f37a..d2a02059c7 100644 --- a/src/corelib/text/text.pri +++ b/src/corelib/text/text.pri @@ -48,7 +48,7 @@ SOURCES += \ NO_PCH_SOURCES += text/qstring_compat.cpp false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator -!nacl:macos: { +!nacl:darwin: { SOURCES += text/qlocale_mac.mm } else:unix { |