summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2025-12-15 16:14:16 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2025-12-15 16:14:16 +0200
commit2d66011e197f96cf17b170fe10b6a78354d3117c (patch)
treee4737ff487171dc946ef33d9c355de128ab8d6d5 /src/corelib
parent8216f5c5249db2c368434129fb6f4e35cb75edfc (diff)
parentf9e9e1f1a566511d663b32e422f7b054713e5112 (diff)
Merge tag 'v6.5.8-lts-lgpl' into 6.56.5
Qt 6.5.8-lts-lgpl release
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/CMakeLists.txt1
-rw-r--r--src/corelib/Qt6CoreMacros.cmake7
-rw-r--r--src/corelib/global/qendian_p.h26
-rw-r--r--src/corelib/global/qglobalstatic.qdoc29
-rw-r--r--src/corelib/global/qlibraryinfo.cpp2
-rw-r--r--src/corelib/io/qdebug.cpp4
-rw-r--r--src/corelib/io/qdir.cpp4
-rw-r--r--src/corelib/io/qfileinfo.cpp4
-rw-r--r--src/corelib/io/qlockfile_unix.cpp18
-rw-r--r--src/corelib/io/qprocess.cpp4
-rw-r--r--src/corelib/io/qstorageinfo.cpp4
-rw-r--r--src/corelib/io/qtemporarydir.cpp5
-rw-r--r--src/corelib/io/qurl.cpp4
-rw-r--r--src/corelib/io/qurlquery.cpp4
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp17
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel_p.h4
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.cpp4
-rw-r--r--src/corelib/kernel/qbasictimer.cpp5
-rw-r--r--src/corelib/kernel/qdeadlinetimer.cpp3
-rw-r--r--src/corelib/kernel/qmetaobject.cpp4
-rw-r--r--src/corelib/kernel/qpointer.qdoc4
-rw-r--r--src/corelib/kernel/qproperty.cpp23
-rw-r--r--src/corelib/kernel/qproperty_p.h29
-rw-r--r--src/corelib/kernel/qpropertyprivate.h4
-rw-r--r--src/corelib/kernel/qtranslator.cpp94
-rw-r--r--src/corelib/kernel/qvariant.cpp4
-rw-r--r--src/corelib/mimetypes/qmimemagicrule.cpp2
-rw-r--r--src/corelib/mimetypes/qmimetype.cpp4
-rw-r--r--src/corelib/platform/darwin/qdarwinpermissionplugin_contacts.mm18
-rw-r--r--src/corelib/serialization/qcborarray.cpp3
-rw-r--r--src/corelib/serialization/qcbormap.cpp3
-rw-r--r--src/corelib/serialization/qcborvalue.cpp3
-rw-r--r--src/corelib/serialization/qjsonarray.cpp3
-rw-r--r--src/corelib/serialization/qjsondocument.cpp3
-rw-r--r--src/corelib/serialization/qjsonobject.cpp3
-rw-r--r--src/corelib/serialization/qjsonvalue.cpp3
-rw-r--r--src/corelib/serialization/qtextstream_p.h6
-rw-r--r--src/corelib/serialization/qxmlstream.g6
-rw-r--r--src/corelib/serialization/qxmlstreamparser_p.h6
-rw-r--r--src/corelib/text/qanystringview.h2
-rw-r--r--src/corelib/text/qbytearray.cpp4
-rw-r--r--src/corelib/text/qbytearrayview.h11
-rw-r--r--src/corelib/text/qcollator.cpp7
-rw-r--r--src/corelib/text/qlocale.cpp25
-rw-r--r--src/corelib/text/qlocale_data_p.h3
-rw-r--r--src/corelib/text/qlocale_p.h2
-rw-r--r--src/corelib/text/qregularexpression.cpp12
-rw-r--r--src/corelib/text/qstring.cpp4
-rw-r--r--src/corelib/thread/qexception.cpp4
-rw-r--r--src/corelib/thread/qfuturewatcher.h2
-rw-r--r--src/corelib/thread/qpromise.qdoc5
-rw-r--r--src/corelib/thread/qthread.cpp7
-rw-r--r--src/corelib/time/qdatetime.cpp25
-rw-r--r--src/corelib/time/qdatetime_p.h9
-rw-r--r--src/corelib/time/qdatetimeparser.cpp11
-rw-r--r--src/corelib/time/qhijricalendar_data_p.h3
-rw-r--r--src/corelib/time/qjalalicalendar_data_p.h3
-rw-r--r--src/corelib/time/qjuliancalendar.cpp1
-rw-r--r--src/corelib/time/qromancalendar_data_p.h3
-rw-r--r--src/corelib/time/qtimezone.cpp82
-rw-r--r--src/corelib/time/qtimezoneprivate_data_p.h4
-rw-r--r--src/corelib/tools/qbitarray.cpp4
-rw-r--r--src/corelib/tools/qcommandlineoption.cpp4
-rw-r--r--src/corelib/tools/qcontiguouscache.cpp4
-rw-r--r--src/corelib/tools/qcryptographichash.cpp76
-rw-r--r--src/corelib/tools/qeasingcurve.cpp4
-rw-r--r--src/corelib/tools/qfreelist_p.h3
-rw-r--r--src/corelib/tools/qhash.cpp8
-rw-r--r--src/corelib/tools/qlist.qdoc4
-rw-r--r--src/corelib/tools/qmap.qdoc4
-rw-r--r--src/corelib/tools/qmultimap.qdoc4
-rw-r--r--src/corelib/tools/qqueue.cpp4
-rw-r--r--src/corelib/tools/qscopedpointer.cpp15
-rw-r--r--src/corelib/tools/qset.qdoc4
-rw-r--r--src/corelib/tools/qshareddata.cpp6
-rw-r--r--src/corelib/tools/qsharedpointer.cpp8
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h6
-rw-r--r--src/corelib/tools/qsmallbytearray_p.h104
-rw-r--r--src/corelib/tools/qstack.cpp4
-rw-r--r--src/corelib/tools/qtaggedpointer.qdoc3
80 files changed, 488 insertions, 384 deletions
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 4784a310f79..9e6979f014f 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -297,6 +297,7 @@ qt_internal_add_module(Core
tools/qsharedpointer.cpp tools/qsharedpointer.h
tools/qsharedpointer_impl.h
tools/qsize.cpp tools/qsize.h
+ tools/qsmallbytearray_p.h
tools/qstack.h
tools/qtaggedpointer.h
tools/qtools_p.h
diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake
index 704130b06be..a378df5112d 100644
--- a/src/corelib/Qt6CoreMacros.cmake
+++ b/src/corelib/Qt6CoreMacros.cmake
@@ -2022,7 +2022,12 @@ function(_qt_internal_process_resource target resourceName)
list(APPEND rccArgsAllPasses "--no-zstd")
endif()
- set_property(SOURCE "${generatedResourceFile}" PROPERTY SKIP_AUTOGEN ON)
+ # Disable AUTOGEN on the generated .qrc file.
+ set(scope_args "")
+ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.18")
+ set(scope_args TARGET_DIRECTORY ${target})
+ endif()
+ set_property(SOURCE "${generatedResourceFile}" ${scope_args} PROPERTY SKIP_AUTOGEN ON)
# Set output file name for rcc command
if(isBinary)
diff --git a/src/corelib/global/qendian_p.h b/src/corelib/global/qendian_p.h
index 8d96eba60c1..1789e54ac84 100644
--- a/src/corelib/global/qendian_p.h
+++ b/src/corelib/global/qendian_p.h
@@ -21,7 +21,7 @@
QT_BEGIN_NAMESPACE
enum class QSpecialIntegerBitfieldInitializer {};
-constexpr QSpecialIntegerBitfieldInitializer QSpecialIntegerBitfieldZero{};
+constexpr inline QSpecialIntegerBitfieldInitializer QSpecialIntegerBitfieldZero{};
template<class S>
class QSpecialIntegerStorage
@@ -51,16 +51,16 @@ public:
operator Type() const noexcept
{
if constexpr (std::is_signed_v<Type>) {
- UnsignedType i = S::fromSpecial(storage->val);
+ UnsignedType i = S::fromSpecial(m_storage->val);
i <<= (sizeof(Type) * 8) - width - pos;
Type t = Type(i);
t >>= (sizeof(Type) * 8) - width;
return t;
}
- return (S::fromSpecial(storage->val) & mask()) >> pos;
+ return (S::fromSpecial(m_storage->val) & mask()) >> pos;
}
- bool operator!() const noexcept { return !(storage->val & S::toSpecial(mask())); }
+ bool operator!() const noexcept { return !(m_storage->val & S::toSpecial(mask())); }
static constexpr UnsignedType mask() noexcept
{
@@ -77,21 +77,21 @@ private:
friend class QSpecialIntegerBitfieldUnion;
friend class QSpecialIntegerAccessor<S, pos, width, T>;
- explicit QSpecialIntegerConstAccessor(Storage *storage) : storage(storage) {}
+ explicit QSpecialIntegerConstAccessor(Storage *storage) : m_storage(storage) {}
friend bool operator==(const QSpecialIntegerConstAccessor<S, pos, width, T> &i,
const QSpecialIntegerConstAccessor<S, pos, width, T> &j) noexcept
{
- return ((i.storage->val ^ j.storage->val) & S::toSpecial(mask())) == 0;
+ return ((i.m_storage->val ^ j.m_storage->val) & S::toSpecial(mask())) == 0;
}
friend bool operator!=(const QSpecialIntegerConstAccessor<S, pos, width, T> &i,
const QSpecialIntegerConstAccessor<S, pos, width, T> &j) noexcept
{
- return ((i.storage->val ^ j.storage->val) & S::toSpecial(mask())) != 0;
+ return ((i.m_storage->val ^ j.m_storage->val) & S::toSpecial(mask())) != 0;
}
- Storage *storage;
+ Storage *m_storage;
};
template<class S, int pos, int width, class T>
@@ -106,22 +106,22 @@ public:
QSpecialIntegerAccessor &operator=(Type t)
{
- UnsignedType i = S::fromSpecial(storage->val);
+ UnsignedType i = S::fromSpecial(m_storage->val);
i &= ~Const::mask();
i |= (UnsignedType(t) << pos) & Const::mask();
- storage->val = S::toSpecial(i);
+ m_storage->val = S::toSpecial(i);
return *this;
}
- operator Const() { return Const(storage); }
+ operator Const() { return Const(m_storage); }
private:
template<class Storage, typename... Accessors>
friend class QSpecialIntegerBitfieldUnion;
- explicit QSpecialIntegerAccessor(Storage *storage) : storage(storage) {}
+ explicit QSpecialIntegerAccessor(Storage *storage) : m_storage(storage) {}
- Storage *storage;
+ Storage *m_storage;
};
template<class S, typename... Accessors>
diff --git a/src/corelib/global/qglobalstatic.qdoc b/src/corelib/global/qglobalstatic.qdoc
index 38700032b18..c8fa7aaa024 100644
--- a/src/corelib/global/qglobalstatic.qdoc
+++ b/src/corelib/global/qglobalstatic.qdoc
@@ -21,7 +21,7 @@
outside of any function bodies):
\code
- Q_GLOBAL_STATIC(MyType, staticType)
+ Q_GLOBAL_STATIC(MyType, myGlobal)
\endcode
This macro is intended to replace global static objects that are not POD
@@ -29,7 +29,7 @@
name. For example, the following C++ code creates a global static:
\code
- static MyType staticType;
+ static MyType myGlobal;
\endcode
Compared to Q_GLOBAL_STATIC, and assuming that \c MyType is a class or
@@ -75,7 +75,7 @@
\code
class MyType : public MyOtherType { };
- Q_GLOBAL_STATIC(MyType, staticType)
+ Q_GLOBAL_STATIC(MyType, myGlobal)
\endcode
No body for \c MyType is required since the destructor is an implicit
@@ -89,7 +89,7 @@
public:
MyType(int i) : MyOtherType(i) {}
};
- Q_GLOBAL_STATIC_WITH_ARGS(MyType, staticType, (42))
+ Q_GLOBAL_STATIC_WITH_ARGS(MyType, myGlobal, (42))
\endcode
Alternatively, if the compiler supports C++11 inheriting constructors, one could write:
@@ -100,7 +100,7 @@
public:
using MyOtherType::MyOtherType;
};
- Q_GLOBAL_STATIC_WITH_ARGS(MyType, staticType, (42))
+ Q_GLOBAL_STATIC_WITH_ARGS(MyType, myGlobal, (42))
\endcode
\section1 Placement
@@ -246,7 +246,7 @@
The QGlobalStatic::exists() and QGlobalStatic::isDestroyed() functions
operate solely on the guard variable: the former returns \c true if the guard
- is negative, whereas the latter returns \c true only if it is -2.
+ is -1, the latter returns \c true if it is -2.
\endomit
@@ -270,7 +270,7 @@
outside of any function bodies):
\code
- Q_GLOBAL_STATIC_WITH_ARGS(MyType, staticType, (42, "Hello", "World"))
+ Q_GLOBAL_STATIC_WITH_ARGS(MyType, myGlobal, (42, "Hello", "World"))
\endcode
The \a Arguments macro parameter must always include the parentheses or, if
@@ -278,7 +278,7 @@
equivalent to
\code
- Q_GLOBAL_STATIC(MyType, staticType, 42, "Hello", "World")
+ Q_GLOBAL_STATIC(MyType, myGlobal, 42, "Hello", "World")
\endcode
Aside from the actual initialization of the contents with the supplied
@@ -304,11 +304,11 @@
follows:
\code
- Q_GLOBAL_STATIC(MyType, staticType)
+ Q_GLOBAL_STATIC(MyType, myGlobal)
\endcode
The above example creates an object of type QGlobalStatic called \c
- staticType. After the above declaration, the \c staticType object may be
+ myGlobal. After the above declaration, the \c myGlobal object may be used as
used as if it were a pointer, guaranteed to be initialized exactly once. In
addition to the use as a pointer, the object offers two methods to
determine the current status of the global: exists() and isDestroyed().
@@ -359,12 +359,13 @@
This function returns \c true if the global static object has already
completed initialization (that is, if the constructor for the type has
- already returned). In specific, note that this function returns \c false if
- the initialization is still in progress.
+ already returned) and has not yet completed destruction. In particular, note
+ that this function returns \c false if the initialization is still in
+ progress.
Once this function has returned true once, it will never return false again
- until either the program is restarted or the plugin or library containing
- the global static is unloaded and reloaded.
+ until the global static object is destroyed. The latter happens on program
+ exit or when the plugin or library containing the global static is unloaded.
This function is safe to call at any point in the program execution: it
cannot fail and cannot cause a deadlock. Additionally, it will not cause
diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp
index 82857718911..d594e122367 100644
--- a/src/corelib/global/qlibraryinfo.cpp
+++ b/src/corelib/global/qlibraryinfo.cpp
@@ -662,7 +662,7 @@ QStringList QLibraryInfo::platformPluginArguments(const QString &platformName)
/*!
\typealias QLibraryInfo::LibraryLocation
- \deprecated Use LibraryPath with QLibraryInfo::path() instead.
+ \deprecated [6.0] Use LibraryPath with QLibraryInfo::path() instead.
*/
/*!
diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp
index 8b5c685e573..b37e3d33962 100644
--- a/src/corelib/io/qdebug.cpp
+++ b/src/corelib/io/qdebug.cpp
@@ -348,9 +348,7 @@ void QDebug::putByteArray(const char *begin, size_t length, Latin1Content conten
/*!
\fn QDebug::swap(QDebug &other)
\since 5.0
-
- Swaps this debug stream instance with \a other. This function is
- very fast and never fails.
+ \memberswap{debug stream instance}
*/
/*!
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index d72f8917510..d122d04523d 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1819,9 +1819,7 @@ QDir &QDir::operator=(const QDir &dir)
/*!
\fn void QDir::swap(QDir &other)
\since 5.0
-
- Swaps this QDir instance with \a other. This function is very fast
- and never fails.
+ \memberswap{QDir instance}
*/
/*!
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 5daa37d4538..ae8f148ea60 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -449,9 +449,7 @@ QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo)
/*!
\fn void QFileInfo::swap(QFileInfo &other)
\since 5.0
-
- Swaps this file info with \a other. This function is very fast and
- never fails.
+ \memberswap{file info}
*/
/*!
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index 34aa3b65ec6..c43485e140b 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -101,12 +101,26 @@ static qint64 qt_write_loop(int fd, const char *data, qint64 len)
* actually the same. Therefore, it's a very bad idea to mix them in the same
* process.
*
- * We therefore use only flock(2).
+ * We therefore use only flock(2), except on Android.
+ *
+ * Android Compatibility:
+ * Some versions of Android have known issues where flock does not function correctly. 
+ * As a result, on Android, we use POSIX fcntl(F_SETLK) to handle file locking.
+ * fcntl is better integrated with Android’s underlying system, avoiding
+ * the limitations of flock.
*/
static bool setNativeLocks(int fd)
{
-#if defined(LOCK_EX) && defined(LOCK_NB)
+#if defined(Q_OS_ANDROID)
+ struct flock fl;
+ fl.l_type = F_WRLCK;
+ fl.l_whence = SEEK_SET;
+ fl.l_start = 0;
+ fl.l_len = 0;
+ if (fcntl(fd, F_SETLK, &fl) == -1)
+ return false;
+#elif defined(LOCK_EX) && defined(LOCK_NB)
if (flock(fd, LOCK_EX | LOCK_NB) == -1) // other threads, and other processes on a local fs
return false;
#else
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 6fe4db0e49e..9d951ce2a22 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -178,9 +178,7 @@ QProcessEnvironment &QProcessEnvironment::operator=(const QProcessEnvironment &o
/*!
\fn void QProcessEnvironment::swap(QProcessEnvironment &other)
\since 5.0
-
- Swaps this process environment instance with \a other. This
- function is very fast and never fails.
+ \memberswap{process environment instance}
*/
/*!
diff --git a/src/corelib/io/qstorageinfo.cpp b/src/corelib/io/qstorageinfo.cpp
index 25b11103b9b..5ad0f857fb1 100644
--- a/src/corelib/io/qstorageinfo.cpp
+++ b/src/corelib/io/qstorageinfo.cpp
@@ -113,9 +113,7 @@ QStorageInfo &QStorageInfo::operator=(const QStorageInfo &other)
/*!
\fn void QStorageInfo::swap(QStorageInfo &other)
-
- Swaps this volume info with \a other. This function is very fast and
- never fails.
+ \memberswap{volume info}
*/
/*!
diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp
index 433ec573839..26c0929ddf1 100644
--- a/src/corelib/io/qtemporarydir.cpp
+++ b/src/corelib/io/qtemporarydir.cpp
@@ -194,10 +194,7 @@ QTemporaryDir::QTemporaryDir(const QString &templatePath)
/*!
\fn void QTemporaryDir::swap(QTemporaryDir &other)
-
- Swaps temporary-dir \a other with this temporary-dir. This operation is
- very fast and never fails.
-
+ \memberswap{temporary-dir}
\since 6.4
*/
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index d86421a80c6..91733f98498 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3214,9 +3214,7 @@ QUrl &QUrl::operator =(const QString &url)
/*!
\fn void QUrl::swap(QUrl &other)
\since 4.8
-
- Swaps URL \a other with this URL. This operation is very
- fast and never fails.
+ \memberswap{URL}
*/
/*!
diff --git a/src/corelib/io/qurlquery.cpp b/src/corelib/io/qurlquery.cpp
index 0ae8003ec77..0276d5eb70b 100644
--- a/src/corelib/io/qurlquery.cpp
+++ b/src/corelib/io/qurlquery.cpp
@@ -385,9 +385,7 @@ QUrlQuery &QUrlQuery::operator =(const QUrlQuery &other)
/*!
\fn void QUrlQuery::swap(QUrlQuery &other)
-
- Swaps this URL query instance with \a other. This function is very
- fast and never fails.
+ \memberswap{URL query instance}
*/
/*!
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index 9f7ce935440..e1a85d9634c 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -433,9 +433,7 @@ QPersistentModelIndex &QPersistentModelIndex::operator=(const QPersistentModelIn
/*!
\fn void QPersistentModelIndex::swap(QPersistentModelIndex &other)
\since 5.0
-
- Swaps this persistent modelindex with \a other. This function is
- very fast and never fails.
+ \memberswap{persistent modelindex}
*/
/*!
@@ -3387,6 +3385,13 @@ void QAbstractItemModel::endMoveColumns()
*/
void QAbstractItemModel::beginResetModel()
{
+ Q_D(QAbstractItemModel);
+ if (d->resetting) {
+ qWarning() << "beginResetModel called on" << this << "without calling endResetModel first";
+ // Warn, but don't return early in case user code relies on the incorrect behavior.
+ }
+
+ d->resetting = true;
emit modelAboutToBeReset(QPrivateSignal());
}
@@ -3404,8 +3409,14 @@ void QAbstractItemModel::beginResetModel()
void QAbstractItemModel::endResetModel()
{
Q_D(QAbstractItemModel);
+ if (!d->resetting) {
+ qWarning() << "endResetModel called on" << this << "without calling beginResetModel first";
+ // Warn, but don't return early in case user code relies on the incorrect behavior.
+ }
+
d->invalidatePersistentIndexes();
resetInternalData();
+ d->resetting = false;
emit modelReset(QPrivateSignal());
}
diff --git a/src/corelib/itemmodels/qabstractitemmodel_p.h b/src/corelib/itemmodels/qabstractitemmodel_p.h
index e34dc3262cf..c2113fde9aa 100644
--- a/src/corelib/itemmodels/qabstractitemmodel_p.h
+++ b/src/corelib/itemmodels/qabstractitemmodel_p.h
@@ -45,6 +45,8 @@ public:
QAbstractItemModelPrivate();
~QAbstractItemModelPrivate();
+ static const QAbstractItemModelPrivate *get(const QAbstractItemModel *model) { return model->d_func(); }
+
void removePersistentIndexData(QPersistentModelIndexData *data);
void movePersistentIndexes(const QList<QPersistentModelIndexData *> &indexes, int change, const QModelIndex &parent,
Qt::Orientation orientation);
@@ -115,6 +117,8 @@ public:
void insertMultiAtEnd(const QModelIndex& key, QPersistentModelIndexData *data);
} persistent;
+ bool resetting = false;
+
static const QHash<int,QByteArray> &defaultRoleNames();
static bool isVariantLessThan(const QVariant &left, const QVariant &right,
Qt::CaseSensitivity cs = Qt::CaseSensitive, bool isLocaleAware = false);
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp
index a558a0aa2fe..4dea5eeb79a 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.cpp
+++ b/src/corelib/itemmodels/qitemselectionmodel.cpp
@@ -75,9 +75,7 @@ QT_IMPL_METATYPE_EXTERN(QItemSelection)
/*!
\fn QItemSelectionRange::swap(QItemSelectionRange &other)
\since 5.6
-
- Swaps this selection range's contents with \a other.
- This function is very fast and never fails.
+ \memberswap{selection range's contents}
*/
/*!
diff --git a/src/corelib/kernel/qbasictimer.cpp b/src/corelib/kernel/qbasictimer.cpp
index b843ec1ecfd..62e5a7347d4 100644
--- a/src/corelib/kernel/qbasictimer.cpp
+++ b/src/corelib/kernel/qbasictimer.cpp
@@ -86,6 +86,11 @@ QT_BEGIN_NAMESPACE
/*!
\fn QBasicTimer::swap(QBasicTimer &other)
+ \since 5.14
+ \memberswap{timer}
+*/
+
+/*!
\fn swap(QBasicTimer &lhs, QBasicTimer &rhs)
\since 5.14
diff --git a/src/corelib/kernel/qdeadlinetimer.cpp b/src/corelib/kernel/qdeadlinetimer.cpp
index a5d16ddf65d..ea7a23c2dbc 100644
--- a/src/corelib/kernel/qdeadlinetimer.cpp
+++ b/src/corelib/kernel/qdeadlinetimer.cpp
@@ -978,8 +978,7 @@ QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
/*!
\fn void QDeadlineTimer::swap(QDeadlineTimer &other)
-
- Swaps this deadline timer with the \a other deadline timer.
+ \memberswap{deadline timer}
*/
/*!
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 792fe986563..a9036e02032 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1734,9 +1734,7 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *
/*!
\fn QMetaObject::Connection::swap(Connection &other)
\since 5.15
-
- Swaps this Connection instance with \a other. This operation is very fast
- and never fails.
+ \memberswap{Connection instance}
*/
/*!
diff --git a/src/corelib/kernel/qpointer.qdoc b/src/corelib/kernel/qpointer.qdoc
index aebdd68428b..65b4dd649e5 100644
--- a/src/corelib/kernel/qpointer.qdoc
+++ b/src/corelib/kernel/qpointer.qdoc
@@ -100,9 +100,7 @@
/*!
\fn template <class T> void QPointer<T>::swap(QPointer &other)
\since 5.6
-
- Swaps the contents of this QPointer with the contents of \a other.
- This operation is very fast and never fails.
+ \memberswap{QPointer}
*/
/*!
diff --git a/src/corelib/kernel/qproperty.cpp b/src/corelib/kernel/qproperty.cpp
index 68f6f424104..a9021822b56 100644
--- a/src/corelib/kernel/qproperty.cpp
+++ b/src/corelib/kernel/qproperty.cpp
@@ -226,8 +226,8 @@ void Qt::endPropertyUpdateGroup()
data = data->next;
}
// notify all delayed notifications from binding evaluation
- for (const QBindingObserverPtr &observer: bindingObservers) {
- QPropertyBindingPrivate *binding = observer.binding();
+ for (const auto &bindingPtr: bindingObservers) {
+ auto *binding = static_cast<QPropertyBindingPrivate *>(bindingPtr.get());
binding->notifyNonRecursive();
}
// do the same for properties which only have observers
@@ -307,8 +307,9 @@ void QPropertyBindingPrivate::notifyRecursive()
void QPropertyBindingPrivate::notifyNonRecursive(const PendingBindingObserverList &bindingObservers)
{
notifyNonRecursive();
- for (auto &&bindingObserver: bindingObservers) {
- bindingObserver.binding()->notifyNonRecursive();
+ for (auto &&bindingPtr: bindingObservers) {
+ auto *binding = static_cast<QPropertyBindingPrivate *>(bindingPtr.get());
+ binding->notifyNonRecursive();
}
}
@@ -622,8 +623,10 @@ void QPropertyBindingData::notifyObservers(QUntypedPropertyData *propertyDataPtr
d = QPropertyBindingDataPointer {storage->bindingData(propertyDataPtr)};
if (QPropertyObserverPointer observer = d.firstObserver())
observer.notifyOnlyChangeHandler(propertyDataPtr);
- for (auto &&bindingObserver: bindingObservers)
- bindingObserver.binding()->notifyNonRecursive();
+ for (auto &&bindingPtr: bindingObservers) {
+ auto *binding = static_cast<QPropertyBindingPrivate *>(bindingPtr.get());
+ binding->notifyNonRecursive();
+ }
}
}
}
@@ -784,9 +787,11 @@ void QPropertyObserverPointer::evaluateBindings(PendingBindingObserverList &bind
if (QPropertyObserver::ObserverTag(observer->next.tag()) == QPropertyObserver::ObserverNotifiesBinding) {
auto bindingToEvaluate = observer->binding;
QPropertyObserverNodeProtector protector(observer);
- QBindingObserverPtr bindingObserver(observer); // binding must not be gone after evaluateRecursive_inline
- if (bindingToEvaluate->evaluateRecursive_inline(bindingObservers, status))
- bindingObservers.push_back(std::move(bindingObserver));
+ // binding must not be gone after evaluateRecursive_inline
+ QPropertyBindingPrivatePtr currentBinding(observer->binding);
+ const bool evalStatus = bindingToEvaluate->evaluateRecursive_inline(bindingObservers, status);
+ if (evalStatus)
+ bindingObservers.push_back(std::move(currentBinding));
next = protector.next();
}
diff --git a/src/corelib/kernel/qproperty_p.h b/src/corelib/kernel/qproperty_p.h
index 15dff50312b..6c5c73b955d 100644
--- a/src/corelib/kernel/qproperty_p.h
+++ b/src/corelib/kernel/qproperty_p.h
@@ -58,7 +58,7 @@ public:
inline QPropertyObserver *operator ->();
};
-using PendingBindingObserverList = QVarLengthArray<QBindingObserverPtr>;
+using PendingBindingObserverList = QVarLengthArray<QPropertyBindingPrivatePtr>;
// Keep all classes related to QProperty in one compilation unit. Performance of this code is crucial and
// we need to allow the compiler to inline where it makes sense.
@@ -234,21 +234,12 @@ struct CompatPropertySafePoint
struct CurrentCompatPropertyThief
{
Q_DISABLE_COPY_MOVE(CurrentCompatPropertyThief)
+ QScopedValueRollback<CompatPropertySafePoint *> m_guard;
public:
CurrentCompatPropertyThief(QBindingStatus *status)
- : status(&status->currentCompatProperty)
- , stolen(std::exchange(status->currentCompatProperty, nullptr))
+ : m_guard(status->currentCompatProperty, nullptr)
{
}
-
- ~CurrentCompatPropertyThief()
- {
- *status = stolen;
- }
-
-private:
- CompatPropertySafePoint **status = nullptr;
- CompatPropertySafePoint *stolen = nullptr;
};
}
@@ -386,11 +377,11 @@ public:
QPropertyBindingSourceLocation sourceLocation() const
{
if (!hasCustomVTable())
- return this->location;
- QPropertyBindingSourceLocation location;
+ return location;
+ QPropertyBindingSourceLocation result;
constexpr auto msg = "Custom location";
- location.fileName = msg;
- return location;
+ result.fileName = msg;
+ return result;
}
QPropertyBindingError bindingError() const { return m_error; }
QMetaType valueMetaType() const { return metaType; }
@@ -666,8 +657,10 @@ public:
// evaluateBindings() can trash the observers. We need to re-fetch here.
if (QPropertyObserverPointer observer = d.firstObserver())
observer.notifyOnlyChangeHandler(this);
- for (auto&& bindingObserver: bindingObservers)
- bindingObserver.binding()->notifyNonRecursive();
+ for (auto&& bindingPtr: bindingObservers) {
+ auto *binding = static_cast<QPropertyBindingPrivate *>(bindingPtr.get());
+ binding->notifyNonRecursive();
+ }
}
}
}
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h
index aca6d14c968..f07ced20051 100644
--- a/src/corelib/kernel/qpropertyprivate.h
+++ b/src/corelib/kernel/qpropertyprivate.h
@@ -29,8 +29,8 @@ class QBindingStorage;
template<typename Class, typename T, auto Offset, auto Setter, auto Signal, auto Getter>
class QObjectCompatProperty;
-struct QBindingObserverPtr;
-using PendingBindingObserverList = QVarLengthArray<QBindingObserverPtr>;
+class QPropertyBindingPrivatePtr;
+using PendingBindingObserverList = QVarLengthArray<QPropertyBindingPrivatePtr>;
namespace QtPrivate {
// QPropertyBindingPrivatePtr operates on a RefCountingMixin solely so that we can inline
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 2f02eef96c2..75cb0af7312 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -15,13 +15,16 @@
#include "qdatastream.h"
#include "qendian.h"
#include "qfile.h"
-#include "qmap.h"
#include "qalgorithms.h"
#include "qtranslator_p.h"
#include "qlocale.h"
+#include "qloggingcategory.h"
+#include "qdebug.h"
#include "qendian.h"
#include "qresource.h"
+#include <QtCore/private/qduplicatetracker_p.h>
+
#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
# define QT_USE_MMAP
# include "private/qcore_unix_p.h"
@@ -39,6 +42,8 @@
QT_BEGIN_NAMESPACE
+static Q_LOGGING_CATEGORY(lcTranslator, "qt.core.qtranslator")
+
namespace {
enum Tag { Tag_End = 1, Tag_SourceText16, Tag_Translation, Tag_Context16, Tag_Obsolete1,
Tag_SourceText, Tag_Context, Tag_Comment, Tag_Obsolete2 };
@@ -600,7 +605,10 @@ Q_NEVER_INLINE
static bool is_readable_file(const QString &name)
{
const QFileInfo fi(name);
- return fi.isReadable() && fi.isFile();
+ const bool isReadableFile = fi.isReadable() && fi.isFile();
+ qCDebug(lcTranslator) << "Testing file" << name << isReadableFile;
+
+ return isReadableFile;
}
static QString find_translation(const QLocale & locale,
@@ -609,6 +617,9 @@ static QString find_translation(const QLocale & locale,
const QString & directory,
const QString & suffix)
{
+ qCDebug(lcTranslator).noquote().nospace() << "Searching translation for "
+ << filename << prefix << locale << suffix
+ << " in " << directory;
QString path;
if (QFileInfo(filename).isRelative()) {
path = directory;
@@ -619,7 +630,7 @@ static QString find_translation(const QLocale & locale,
QString realname;
realname += path + filename + prefix; // using += in the hope for some reserve capacity
- const int realNameBaseSize = realname.size();
+ const qsizetype realNameBaseSize = realname.size();
// see http://www.unicode.org/reports/tr35/#LanguageMatching for inspiration
@@ -631,34 +642,71 @@ static QString find_translation(const QLocale & locale,
// that the Qt resource system is always case-sensitive, even on
// Windows (in other words: this codepath is *not* UNIX-only).
QStringList languages = locale.uiLanguages();
- for (int i = languages.size()-1; i >= 0; --i) {
- QString lang = languages.at(i);
+ for (auto &localeName : languages)
+ localeName.replace(u'-', u'_');
+ qCDebug(lcTranslator) << "Requested UI languages" << languages;
+
+ QDuplicateTracker<QString> duplicates(languages.size() * 2);
+ for (const auto &l : std::as_const(languages))
+ (void)duplicates.hasSeen(l);
+
+ for (qsizetype i = languages.size() - 1; i >= 0; --i) {
+ QString language = languages.at(i);
+
+ // Add candidates for each entry where we progressively truncate sections
+ // from the end, until a matching language tag is found. For compatibility
+ // reasons (see QTBUG-124898) we add a special case: if we find a
+ // language_Script_Territory entry (i.e. an entry with two sections), try
+ // language_Territory as well as language_Script. Use QDuplicateTracker
+ // so that we don't add any entries as fallbacks that are already in the
+ // list anyway.
+ // This is a kludge, and such entries are added at the end of the candidate
+ // list; from 6.9 on, this is fixed in QLocale::uiLanguages().
+ QStringList fallbacks;
+ const auto addIfNew = [&duplicates, &fallbacks](const QString &fallback) {
+ if (!duplicates.hasSeen(fallback))
+ fallbacks.append(fallback);
+ };
+
+ while (true) {
+ const qsizetype last = language.lastIndexOf(u'_');
+ if (last < 0) // no more sections
+ break;
+
+ const qsizetype first = language.indexOf(u'_');
+ // two sections, add fallback without script
+ if (first != last && language.count(u'_') == 2) {
+ QString fallback = language.left(first) + language.mid(last);
+ addIfNew(fallback);
+ }
+ QString fallback = language.left(last);
+ addIfNew(fallback);
+
+ language.truncate(last);
+ }
+ for (qsizetype j = fallbacks.size() - 1; j >= 0; --j)
+ languages.insert(i + 1, fallbacks.at(j));
+ }
+
+ qCDebug(lcTranslator) << "Augmented UI languages" << languages;
+ for (qsizetype i = languages.size() - 1; i >= 0; --i) {
+ const QString &lang = languages.at(i);
QString lowerLang = lang.toLower();
if (lang != lowerLang)
languages.insert(i + 1, lowerLang);
}
for (QString localeName : std::as_const(languages)) {
- localeName.replace(u'-', u'_');
-
- // try the complete locale name first and progressively truncate from
- // the end until a matching language tag is found (with or without suffix)
- for (;;) {
- realname += localeName + suffixOrDotQM;
- if (is_readable_file(realname))
- return realname;
-
- realname.truncate(realNameBaseSize + localeName.size());
- if (is_readable_file(realname))
- return realname;
+ // try each locale with and without suffix
+ realname += localeName + suffixOrDotQM;
+ if (is_readable_file(realname))
+ return realname;
- realname.truncate(realNameBaseSize);
+ realname.truncate(realNameBaseSize + localeName.size());
+ if (is_readable_file(realname))
+ return realname;
- int rightmost = localeName.lastIndexOf(u'_');
- if (rightmost <= 0)
- break; // no truncations anymore, break
- localeName.truncate(rightmost);
- }
+ realname.truncate(realNameBaseSize);
}
const int realNameBaseSizeFallbacks = path.size() + filename.size();
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 221926d218f..931be20e42c 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1016,9 +1016,7 @@ QVariant &QVariant::operator=(const QVariant &variant)
/*!
\fn void QVariant::swap(QVariant &other)
\since 4.8
-
- Swaps variant \a other with this variant. This operation is very
- fast and never fails.
+ \memberswap{variant}
*/
/*!
diff --git a/src/corelib/mimetypes/qmimemagicrule.cpp b/src/corelib/mimetypes/qmimemagicrule.cpp
index 020e2d5a228..9ce8c5e6f03 100644
--- a/src/corelib/mimetypes/qmimemagicrule.cpp
+++ b/src/corelib/mimetypes/qmimemagicrule.cpp
@@ -35,7 +35,7 @@ static constexpr auto magicRuleTypes = qOffsetStringArray(
QMimeMagicRule::Type QMimeMagicRule::type(const QByteArray &theTypeName)
{
for (int i = String; i <= Byte; ++i) {
- if (theTypeName == magicRuleTypes.at(i))
+ if (theTypeName == magicRuleTypes.viewAt(i))
return Type(i);
}
return Invalid;
diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp
index 1b2a5e239b6..c18a71370f1 100644
--- a/src/corelib/mimetypes/qmimetype.cpp
+++ b/src/corelib/mimetypes/qmimetype.cpp
@@ -122,9 +122,7 @@ QMimeType::QMimeType(const QMimeTypePrivate &dd) :
/*!
\fn void QMimeType::swap(QMimeType &other);
- Swaps QMimeType \a other with this QMimeType object.
-
- This operation is very fast and never fails.
+ \memberswap{mime type}
The swap() method helps with the implementation of assignment
operators in an exception-safe way. For more information consult
diff --git a/src/corelib/platform/darwin/qdarwinpermissionplugin_contacts.mm b/src/corelib/platform/darwin/qdarwinpermissionplugin_contacts.mm
index 3221b6dc1db..5ec612bf782 100644
--- a/src/corelib/platform/darwin/qdarwinpermissionplugin_contacts.mm
+++ b/src/corelib/platform/darwin/qdarwinpermissionplugin_contacts.mm
@@ -5,8 +5,6 @@
#include <Contacts/Contacts.h>
-QT_DEFINE_PERMISSION_STATUS_CONVERTER(CNAuthorizationStatus);
-
@interface QDarwinContactsPermissionHandler ()
@property (nonatomic, retain) CNContactStore *contactStore;
@end
@@ -21,7 +19,21 @@ QT_DEFINE_PERMISSION_STATUS_CONVERTER(CNAuthorizationStatus);
- (Qt::PermissionStatus)currentStatus
{
const auto status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts];
- return nativeStatusToQtStatus(status);
+ switch (status) {
+ case CNAuthorizationStatusAuthorized:
+#if defined(Q_OS_IOS) && QT_IOS_PLATFORM_SDK_EQUAL_OR_ABOVE(180000)
+ case CNAuthorizationStatusLimited:
+#endif
+ return Qt::PermissionStatus::Granted;
+ case CNAuthorizationStatusDenied:
+ case CNAuthorizationStatusRestricted:
+ return Qt::PermissionStatus::Denied;
+ case CNAuthorizationStatusNotDetermined:
+ return Qt::PermissionStatus::Undetermined;
+ }
+ qCWarning(lcPermissions) << "Unknown permission status" << status << "detected in"
+ << QT_STRINGIFY(QT_DARWIN_PERMISSION_PLUGIN);
+ return Qt::PermissionStatus::Denied;
}
- (QStringList)usageDescriptionsFor:(QPermission)permission
diff --git a/src/corelib/serialization/qcborarray.cpp b/src/corelib/serialization/qcborarray.cpp
index ccffc11ad94..264b7143a8b 100644
--- a/src/corelib/serialization/qcborarray.cpp
+++ b/src/corelib/serialization/qcborarray.cpp
@@ -123,8 +123,7 @@ QCborArray &QCborArray::operator=(const QCborArray &other) noexcept
/*!
\fn void QCborArray::swap(QCborArray &other)
-
- Swaps the contents of this object and \a other.
+ \memberswap{array}
*/
/*!
diff --git a/src/corelib/serialization/qcbormap.cpp b/src/corelib/serialization/qcbormap.cpp
index 57186a3d1f1..450842ca993 100644
--- a/src/corelib/serialization/qcbormap.cpp
+++ b/src/corelib/serialization/qcbormap.cpp
@@ -214,8 +214,7 @@ QCborMap &QCborMap::operator=(const QCborMap &other) noexcept
/*!
\fn void QCborMap::swap(QCborMap &other)
-
- Swaps the contents of this map and \a other.
+ \memberswap{map}
*/
/*!
diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp
index 2c7f359dc36..91ce119bd39 100644
--- a/src/corelib/serialization/qcborvalue.cpp
+++ b/src/corelib/serialization/qcborvalue.cpp
@@ -463,8 +463,7 @@ Q_DECL_UNUSED static constexpr quint64 MaximumPreallocatedElementCount =
/*!
\fn void QCborValue::swap(QCborValue &other)
-
- Swaps the contents of this QCborValue object and \a other.
+ \memberswap{value}
*/
/*!
diff --git a/src/corelib/serialization/qjsonarray.cpp b/src/corelib/serialization/qjsonarray.cpp
index 517ac116a6d..f39219804c5 100644
--- a/src/corelib/serialization/qjsonarray.cpp
+++ b/src/corelib/serialization/qjsonarray.cpp
@@ -167,8 +167,7 @@ QJsonArray &QJsonArray::operator =(const QJsonArray &other) noexcept = default;
/*!
\fn void QJsonArray::swap(QJsonArray &other)
\since 5.10
-
- Swaps the array \a other with this. This operation is very fast and never fails.
+ \memberswap{array}
*/
/*! \fn QJsonArray &QJsonArray::operator+=(const QJsonValue &value)
diff --git a/src/corelib/serialization/qjsondocument.cpp b/src/corelib/serialization/qjsondocument.cpp
index ac4ae4876d7..be5df999d80 100644
--- a/src/corelib/serialization/qjsondocument.cpp
+++ b/src/corelib/serialization/qjsondocument.cpp
@@ -177,8 +177,7 @@ QJsonDocument &QJsonDocument::operator =(const QJsonDocument &other)
/*!
\fn void QJsonDocument::swap(QJsonDocument &other)
\since 5.10
-
- Swaps the document \a other with this. This operation is very fast and never fails.
+ \memberswap{document}
*/
/*!
diff --git a/src/corelib/serialization/qjsonobject.cpp b/src/corelib/serialization/qjsonobject.cpp
index 14d26165055..8fe38fd4be4 100644
--- a/src/corelib/serialization/qjsonobject.cpp
+++ b/src/corelib/serialization/qjsonobject.cpp
@@ -152,8 +152,7 @@ QJsonObject &QJsonObject::operator =(const QJsonObject &other) noexcept = defaul
/*!
\fn void QJsonObject::swap(QJsonObject &other)
\since 5.10
-
- Swaps the object \a other with this. This operation is very fast and never fails.
+ \memberswap{object}
*/
diff --git a/src/corelib/serialization/qjsonvalue.cpp b/src/corelib/serialization/qjsonvalue.cpp
index 39564f9c76c..6984218111f 100644
--- a/src/corelib/serialization/qjsonvalue.cpp
+++ b/src/corelib/serialization/qjsonvalue.cpp
@@ -288,8 +288,7 @@ void QJsonValue::swap(QJsonValue &other) noexcept
/*!
\fn void QJsonValue::swap(QJsonValue &other)
\since 5.10
-
- Swaps the value \a other with this. This operation is very fast and never fails.
+ \memberswap{value}
*/
/*!
diff --git a/src/corelib/serialization/qtextstream_p.h b/src/corelib/serialization/qtextstream_p.h
index 909b75d0de3..db7bb7ba0dd 100644
--- a/src/corelib/serialization/qtextstream_p.h
+++ b/src/corelib/serialization/qtextstream_p.h
@@ -42,14 +42,14 @@ public:
connect(device, SIGNAL(aboutToClose()), this, SLOT(flushStream()),
Qt::DirectConnection);
}
- this->stream = stream;
+ m_stream = stream;
}
public Q_SLOTS:
- inline void flushStream() { stream->flush(); }
+ void flushStream() { m_stream->flush(); }
private:
- QTextStream *stream;
+ QTextStream *m_stream;
};
#endif
diff --git a/src/corelib/serialization/qxmlstream.g b/src/corelib/serialization/qxmlstream.g
index fc122e66811..b501c1a68d0 100644
--- a/src/corelib/serialization/qxmlstream.g
+++ b/src/corelib/serialization/qxmlstream.g
@@ -1115,8 +1115,8 @@ attribute_value_content ::= literal_content | char_ref | entity_ref_in_attribute
attribute ::= qname space_opt EQ space_opt attribute_value;
/.
case $rule_number: {
- XmlStringRef prefix = symPrefix(1);
- if (prefix.isEmpty() && symString(1) == "xmlns"_L1 && namespaceProcessing) {
+ const XmlStringRef prfx = symPrefix(1);
+ if (prfx.isEmpty() && symString(1) == "xmlns"_L1 && namespaceProcessing) {
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
namespaceDeclaration.prefix.clear();
@@ -1165,7 +1165,7 @@ attribute ::= qname space_opt EQ space_opt attribute_value;
attribute.value.pos = pos;
attribute.value.len = n;
}
- if (prefix == "xmlns"_L1 && namespaceProcessing) {
+ if (prfx == "xmlns"_L1 && namespaceProcessing) {
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
XmlStringRef namespacePrefix = symString(attribute.key);
XmlStringRef namespaceUri = symString(attribute.value);
diff --git a/src/corelib/serialization/qxmlstreamparser_p.h b/src/corelib/serialization/qxmlstreamparser_p.h
index ae3ebe7a8e1..302947e368f 100644
--- a/src/corelib/serialization/qxmlstreamparser_p.h
+++ b/src/corelib/serialization/qxmlstreamparser_p.h
@@ -714,8 +714,8 @@ bool QXmlStreamReaderPrivate::parse()
break;
case 229: {
- XmlStringRef prefix = symPrefix(1);
- if (prefix.isEmpty() && symString(1) == "xmlns"_L1 && namespaceProcessing) {
+ const XmlStringRef prfx = symPrefix(1);
+ if (prfx.isEmpty() && symString(1) == "xmlns"_L1 && namespaceProcessing) {
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
namespaceDeclaration.prefix.clear();
@@ -764,7 +764,7 @@ bool QXmlStreamReaderPrivate::parse()
attribute.value.pos = pos;
attribute.value.len = n;
}
- if (prefix == "xmlns"_L1 && namespaceProcessing) {
+ if (prfx == "xmlns"_L1 && namespaceProcessing) {
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
XmlStringRef namespacePrefix = symString(attribute.key);
XmlStringRef namespaceUri = symString(attribute.value);
diff --git a/src/corelib/text/qanystringview.h b/src/corelib/text/qanystringview.h
index c8411f96b14..dcdfbe16c65 100644
--- a/src/corelib/text/qanystringview.h
+++ b/src/corelib/text/qanystringview.h
@@ -231,13 +231,13 @@ public:
constexpr QAnyStringView(Container &&c, QtPrivate::wrapped_t<Container, QByteArray> &&capacity = {})
//noexcept(std::is_nothrow_constructible_v<QByteArray, Container>)
: QAnyStringView(capacity = std::forward<Container>(c)) {}
+
template <typename Char, if_compatible_char<Char> = true>
constexpr QAnyStringView(const Char &c) noexcept
: QAnyStringView{&c, 1} {}
template <typename Char, if_convertible_to<QChar, Char> = true>
constexpr QAnyStringView(Char ch, QCharContainer &&capacity = QCharContainer()) noexcept
: QAnyStringView{&(capacity.ch = ch), 1} {}
-
template <typename Char, typename Container = decltype(QChar::fromUcs4(U'x')),
std::enable_if_t<std::is_same_v<Char, char32_t>, bool> = true>
constexpr QAnyStringView(Char c, Container &&capacity = {}) noexcept
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index e6399baf909..def036e4856 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -1376,9 +1376,7 @@ QByteArray &QByteArray::operator=(const char *str)
/*! \fn void QByteArray::swap(QByteArray &other)
\since 4.8
-
- Swaps byte array \a other with this byte array. This operation is very
- fast and never fails.
+ \memberswap{byte array}
*/
/*! \fn qsizetype QByteArray::size() const
diff --git a/src/corelib/text/qbytearrayview.h b/src/corelib/text/qbytearrayview.h
index f822a2ca202..3ea70c97a76 100644
--- a/src/corelib/text/qbytearrayview.h
+++ b/src/corelib/text/qbytearrayview.h
@@ -15,12 +15,11 @@ QT_BEGIN_NAMESPACE
namespace QtPrivate {
template <typename Byte>
-struct IsCompatibleByteTypeHelper
- : std::integral_constant<bool,
- std::is_same_v<Byte, char> ||
- std::is_same_v<Byte, uchar> ||
- std::is_same_v<Byte, signed char> ||
- std::is_same_v<Byte, std::byte>> {};
+struct IsCompatibleByteTypeHelper : std::false_type {};
+template <> struct IsCompatibleByteTypeHelper<char> : std::true_type {};
+template <> struct IsCompatibleByteTypeHelper<signed char> : std::true_type {};
+template <> struct IsCompatibleByteTypeHelper<unsigned char> : std::true_type {};
+template <> struct IsCompatibleByteTypeHelper<std::byte> : std::true_type {};
template <typename Byte>
struct IsCompatibleByteType
diff --git a/src/corelib/text/qcollator.cpp b/src/corelib/text/qcollator.cpp
index d753a05404c..fe032bc931d 100644
--- a/src/corelib/text/qcollator.cpp
+++ b/src/corelib/text/qcollator.cpp
@@ -151,9 +151,7 @@ QCollator &QCollator::operator=(const QCollator &other)
/*!
\fn void QCollator::swap(QCollator &other)
-
- Swaps this collator with \a other. This function is very fast and
- never fails.
+ \memberswap{collator}
*/
/*!
@@ -442,8 +440,7 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other)
/*!
\fn void QCollatorSortKey::swap(QCollatorSortKey & other)
-
- Swaps this collator key with \a other.
+ \memberswap{collator key}
*/
/*!
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index 592cd68df05..d06ff22dd81 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -480,6 +480,16 @@ static qsizetype findLocaleIndexById(QLocaleId localeId)
return -1;
}
+static constexpr qsizetype locale_data_size = q20::ssize(locale_data) - 1; // trailing guard
+bool QLocaleData::allLocaleDataRows(bool (*check)(qsizetype, const QLocaleData &))
+{
+ for (qsizetype index = 0; index < locale_data_size; ++index) {
+ if (!(*check)(index, locale_data[index]))
+ return false;
+ }
+ return true;
+}
+
qsizetype QLocaleData::findLocaleIndex(QLocaleId lid)
{
QLocaleId localeId = lid;
@@ -854,8 +864,6 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l)
}
#endif // QT_NO_DATASTREAM
-static constexpr qsizetype locale_data_size = q20::ssize(locale_data) - 1; // trailing guard
-
Q_GLOBAL_STATIC(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate,
new QLocalePrivate(defaultData(), defaultIndex()))
@@ -1113,9 +1121,7 @@ bool QLocale::equals(const QLocale &other) const
/*!
\fn void QLocale::swap(QLocale &other)
\since 5.6
-
- Swaps locale \a other with this locale. This operation is very fast and
- never fails.
+ \memberswap{locale}
*/
/*!
@@ -4403,6 +4409,15 @@ QString QLocale::formattedDataSize(qint64 bytes, int precision, DataSizeFormats
is the order in which to check for translations; earlier items in the list
are to be preferred over later ones.
+ The returned list may contain entries for more than one language.
+ In particular, this happens for \l{QLocale::system()}{system locale}
+ when the user has configured the system to accept several languages
+ for user-interface translations. In such a case, the order of entries
+ for distinct languages is significant. For example, where a user has
+ configured a primarily German system to also accept English and Chinese,
+ in that order of preference, the returned list shall contain some
+ entries for German, then some for English, and finally some for Chinese.
+
Most likely you do not need to use this function directly, but just pass the
QLocale object to the QTranslator::load() function.
diff --git a/src/corelib/text/qlocale_data_p.h b/src/corelib/text/qlocale_data_p.h
index 8a41af3111a..51196ae2ed1 100644
--- a/src/corelib/text/qlocale_data_p.h
+++ b/src/corelib/text/qlocale_data_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2019 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Copyright © 2004-2023 Unicode, Inc.
+// SPDX-License-Identifier: Unicode-3.0
#ifndef QLOCALE_DATA_P_H
#define QLOCALE_DATA_P_H
diff --git a/src/corelib/text/qlocale_p.h b/src/corelib/text/qlocale_p.h
index 4669ba5003a..0c903eea27d 100644
--- a/src/corelib/text/qlocale_p.h
+++ b/src/corelib/text/qlocale_p.h
@@ -160,6 +160,8 @@ public:
// data, e.g. calendar locales, as well as the main CLDR-derived data.
[[nodiscard]] static qsizetype findLocaleIndex(QLocaleId localeId);
[[nodiscard]] static const QLocaleData *c();
+ [[nodiscard]] Q_AUTOTEST_EXPORT
+ static bool allLocaleDataRows(bool (*check)(qsizetype, const QLocaleData &));
enum DoubleForm {
DFExponent = 0,
diff --git a/src/corelib/text/qregularexpression.cpp b/src/corelib/text/qregularexpression.cpp
index bcc8dd08e79..139ab9e5acf 100644
--- a/src/corelib/text/qregularexpression.cpp
+++ b/src/corelib/text/qregularexpression.cpp
@@ -1387,9 +1387,7 @@ QRegularExpression &QRegularExpression::operator=(const QRegularExpression &re)
/*!
\fn void QRegularExpression::swap(QRegularExpression &other)
-
- Swaps the regular expression \a other with this regular expression. This
- operation is very fast and never fails.
+ \memberswap{regular expression}
*/
/*!
@@ -2108,9 +2106,7 @@ QRegularExpressionMatch &QRegularExpressionMatch::operator=(const QRegularExpres
/*!
\fn void QRegularExpressionMatch::swap(QRegularExpressionMatch &other)
-
- Swaps the match result \a other with this match result. This
- operation is very fast and never fails.
+ \memberswap{match result}
*/
/*!
@@ -2614,9 +2610,7 @@ QRegularExpressionMatchIterator &QRegularExpressionMatchIterator::operator=(cons
/*!
\fn void QRegularExpressionMatchIterator::swap(QRegularExpressionMatchIterator &other)
-
- Swaps the iterator \a other with this iterator object. This operation is
- very fast and never fails.
+ \memberswap{iterator}
*/
/*!
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 77c365ac445..e8806d51dea 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -2587,9 +2587,7 @@ QString::QString(QChar ch)
/*! \fn void QString::swap(QString &other)
\since 4.8
-
- Swaps string \a other with this string. This operation is very fast and
- never fails.
+ \memberswap{string}
*/
/*! \fn void QString::detach()
diff --git a/src/corelib/thread/qexception.cpp b/src/corelib/thread/qexception.cpp
index a623dc1c6e5..fd98505282e 100644
--- a/src/corelib/thread/qexception.cpp
+++ b/src/corelib/thread/qexception.cpp
@@ -148,9 +148,7 @@ QUnhandledException &QUnhandledException::operator=(const QUnhandledException &o
/*!
\fn void QUnhandledException::swap(QUnhandledException &other)
\since 6.0
-
- Swaps this QUnhandledException with \a other. This function is very fast and
- never fails.
+ \memberswap{unhandled exception object}
*/
/*!
diff --git a/src/corelib/thread/qfuturewatcher.h b/src/corelib/thread/qfuturewatcher.h
index 89c5b408fa7..eb1e0c507cd 100644
--- a/src/corelib/thread/qfuturewatcher.h
+++ b/src/corelib/thread/qfuturewatcher.h
@@ -74,7 +74,7 @@ public Q_SLOTS:
QT_DEPRECATED_VERSION_X_6_0("Use setSuspended() instead.")
void setPaused(bool paused);
- QT_DEPRECATED_VERSION_X_6_0("Use suspended() instead.")
+ QT_DEPRECATED_VERSION_X_6_0("Use suspend() instead.")
void pause();
QT_DEPRECATED_VERSION_X_6_0("Use toggleSuspended() instead.")
diff --git a/src/corelib/thread/qpromise.qdoc b/src/corelib/thread/qpromise.qdoc
index a3af927e8d7..588d4ff596f 100644
--- a/src/corelib/thread/qpromise.qdoc
+++ b/src/corelib/thread/qpromise.qdoc
@@ -116,7 +116,7 @@
\note You can set at most one exception throughout the computation
execution.
- \note This method must not be used after QFuture::cancel() or
+ \note This method has no effect after QFuture::cancel() or
finish().
\sa isCanceled()
@@ -243,6 +243,5 @@
*/
/*! \fn template<typename T> void QPromise<T>::swap(QPromise<T> &other) noexcept
-
- Swaps promise \a other with this promise. This operation is very fast and never fails.
+ \memberswap{promise}
*/
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 3ee9a121798..9ee89f5632b 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -354,9 +354,12 @@ QThreadPrivate::~QThreadPrivate()
\fn void QThread::started()
This signal is emitted from the associated thread when it starts executing,
- before the run() function is called.
+ so any slots connected to it may be called via queued invocation. Whilst
+ the event may have been posted before run() is called, any
+ \l {Signals and Slots Across Threads} {cross-thread delivery} of the signal
+ may still be pending.
- \sa finished()
+ \sa run(), finished()
*/
/*!
diff --git a/src/corelib/time/qdatetime.cpp b/src/corelib/time/qdatetime.cpp
index c7ab9f34f76..d49825d2607 100644
--- a/src/corelib/time/qdatetime.cpp
+++ b/src/corelib/time/qdatetime.cpp
@@ -1950,8 +1950,10 @@ QString QTime::toString(Qt::DateFormat format) const
\fn QString QTime::toString(const QString &format) const
\fn QString QTime::toString(QStringView format) const
- Returns the time as a string. The \a format parameter determines
- the format of the result string.
+ Returns a string representing the time.
+
+ The \a format parameter determines the format of the result string. If the
+ time is invalid, an empty string will be returned.
These expressions may be used:
@@ -1996,7 +1998,7 @@ QString QTime::toString(Qt::DateFormat format) const
change of case.
\row \li t
\li The timezone abbreviation (for example "CEST"). Note that time zone
- abbreviations are not unique. In particular, \l toString() cannot
+ abbreviations are not unique. In particular, \l fromString() cannot
parse this.
\row \li tt
\li The timezone's offset from UTC with no colon between the hours and
@@ -2014,6 +2016,14 @@ QString QTime::toString(Qt::DateFormat format) const
in use.
\endtable
+ \note To get localized forms of AM or PM (the \c{AP}, \c{ap}, \c{A}, \c{a},
+ \c{aP} or \c{Ap} formats) or of time zone representations (the \c{t}
+ formats), use QLocale::system().toString().
+
+ When the timezone cannot be determined or no suitable representation of it
+ is available, the \c{t} forms to represent it may be skipped. See \l
+ QTimeZone::displayName() for details of when it returns an empty string.
+
Any non-empty sequence of characters enclosed in single quotes will be
included verbatim in the output string (stripped of the quotes), even if it
contains formatting characters. Two consecutive single quotes ("''") are
@@ -2034,11 +2044,6 @@ QString QTime::toString(Qt::DateFormat format) const
\row \li H:m:s a \li 14:13:9 pm
\endtable
- If the time is invalid, an empty string will be returned.
-
- \note To get localized forms of AM or PM (the AP, ap, A, a, aP or Ap
- formats), use QLocale::system().toString().
-
\note If a format character is repeated more times than the longest
expression in the table above using it, this part of the format will be read
as several expressions with no separator between them; the longest above,
@@ -3512,9 +3517,7 @@ QDateTime &QDateTime::operator=(const QDateTime &other) noexcept
/*!
\fn void QDateTime::swap(QDateTime &other)
\since 5.0
-
- Swaps this datetime with \a other. This operation is very fast
- and never fails.
+ \memberswap{datetime}
*/
/*!
diff --git a/src/corelib/time/qdatetime_p.h b/src/corelib/time/qdatetime_p.h
index ab91ec33335..f58d731f2e2 100644
--- a/src/corelib/time/qdatetime_p.h
+++ b/src/corelib/time/qdatetime_p.h
@@ -110,17 +110,26 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimePrivate::StatusFlags)
namespace QtPrivate {
namespace DateTimeConstants {
using namespace std::chrono;
+inline
constexpr qint64 SECS_PER_MIN = minutes::period::num;
+inline
constexpr qint64 SECS_PER_HOUR = hours::period::num;
+inline
constexpr qint64 SECS_PER_DAY = SECS_PER_HOUR * 24; // std::chrono::days is C++20
+inline
constexpr qint64 MINS_PER_HOUR = std::ratio_divide<hours::period, minutes::period>::num;
+inline
constexpr qint64 MSECS_PER_SEC = milliseconds::period::den;
+inline
constexpr qint64 MSECS_PER_MIN = SECS_PER_MIN * MSECS_PER_SEC;
+inline
constexpr qint64 MSECS_PER_HOUR = SECS_PER_HOUR * MSECS_PER_SEC;
+inline
constexpr qint64 MSECS_PER_DAY = SECS_PER_DAY * MSECS_PER_SEC;
+inline
constexpr qint64 JULIAN_DAY_FOR_EPOCH = 2440588; // result of QDate(1970, 1, 1).toJulianDay()
}
}
diff --git a/src/corelib/time/qdatetimeparser.cpp b/src/corelib/time/qdatetimeparser.cpp
index 2cabcb74b21..8c59ed25a9b 100644
--- a/src/corelib/time/qdatetimeparser.cpp
+++ b/src/corelib/time/qdatetimeparser.cpp
@@ -1310,16 +1310,15 @@ QDateTimeParser::scanString(const QDateTime &defaultValue, bool fixup) const
if (parserType != QMetaType::QTime) {
if (year % 100 != year2digits && (isSet & YearSection2Digits)) {
+ const QDate date = actualDate(isSet, calendar,
+ year, year2digits, month, day, dayofweek);
if (!(isSet & YearSection)) {
- year = (year / 100) * 100;
- year += year2digits;
+ year = date.year();
} else {
conflicts = true;
const SectionNode &sn = sectionNode(currentSectionIndex);
- if (sn.type == YearSection2Digits) {
- year = (year / 100) * 100;
- year += year2digits;
- }
+ if (sn.type == YearSection2Digits)
+ year = date.year();
}
}
diff --git a/src/corelib/time/qhijricalendar_data_p.h b/src/corelib/time/qhijricalendar_data_p.h
index 1dc5425bec7..2f4d4deaddd 100644
--- a/src/corelib/time/qhijricalendar_data_p.h
+++ b/src/corelib/time/qhijricalendar_data_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2019 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Copyright © 2004-2023 Unicode, Inc.
+// SPDX-License-Identifier: Unicode-3.0
#ifndef QHIJRI_CALENDAR_DATA_P_H
#define QHIJRI_CALENDAR_DATA_P_H
diff --git a/src/corelib/time/qjalalicalendar_data_p.h b/src/corelib/time/qjalalicalendar_data_p.h
index 1aa37d475e3..23022643284 100644
--- a/src/corelib/time/qjalalicalendar_data_p.h
+++ b/src/corelib/time/qjalalicalendar_data_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2019 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Copyright © 2004-2023 Unicode, Inc.
+// SPDX-License-Identifier: Unicode-3.0
#ifndef QPERSIANCALENDAR_DATA_P_H
#define QPERSIANCALENDAR_DATA_P_H
diff --git a/src/corelib/time/qjuliancalendar.cpp b/src/corelib/time/qjuliancalendar.cpp
index 627c92c48a4..171970e1069 100644
--- a/src/corelib/time/qjuliancalendar.cpp
+++ b/src/corelib/time/qjuliancalendar.cpp
@@ -3,7 +3,6 @@
#include "qglobal.h"
#include "qjuliancalendar_p.h"
-#include "qromancalendar_data_p.h"
#include "qcalendarmath_p.h"
#include <QtCore/qmath.h>
#include <QtCore/qlocale.h>
diff --git a/src/corelib/time/qromancalendar_data_p.h b/src/corelib/time/qromancalendar_data_p.h
index dc027290d45..36abf4521d6 100644
--- a/src/corelib/time/qromancalendar_data_p.h
+++ b/src/corelib/time/qromancalendar_data_p.h
@@ -1,5 +1,6 @@
// Copyright (C) 2019 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+// Copyright © 2004-2023 Unicode, Inc.
+// SPDX-License-Identifier: Unicode-3.0
#ifndef QROMANCALENDAR_DATA_P_H
#define QROMANCALENDAR_DATA_P_H
diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp
index 0544dc10df9..960bf8efd3a 100644
--- a/src/corelib/time/qtimezone.cpp
+++ b/src/corelib/time/qtimezone.cpp
@@ -315,10 +315,10 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
The time zone offset data for a given moment in time.
- This provides the time zone offsets and abbreviation to use at that moment
- in time. When a function returns this type, it may use an invalid datetime
- to indicate that the query it is answering has no valid answer, so check
- \c{atUtc.isValid()} before using the results.
+ This provides the time zone offsets and abbreviation to use at a given
+ moment in time. When a function returns this type, it may use an invalid
+ datetime to indicate that the query it is answering has no valid answer, so
+ check \c{atUtc.isValid()} before using the results.
\list
\li OffsetData::atUtc The datetime of the offset data in UTC time.
@@ -493,9 +493,10 @@ QTimeZone::QTimeZone(int offsetSeconds)
by territory(). The \a comment is an optional note that may be displayed in
a GUI to assist users in selecting a time zone.
- The \a zoneId \e{must not} be one of the available system IDs returned by
- availableTimeZoneIds(). The \a offsetSeconds from UTC must be in the range
- -14 hours to +14 hours.
+ The \a offsetSeconds from UTC must be in the range -14 hours to +14 hours.
+ The \a zoneId \e{must not} be an ID for which isTimeZoneIdAvailable() is
+ true, unless it is a UTC-offset name that doesn't appear in
+ availableTimeZoneIds().
If the custom time zone does not have a specific territory then set it to the
default value of QLocale::AnyTerritory.
@@ -688,9 +689,7 @@ QTimeZone::~QTimeZone()
/*!
\fn QTimeZone::swap(QTimeZone &other) noexcept
-
- Swaps this time zone instance with \a other. This function is very
- fast and never fails.
+ \memberswap{time zone instance}
*/
/*!
@@ -853,17 +852,24 @@ QString QTimeZone::comment() const
}
/*!
- Returns the localized time zone display name at the given \a atDateTime
- for the given \a nameType in the given \a locale. The \a nameType and
- \a locale requested may not be supported on all platforms, in which case
- the best available option will be returned.
-
- If the \a locale is not provided then the application default locale will
- be used.
-
- The display name may change depending on DST or historical events.
+ Returns the localized time zone display name.
+
+ The name returned is the one for the given \a locale, applicable at the
+ given \a atDateTime, and of the form indicated by \a nameType. The display
+ name may change depending on DST or historical events.
+//! [display-name-caveats]
+ If no suitably localized name of the given type is available, another name
+ type may be used, or an empty string may be returned.
+
+ If the \a locale is not provided, then the application default locale will
+ be used. For custom timezones created by client code, the data supplied to
+ the constructor are used, as no localization data will be available for it.
+ If this timezone is invalid, an empty string is returned. This may also
+ arise for the representation of local time if determining the system time
+ zone fails.
This method is only available when feature \c timezone is enabled.
+//! [display-name-caveats]
\sa abbreviation()
*/
@@ -891,18 +897,13 @@ QString QTimeZone::displayName(const QDateTime &atDateTime, NameType nameType,
}
/*!
- Returns the localized time zone display name for the given \a timeType
- and \a nameType in the given \a locale. The \a nameType and \a locale
- requested may not be supported on all platforms, in which case the best
- available option will be returned.
-
- If the \a locale is not provided then the application default locale will
- be used.
+ Returns the localized time zone display name.
- Where the time zone display names have changed over time then the most
- recent names will be used.
-
- This method is only available when feature \c timezone is enabled.
+ The name returned is the one for the given \a locale, applicable when the
+ given \a timeType is in effect and of the form indicated by \a nameType.
+ Where the time zone display names have changed over time, the current names
+ will be used.
+ \include qtimezone.cpp display-name-caveats
\sa abbreviation()
*/
@@ -929,11 +930,14 @@ QString QTimeZone::displayName(TimeType timeType, NameType nameType,
}
/*!
- Returns the time zone abbreviation at the given \a atDateTime. The
- abbreviation may change depending on DST or even historical events.
+ Returns the time zone abbreviation at the given \a atDateTime.
- Note that the abbreviation is not guaranteed to be unique to this time zone
- and should not be used in place of the ID or display name.
+ The abbreviation may change depending on DST or even historical events.
+
+ \note The abbreviation is not guaranteed to be unique to this time zone and
+ should not be used in place of the ID or display name. The abbreviation may
+ be localized, depending on the underlying operating system. To get consistent
+ localization, use \c {displayName(atDateTime, QTimeZone::ShortName, locale)}.
This method is only available when feature \c timezone is enabled.
@@ -1122,9 +1126,13 @@ bool QTimeZone::isDaylightTime(const QDateTime &atDateTime) const
}
/*!
- Returns the effective offset details at the given \a forDateTime. This is
- the equivalent of calling offsetFromUtc(), abbreviation(), etc individually but is
- more efficient.
+ Returns the effective offset details at the given \a forDateTime.
+
+ This is the equivalent of calling abbreviation() and all three offset
+ functions individually but may be more efficient and may get a different
+ localization for the abbreviation. If this data is not available for the
+ given datetime, an invalid OffsetData will be returned with an invalid
+ QDateTime as its \c atUtc.
This method is only available when feature \c timezone is enabled.
diff --git a/src/corelib/time/qtimezoneprivate_data_p.h b/src/corelib/time/qtimezoneprivate_data_p.h
index 72804770f41..190ea2b4ce6 100644
--- a/src/corelib/time/qtimezoneprivate_data_p.h
+++ b/src/corelib/time/qtimezoneprivate_data_p.h
@@ -1,7 +1,7 @@
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2013 John Layt <jlayt@kde.org>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-
+// Copyright © 2004-2023 Unicode, Inc.
+// SPDX-License-Identifier: Unicode-3.0
#ifndef QTIMEZONEPRIVATE_DATA_P_H
#define QTIMEZONEPRIVATE_DATA_P_H
diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp
index b24254bd0f3..33b37f66527 100644
--- a/src/corelib/tools/qbitarray.cpp
+++ b/src/corelib/tools/qbitarray.cpp
@@ -494,9 +494,7 @@ quint32 QBitArray::toUInt32(QSysInfo::Endian endianness, bool *ok) const noexcep
/*! \fn void QBitArray::swap(QBitArray &other)
\since 4.8
-
- Swaps bit array \a other with this bit array. This operation is very
- fast and never fails.
+ \memberswap{bit array}
*/
/*! \fn bool QBitArray::operator==(const QBitArray &other) const
diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp
index 6b990cecf17..3d8d2536ee6 100644
--- a/src/corelib/tools/qcommandlineoption.cpp
+++ b/src/corelib/tools/qcommandlineoption.cpp
@@ -197,9 +197,7 @@ QCommandLineOption &QCommandLineOption::operator=(const QCommandLineOption &othe
/*!
\fn void QCommandLineOption::swap(QCommandLineOption &other)
-
- Swaps option \a other with this option. This operation is very
- fast and never fails.
+ \memberswap{option}
*/
/*!
diff --git a/src/corelib/tools/qcontiguouscache.cpp b/src/corelib/tools/qcontiguouscache.cpp
index 73cfed97f20..6140838abb2 100644
--- a/src/corelib/tools/qcontiguouscache.cpp
+++ b/src/corelib/tools/qcontiguouscache.cpp
@@ -162,9 +162,7 @@ void QContiguousCacheData::freeData(QContiguousCacheData *data)
/*! \fn template<typename T> void QContiguousCache<T>::swap(QContiguousCache<T> &other)
\since 4.8
-
- Swaps cache \a other with this cache. This operation is very
- fast and never fails.
+ \memberswap{cache}
*/
/*! \fn template<typename T> bool QContiguousCache<T>::operator==(const QContiguousCache<T> &other) const
diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp
index 4e280fcf16b..266cc336bc4 100644
--- a/src/corelib/tools/qcryptographichash.cpp
+++ b/src/corelib/tools/qcryptographichash.cpp
@@ -6,9 +6,9 @@
#include <qcryptographichash.h>
#include <qmessageauthenticationcode.h>
+#include <QtCore/private/qsmallbytearray_p.h>
#include <qiodevice.h>
#include <qmutex.h>
-#include <qvarlengtharray.h>
#include <private/qlocking_p.h>
#include <array>
@@ -124,75 +124,6 @@ static inline int SHA384_512AddLength(SHA512Context *context, unsigned int lengt
QT_BEGIN_NAMESPACE
-template <size_t N>
-class QSmallByteArray
-{
- std::array<quint8, N> m_data;
- static_assert(N <= std::numeric_limits<std::uint8_t>::max());
- quint8 m_size = 0;
-public:
- QSmallByteArray() = default;
- // all compiler-generated SMFs are ok!
- template <std::size_t M, std::enable_if_t<M < N, bool> = true> // M == N is for copy ctor!
- constexpr QSmallByteArray(const QSmallByteArray<M> &other) noexcept
- {
- assign(other);
- }
- template <std::size_t M, std::enable_if_t<M < N, bool> = true> // M == N is for copy-assignment op!
- constexpr QSmallByteArray &operator=(const QSmallByteArray<M> &other) noexcept
- {
- assign(other);
- return *this;
- }
-
- template <typename Container> // ### underconstrained
- constexpr void assign(const Container &c)
- {
- const size_t otherSize = size_t(std::size(c));
- Q_ASSERT(otherSize < N);
- memcpy(data(), std::data(c), otherSize);
- m_size = quint8(otherSize);
- }
-
- constexpr quint8 *data() noexcept { return m_data.data(); }
- constexpr const quint8 *data() const noexcept { return m_data.data(); }
- constexpr qsizetype size() const noexcept { return qsizetype{m_size}; }
- constexpr quint8 &operator[](qsizetype n)
- {
- Q_ASSERT(n < size());
- return data()[n];
- }
- constexpr const quint8 &operator[](qsizetype n) const
- {
- Q_ASSERT(n < size());
- return data()[n];
- }
- constexpr bool isEmpty() const noexcept { return size() == 0; }
- constexpr void clear() noexcept { m_size = 0; }
- constexpr void resizeForOverwrite(qsizetype s)
- {
- Q_ASSERT(s >= 0);
- Q_ASSERT(size_t(s) <= N);
- m_size = std::uint8_t(s);
- }
- constexpr void resize(qsizetype s, quint8 v)
- {
- const auto oldSize = size();
- resizeForOverwrite(s);
- if (s > oldSize)
- memset(data() + oldSize, v, size() - oldSize);
- }
- constexpr QByteArrayView toByteArrayView() const noexcept
- { return *this; }
-
- constexpr auto begin() noexcept { return data(); }
- constexpr auto begin() const noexcept { return data(); }
- constexpr auto cbegin() const noexcept { return begin(); }
- constexpr auto end() noexcept { return data() + size(); }
- constexpr auto end() const noexcept { return data() + size(); }
- constexpr auto cend() const noexcept { return end(); }
-};
-
static constexpr int hashLengthInternal(QCryptographicHash::Algorithm method) noexcept
{
switch (method) {
@@ -536,10 +467,7 @@ QCryptographicHash::~QCryptographicHash()
/*!
\fn void QCryptographicHash::swap(QCryptographicHash &other)
-
- Swaps cryptographic hash \a other with this cryptographic hash. This
- operation is very fast and never fails.
-
+ \memberswap{cryptographic hash}
\since 6.5
*/
diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp
index d8b3367de3d..397374484b0 100644
--- a/src/corelib/tools/qeasingcurve.cpp
+++ b/src/corelib/tools/qeasingcurve.cpp
@@ -1147,9 +1147,7 @@ QEasingCurve::~QEasingCurve()
/*!
\fn void QEasingCurve::swap(QEasingCurve &other)
\since 5.0
-
- Swaps curve \a other with this curve. This operation is very
- fast and never fails.
+ \memberswap{curve}
*/
/*!
diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h
index 6bbde5b4b66..5c12332aa4a 100644
--- a/src/corelib/tools/qfreelist_p.h
+++ b/src/corelib/tools/qfreelist_p.h
@@ -118,6 +118,7 @@ class QFreeList
// return which block the index \a x falls in, and modify \a x to be the index into that block
static inline int blockfor(int &x)
{
+ x = x & ConstantsType::IndexMask;
for (int i = 0; i < ConstantsType::BlockCount; ++i) {
int size = ConstantsType::Sizes[i];
if (x < size)
@@ -223,7 +224,7 @@ inline int QFreeList<T, ConstantsType>::next()
// id & ConstantsType::IndexMask,
// newid & ConstantsType::IndexMask,
// (newid & ~ConstantsType::IndexMask) >> 24);
- return id & ConstantsType::IndexMask;
+ return id;
}
template <typename T, typename ConstantsType>
diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp
index dd1d63f1d54..a616d6d50be 100644
--- a/src/corelib/tools/qhash.cpp
+++ b/src/corelib/tools/qhash.cpp
@@ -1824,16 +1824,12 @@ size_t qHash(long double key, size_t seed) noexcept
/*! \fn template <class Key, class T> void QHash<Key, T>::swap(QHash &other)
\since 4.8
-
- Swaps hash \a other with this hash. This operation is very
- fast and never fails.
+ \memberswap{hash}
*/
/*! \fn template <class Key, class T> void QMultiHash<Key, T>::swap(QMultiHash &other)
\since 4.8
-
- Swaps hash \a other with this hash. This operation is very
- fast and never fails.
+ \memberswap{multi-hash}
*/
/*! \fn template <class Key, class T> bool QHash<Key, T>::operator==(const QHash &other) const
diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc
index 52aa359c173..c7a51d63263 100644
--- a/src/corelib/tools/qlist.qdoc
+++ b/src/corelib/tools/qlist.qdoc
@@ -310,9 +310,7 @@
/*! \fn template <typename T> void QList<T>::swap(QList<T> &other)
\since 4.8
-
- Swaps list \a other with this list. This operation is very fast and
- never fails.
+ \memberswap{list}
*/
/*! \fn template <typename T> void QList<T>::swapItemsAt(qsizetype i, qsizetype j)
diff --git a/src/corelib/tools/qmap.qdoc b/src/corelib/tools/qmap.qdoc
index bbf20ef02bd..60e02c427a8 100644
--- a/src/corelib/tools/qmap.qdoc
+++ b/src/corelib/tools/qmap.qdoc
@@ -171,9 +171,7 @@
/*! \fn template <class Key, class T> void QMap<Key, T>::swap(QMap<Key, T> &other) noexcept
\since 4.8
-
- Swaps map \a other with this map. This operation is very
- fast and never fails.
+ \memberswap{map}
*/
/*! \fn template <class Key, class T> QMap<Key, T>::QMap(std::initializer_list<std::pair<Key,T> > list)
diff --git a/src/corelib/tools/qmultimap.qdoc b/src/corelib/tools/qmultimap.qdoc
index 5bc4af09407..95a42e74d8e 100644
--- a/src/corelib/tools/qmultimap.qdoc
+++ b/src/corelib/tools/qmultimap.qdoc
@@ -217,9 +217,7 @@
/*! \fn template <class Key, class T> void QMultiMap<Key, T>::swap(QMultiMap<Key, T> &other)
\since 4.8
-
- Swaps multi map \a other with this multi map. This operation is very
- fast and never fails.
+ \memberswap{multi map}
*/
/*! \fn template<class Key, class T> bool QMultiMap<Key, T>::operator==(const QMultiMap<Key, T> &lhs, const QMultiMap<Key, T> &rhs)
diff --git a/src/corelib/tools/qqueue.cpp b/src/corelib/tools/qqueue.cpp
index 82095faa3d6..74ab49b3bf9 100644
--- a/src/corelib/tools/qqueue.cpp
+++ b/src/corelib/tools/qqueue.cpp
@@ -43,9 +43,7 @@
/*!
\fn template <class T> void QQueue<T>::swap(QQueue<T> &other)
\since 4.8
-
- Swaps queue \a other with this queue. This operation is very
- fast and never fails.
+ \memberswap{queue}
*/
/*!
diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp
index 28cc39ae5df..87edbad1eda 100644
--- a/src/corelib/tools/qscopedpointer.cpp
+++ b/src/corelib/tools/qscopedpointer.cpp
@@ -227,9 +227,18 @@ QT_BEGIN_NAMESPACE
\sa isNull()
*/
+/*!
+ \fn template <typename T, typename Cleanup> void QScopedPointer<T, Cleanup>::swap(QScopedPointer &other)
+
+ \deprecated [6.2] Use \c std::unique_ptr instead; this function may let a pointer
+ escape its scope.
+
+ \memberswap{scoped pointer}
+*/
+
/*! \fn template <typename T, typename Cleanup> void QScopedPointer<T, Cleanup>::swap(QScopedPointer<T, Cleanup> &lhs, QScopedPointer<T, Cleanup> &rhs)
- \deprecated [6.1] Use \c std::unique_ptr instead; this function may let a pointer
+ \deprecated [6.2] Use \c std::unique_ptr instead; this function may let a pointer
escape its scope.
Swaps \a lhs with \a rhs.
@@ -305,10 +314,10 @@ QT_BEGIN_NAMESPACE
/*! \fn template <typename T, typename Cleanup> void QScopedArrayPointer<T, Cleanup>::swap(QScopedArrayPointer<T, Cleanup> &other)
- \deprecated [6.1] Use \c std::unique_ptr instead; this function may let a pointer
+ \deprecated [6.2] Use \c std::unique_ptr instead; this function may let a pointer
escape its scope.
- Swap this pointer with \a other.
+ \memberswap{pointer}.
*/
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc
index 759a2c626b5..d284feabf48 100644
--- a/src/corelib/tools/qset.qdoc
+++ b/src/corelib/tools/qset.qdoc
@@ -99,9 +99,7 @@
/*!
\fn template <class T> void QSet<T>::swap(QSet<T> &other)
-
- Swaps set \a other with this set. This operation is very fast and
- never fails.
+ \memberswap{set}
*/
/*!
diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp
index 8ef174ebfcf..e529c5aa30b 100644
--- a/src/corelib/tools/qshareddata.cpp
+++ b/src/corelib/tools/qshareddata.cpp
@@ -309,8 +309,7 @@ QT_BEGIN_NAMESPACE
*/
/*! \fn template <class T> void QSharedDataPointer<T>::swap(QSharedDataPointer &other)
- Swap this instance's shared data pointer with the shared
- data pointer in \a other.
+ \memberswap{shared data pointer}
*/
/*!
@@ -500,8 +499,7 @@ QT_BEGIN_NAMESPACE
*/
/*! \fn template <class T> void QExplicitlySharedDataPointer<T>::swap(QExplicitlySharedDataPointer &other)
- Swap this instance's explicitly shared data pointer with
- the explicitly shared data pointer in \a other.
+ \memberswap{explicitly-shared data pointer}
*/
/*! \fn template <class T> bool QExplicitlySharedDataPointer<T>::operator==(const QExplicitlySharedDataPointer<T>& lhs, const QExplicitlySharedDataPointer<T>& rhs)
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index db5ea2eb1d0..5e6c9e0d710 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -522,9 +522,7 @@
/*!
\fn template <class T> void QSharedPointer<T>::swap(QSharedPointer<T> &other);
\since 5.3
-
- Swaps this shared pointer instance with \a other. This function is
- very fast and never fails.
+ \memberswap{shared pointer instance}
*/
/*!
@@ -800,9 +798,7 @@
/*!
\fn template <class T> void QWeakPointer<T>::swap(QWeakPointer<T> &other)
\since 5.4
-
- Swaps this weak pointer instance with \a other. This function is
- very fast and never fails.
+ \memberswap{weak pointer instance}
*/
/*!
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 6509d03d1ba..c4476376574 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -850,6 +850,8 @@ template <class X, class T>
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast(const QSharedPointer<T> &src)
{
X *ptr = qobject_cast<X *>(src.data());
+ if (!ptr)
+ return QSharedPointer<X>();
return QtSharedPointer::copyAndSetPointer(ptr, src);
}
template <class X, class T>
@@ -892,7 +894,9 @@ template <typename X, class T>
std::shared_ptr<X> qobject_pointer_cast(const std::shared_ptr<T> &src)
{
using element_type = typename std::shared_ptr<X>::element_type;
- return std::shared_ptr<X>(src, qobject_cast<element_type *>(src.get()));
+ if (auto ptr = qobject_cast<element_type *>(src.get()))
+ return std::shared_ptr<X>(src, ptr);
+ return std::shared_ptr<X>();
}
template <typename X, class T>
diff --git a/src/corelib/tools/qsmallbytearray_p.h b/src/corelib/tools/qsmallbytearray_p.h
new file mode 100644
index 00000000000..3b45237bc8d
--- /dev/null
+++ b/src/corelib/tools/qsmallbytearray_p.h
@@ -0,0 +1,104 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QTCORE_QSMALLBYTEARRAY_P_H
+#define QTCORE_QSMALLBYTEARRAY_P_H
+
+#include <QtCore/qbytearrayview.h>
+#include <QtCore/qtconfigmacros.h>
+#include <QtCore/qtypes.h>
+
+#include <array>
+#include <limits>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+//
+// A fixed-max-size version of QByteArray. Since it's fixed-max-size, it's
+// never going to the heap. Can contain a maximum of 256 octets. Never
+// NUL-terminates on its own.
+//
+
+template <size_t N>
+class QSmallByteArray
+{
+ std::array<quint8, N> m_data;
+ static_assert(N <= (std::numeric_limits<std::uint8_t>::max)());
+ quint8 m_size = 0;
+public:
+ QSmallByteArray() = default;
+ // all compiler-generated SMFs are ok!
+ template <std::size_t M, std::enable_if_t<M < N, bool> = true> // M == N is for copy ctor!
+ constexpr QSmallByteArray(const QSmallByteArray<M> &other) noexcept
+ {
+ assign(other);
+ }
+ template <std::size_t M, std::enable_if_t<M < N, bool> = true> // M == N is for copy-assignment op!
+ constexpr QSmallByteArray &operator=(const QSmallByteArray<M> &other) noexcept
+ {
+ assign(other);
+ return *this;
+ }
+
+ template <typename Container> // ### underconstrained
+ constexpr void assign(const Container &c)
+ {
+ const size_t otherSize = size_t(std::size(c));
+ Q_ASSERT(otherSize < N);
+ memcpy(data(), std::data(c), otherSize);
+ m_size = quint8(otherSize);
+ }
+
+ constexpr quint8 *data() noexcept { return m_data.data(); }
+ constexpr const quint8 *data() const noexcept { return m_data.data(); }
+ constexpr qsizetype size() const noexcept { return qsizetype{m_size}; }
+ constexpr quint8 &operator[](qsizetype n)
+ {
+ Q_ASSERT(n < size());
+ return data()[n];
+ }
+ constexpr const quint8 &operator[](qsizetype n) const
+ {
+ Q_ASSERT(n < size());
+ return data()[n];
+ }
+ constexpr bool isEmpty() const noexcept { return size() == 0; }
+ constexpr void clear() noexcept { m_size = 0; }
+ constexpr void resizeForOverwrite(qsizetype s)
+ {
+ Q_ASSERT(s >= 0);
+ Q_ASSERT(size_t(s) <= N);
+ m_size = std::uint8_t(s);
+ }
+ constexpr void resize(qsizetype s, quint8 v)
+ {
+ const auto oldSize = size();
+ resizeForOverwrite(s);
+ if (s > oldSize)
+ memset(data() + oldSize, v, size() - oldSize);
+ }
+ constexpr QByteArrayView toByteArrayView() const noexcept
+ { return *this; }
+
+ constexpr auto begin() noexcept { return data(); }
+ constexpr auto begin() const noexcept { return data(); }
+ constexpr auto cbegin() const noexcept { return begin(); }
+ constexpr auto end() noexcept { return data() + size(); }
+ constexpr auto end() const noexcept { return data() + size(); }
+ constexpr auto cend() const noexcept { return end(); }
+};
+
+QT_END_NAMESPACE
+
+#endif // QTCORE_QSMALLBYTEARRAY_P_H
diff --git a/src/corelib/tools/qstack.cpp b/src/corelib/tools/qstack.cpp
index 5255e0e100d..da8123b0584 100644
--- a/src/corelib/tools/qstack.cpp
+++ b/src/corelib/tools/qstack.cpp
@@ -43,9 +43,7 @@
/*!
\fn template<class T> void QStack<T>::swap(QStack<T> &other)
\since 4.8
-
- Swaps stack \a other with this stack. This operation is very fast and
- never fails.
+ \memberswap{stack}
*/
/*!
diff --git a/src/corelib/tools/qtaggedpointer.qdoc b/src/corelib/tools/qtaggedpointer.qdoc
index f910e35b69e..cbd5989a65a 100644
--- a/src/corelib/tools/qtaggedpointer.qdoc
+++ b/src/corelib/tools/qtaggedpointer.qdoc
@@ -142,8 +142,7 @@
/*!
\fn template <typename T, typename Tag> void QTaggedPointer<T, Tag>::swap(QTaggedPointer<T, Tag> &other) noexcept
-
- Swaps this instance's pointer and tag with the pointer and tag in \a other.
+ \memberswap{pointer and tag}
*/
/*!