summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-04-18 10:43:17 +0200
committerLiang Qi <liang.qi@qt.io>2017-04-18 10:46:22 +0200
commit18934bcb0c388eb4723043cb5001702fecaf90bc (patch)
tree59f4f1e5de00fa49e49bace1a38f1bce52e48457 /src/corelib
parentbc5454d2c41873349ea32c42aca8fc794cba442e (diff)
parentd1210281e41008ce2e3510aa5cfb3ebea1c57734 (diff)
Merge remote-tracking branch 'origin/5.8' into 5.9
Conflicts: src/corelib/global/qglobal.cpp Change-Id: I375fa4afa662fa411a15f212ebd5f2f0dffdba7f
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qglobal.cpp20
-rw-r--r--src/corelib/io/qfileselector.cpp10
-rw-r--r--src/corelib/tools/qlocale.cpp4
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h5
-rw-r--r--src/corelib/tools/qstringbuilder.cpp28
5 files changed, 43 insertions, 24 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 1f93d3cbec..c37503f3db 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -2628,12 +2628,14 @@ QString QSysInfo::kernelVersion()
to determine the distribution name and returns that. If determining the
distribution name failed, it returns "unknown".
- \b{Darwin, \macos, iOS, tvOS, and watchOS note}: this function returns
- "macos" for \macos systems, "ios" for iOS systems, "tvos" for tvOS systems,
- "watchos" for watchOS systems, and "darwin" in case the system could not
- be determined.
+ \b{\macos note}: this function returns "osx" for all \macos systems,
+ regardless of Apple naming convention. The returned string will be updated
+ for Qt 6. Note that this function erroneously returned "macos" for \macos
+ 10.12 in Qt versions 5.6.2, 5.7.1, and 5.8.0.
- \b{OS X note}: this function returns "osx" for versions of \macos prior to 10.12.
+ \b{Darwin, iOS, tvOS, and watchOS note}: this function returns "ios" for
+ iOS systems, "tvos" for tvOS systems, "watchos" for watchOS systems, and
+ "darwin" in case the system could not be determined.
\b{FreeBSD note}: this function returns "debian" for Debian/kFreeBSD and
"unknown" otherwise.
@@ -2666,10 +2668,12 @@ QString QSysInfo::productType()
#elif defined(Q_OS_WATCHOS)
return QStringLiteral("watchos");
#elif defined(Q_OS_MACOS)
- const auto version = QOperatingSystemVersion::current();
- if (version.majorVersion() == 10 && version.minorVersion() < 12)
- return QStringLiteral("osx");
+ // ### Qt6: remove fallback
+# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QStringLiteral("macos");
+# else
+ return QStringLiteral("osx");
+# endif
#elif defined(Q_OS_DARWIN)
return QStringLiteral("darwin");
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index cb4f5c4b07..9db67f2f9b 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -363,6 +363,7 @@ void QFileSelectorPrivate::updateSelectors()
QStringList QFileSelectorPrivate::platformSelectors()
{
// similar, but not identical to QSysInfo::osType
+ // ### Qt6: remove macOS fallbacks to "mac" and the future compatibility
QStringList ret;
#if defined(Q_OS_WIN)
ret << QStringLiteral("windows");
@@ -380,12 +381,11 @@ QStringList QFileSelectorPrivate::platformSelectors()
# endif
# endif
QString productName = QSysInfo::productType();
-# ifdef Q_OS_MACOS
- if (productName != QLatin1String("osx"))
- ret << QStringLiteral("osx"); // compatibility
-# endif
if (productName != QLatin1String("unknown"))
- ret << productName; // "opensuse", "fedora", "macos", "ios", "android"
+ ret << productName; // "opensuse", "fedora", "osx", "ios", "android"
+# if defined(Q_OS_MACOS)
+ ret << QStringLiteral("macos"); // future compatibility
+# endif
#endif
return ret;
}
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index bde4bf553e..697e0062dd 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -38,13 +38,13 @@
**
****************************************************************************/
+#include "qglobal.h"
+
#if !defined(QWS) && defined(Q_OS_MAC)
# include "private/qcore_mac_p.h"
# include <CoreFoundation/CoreFoundation.h>
#endif
-#include "qglobal.h"
-
#include "qplatformdefs.h"
#include "qdatastream.h"
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 0d42c8a212..15573c5588 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -260,6 +260,7 @@ namespace QtSharedPointer {
internalSafetyCheckRemove(self);
deleter(self);
}
+ static void noDeleter(ExternalRefCountData *) { }
static inline ExternalRefCountData *create(T **ptr, DestroyerFn destroy)
{
@@ -433,11 +434,13 @@ public:
# else
typename Private::DestroyerFn destroy = &Private::deleter;
# endif
+ typename Private::DestroyerFn noDestroy = &Private::noDeleter;
QSharedPointer result(Qt::Uninitialized);
- result.d = Private::create(&result.value, destroy);
+ result.d = Private::create(&result.value, noDestroy);
// now initialize the data
new (result.data()) T(std::forward<Args>(arguments)...);
+ result.d->destroyer = destroy;
result.d->setQObjectShared(result.value, true);
# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
internalSafetyCheckAdd(result.d, result.value);
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index de12de19cb..70152a9202 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
\reentrant
\since 4.6
- \brief The QStringBuilder class is a template class that provides a facility to build up QStrings from smaller chunks.
+ \brief The QStringBuilder class is a template class that provides a facility to build up QStrings and QByteArrays from smaller chunks.
\ingroup tools
\ingroup shared
@@ -58,22 +58,34 @@ QT_BEGIN_NAMESPACE
To build a QString by multiple concatenations, QString::operator+()
- is typically used. This causes \e{n - 1} reallocations when building
- a string from \e{n} chunks.
+ is typically used. This causes \e{n - 1} allocations when building
+ a string from \e{n} chunks. The same is true for QByteArray.
QStringBuilder uses expression templates to collect the individual
chunks, compute the total size, allocate the required amount of
- memory for the final QString object, and copy the chunks into the
+ memory for the final string object, and copy the chunks into the
allocated memory.
The QStringBuilder class is not to be used explicitly in user
code. Instances of the class are created as return values of the
- operator%() function, acting on objects of type QString,
- QLatin1String, QStringRef, QChar, QCharRef,
- QLatin1Char, and \c char.
+ operator%() function, acting on objects of the following types:
+
+ For building QStrings:
+
+ \li QString, QStringRef,
+ \li QChar, QCharRef, QLatin1Char,
+ \li QLatin1String,
+ \li QByteArray, \c char, \c{const char[]}.
+
+ The types in the last list point are only available when
+ QT_NO_CAST_FROM_ASCII is not defined.
+
+ For building QByteArrays:
+
+ \li QByteArray, \c char, \c{const char[]}.
Concatenating strings with operator%() generally yields better
- performance then using \c QString::operator+() on the same chunks
+ performance than using \c QString::operator+() on the same chunks
if there are three or more of them, and performs equally well in other
cases.