diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-03-06 00:11:52 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-06 00:11:52 +0100 |
commit | b86106387350f673a20d3b0a2413023f6205169b (patch) | |
tree | 2dfc079f1eecbbf9fde8733430a3a1e2f04d9a42 /src/corelib/tools | |
parent | 88918abddeb323340c4a49dda035898a740373da (diff) | |
parent | 5e8ae03578ecd0538a774505f2f7e2fc626b0ab7 (diff) |
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qlocale_mac.mm | 22 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 15 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 3 |
3 files changed, 31 insertions, 9 deletions
diff --git a/src/corelib/tools/qlocale_mac.mm b/src/corelib/tools/qlocale_mac.mm index b3dff3a83a..8594cfd40d 100644 --- a/src/corelib/tools/qlocale_mac.mm +++ b/src/corelib/tools/qlocale_mac.mm @@ -432,18 +432,26 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const case CurrencyToString: return macFormatCurrency(in.value<QSystemLocale::CurrencyToStringArgument>()); case UILanguages: { - QCFType<CFArrayRef> languages = (CFArrayRef)CFPreferencesCopyValue( + QCFType<CFPropertyListRef> languages = (CFArrayRef)CFPreferencesCopyValue( CFSTR("AppleLanguages"), kCFPreferencesAnyApplication, kCFPreferencesCurrentUser, kCFPreferencesAnyHost); - const int cnt = languages == NULL ? 0 : CFArrayGetCount(languages); QStringList result; - result.reserve(cnt); - for (int i = 0; i < cnt; ++i) { - const QString lang = QCFString::toQString( - static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages, i))); - result.append(lang); + CFTypeID typeId = CFGetTypeID(languages); + if (typeId == CFArrayGetTypeID()) { + const int cnt = CFArrayGetCount(languages.as<CFArrayRef>()); + result.reserve(cnt); + for (int i = 0; i < cnt; ++i) { + const QString lang = QCFString::toQString( + static_cast<CFStringRef>(CFArrayGetValueAtIndex(languages.as<CFArrayRef>(), i))); + result.append(lang); + } + } else if (typeId == CFStringGetTypeID()) { + result = QStringList(QCFString::toQString(languages.as<CFStringRef>())); + } else { + qWarning("QLocale::uiLanguages(): CFPreferencesCopyValue returned unhandled type \"%s\"; please report to http://bugreports.qt-project.org", + qPrintable(QCFString::toQString(CFCopyTypeIDDescription(typeId)))); } return QVariant(result); } diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 3089cfef8b..75ef07a96e 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -9553,6 +9553,8 @@ float QStringRef::toFloat(bool *ok) const */ /*! + \since 5.0 + Converts a plain text string to an HTML string with HTML metacharacters \c{<}, \c{>}, \c{&}, and \c{"} replaced by HTML entities. @@ -9621,6 +9623,19 @@ QString QString::toHtmlEscaped() const \code if (attribute.name() == QLatin1String("http-contents-length")) //... \endcode + + \note There some restrictions when using the MSVC 2010 or 2012 compilers. The example snippets provided here + fail to compile with them. + \list + \li Concatenated string literals cannot be used with QStringLiteral. + \code + QString s = QStringLiteral("a" "b"); + \endcode + \li QStringLiteral cannot be used to initialize lists or arrays of QString. + \code + QString a[] = { QStringLiteral("a"), QStringLiteral("b") }; + \endcode + \endlist */ QT_END_NAMESPACE diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index c1b20c58e9..7d5cf91324 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -504,8 +504,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo } if (d != x) { if (!d->ref.deref()) { - Q_ASSERT(!isShared); - if (QTypeInfo<T>::isStatic || !aalloc) { + if (QTypeInfo<T>::isStatic || !aalloc || (isShared && QTypeInfo<T>::isComplex)) { // data was copy constructed, we need to call destructors // or if !alloc we did nothing to the old 'd'. freeData(d); |