summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/codecs/qbig5codec_p.h20
-rw-r--r--src/corelib/corelib.pro1
-rw-r--r--src/corelib/global/qnamespace.qdoc6
-rw-r--r--src/corelib/global/qprocessordetection.h1
-rw-r--r--src/corelib/io/qdir.cpp3
-rw-r--r--src/corelib/io/qfilesystemwatcher_win_p.h6
-rw-r--r--src/corelib/io/qprocess.cpp3
-rw-r--r--src/corelib/itemmodels/qidentityproxymodel.cpp8
-rw-r--r--src/corelib/itemmodels/qtransposeproxymodel.cpp8
-rw-r--r--src/corelib/kernel/qcore_mac_objc.mm49
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp19
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h34
-rw-r--r--src/corelib/kernel/qmetaobject.cpp2
-rw-r--r--src/corelib/kernel/qmetatype.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp15
-rw-r--r--src/corelib/kernel/qvariant.cpp8
-rw-r--r--src/corelib/platform/platform.pri1
-rw-r--r--src/corelib/platform/wasm/qstdweb.cpp236
-rw-r--r--src/corelib/platform/wasm/qstdweb_p.h169
-rw-r--r--src/corelib/platform/wasm/wasm.pri3
-rw-r--r--src/corelib/plugin/quuid.cpp2
-rw-r--r--src/corelib/serialization/qcborvalue.cpp16
-rw-r--r--src/corelib/serialization/qcborvalue.h10
-rw-r--r--src/corelib/serialization/qjsoncbor.cpp7
-rw-r--r--src/corelib/thread/qfuturewatcher.cpp2
-rw-r--r--src/corelib/thread/qsemaphore.cpp4
-rw-r--r--src/corelib/thread/qthread_unix.cpp5
-rw-r--r--src/corelib/thread/qwaitcondition_unix.cpp4
-rw-r--r--src/corelib/tools/qbytearray.cpp54
-rw-r--r--src/corelib/tools/qdatetime.cpp42
-rw-r--r--src/corelib/tools/qdatetimeparser.cpp11
-rw-r--r--src/corelib/tools/qlist.cpp1
-rw-r--r--src/corelib/tools/qlocale.cpp52
-rw-r--r--src/corelib/tools/qshareddata.cpp6
-rw-r--r--src/corelib/tools/qsharedpointer.cpp8
-rw-r--r--src/corelib/tools/qsimd.cpp4
-rw-r--r--src/corelib/tools/qstring.cpp44
-rw-r--r--src/corelib/tools/qstringview.cpp12
-rw-r--r--src/corelib/tools/qvector.h1
39 files changed, 706 insertions, 173 deletions
diff --git a/src/corelib/codecs/qbig5codec_p.h b/src/corelib/codecs/qbig5codec_p.h
index 2db8377ee3..c17afae1c4 100644
--- a/src/corelib/codecs/qbig5codec_p.h
+++ b/src/corelib/codecs/qbig5codec_p.h
@@ -69,12 +69,12 @@ public:
static QList<QByteArray> _aliases();
static int _mibEnum();
- QByteArray name() const { return _name(); }
- QList<QByteArray> aliases() const { return _aliases(); }
- int mibEnum() const { return _mibEnum(); }
+ QByteArray name() const override { return _name(); }
+ QList<QByteArray> aliases() const override { return _aliases(); }
+ int mibEnum() const override { return _mibEnum(); }
- QString convertToUnicode(const char *, int, ConverterState *) const;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
};
class QBig5hkscsCodec : public QTextCodec {
@@ -83,12 +83,12 @@ public:
static QList<QByteArray> _aliases() { return QList<QByteArray>(); }
static int _mibEnum();
- QByteArray name() const { return _name(); }
- QList<QByteArray> aliases() const { return _aliases(); }
- int mibEnum() const { return _mibEnum(); }
+ QByteArray name() const override { return _name(); }
+ QList<QByteArray> aliases() const override { return _aliases(); }
+ int mibEnum() const override { return _mibEnum(); }
- QString convertToUnicode(const char *, int, ConverterState *) const;
- QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const;
+ QString convertToUnicode(const char *, int, ConverterState *) const override;
+ QByteArray convertFromUnicode(const QChar *, int, ConverterState *) const override;
};
QT_END_NAMESPACE
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 2323512a30..dc43e56836 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -44,6 +44,7 @@ include(codecs/codecs.pri)
include(serialization/serialization.pri)
include(statemachine/statemachine.pri)
include(mimetypes/mimetypes.pri)
+include(platform/platform.pri)
win32 {
LIBS_PRIVATE += -lws2_32
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 652efb10bf..5bba8c5fe5 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -2208,6 +2208,12 @@
\value MSWindowsFixedSizeDialogHint Gives the window a thin dialog border on Windows.
This style is traditionally used for fixed-size dialogs.
+ \note The use of this flag is not recommended in multi-monitor
+ environments. This is because the system will enforce that the window
+ maintains its native size when moving it across screens. This is
+ particularly undesirable when using monitors with different
+ resolutions.
+
\value MSWindowsOwnDC Gives the window its own display
context on Windows.
diff --git a/src/corelib/global/qprocessordetection.h b/src/corelib/global/qprocessordetection.h
index 77b3ba36b0..1f327c352e 100644
--- a/src/corelib/global/qprocessordetection.h
+++ b/src/corelib/global/qprocessordetection.h
@@ -324,7 +324,6 @@
// -- Web Assembly --
#elif defined(__EMSCRIPTEN__)
# define Q_PROCESSOR_WASM
-# define Q_PROCESSOR_X86 6 // enables SIMD support
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
# define Q_PROCESSOR_WORDSIZE 8
#endif
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 9c4ae5a1c0..671913e92f 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1084,7 +1084,10 @@ void QDir::setNameFilters(const QStringList &nameFilters)
void QDir::addResourceSearchPath(const QString &path)
{
#ifdef QT_BUILD_CORE_LIB
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QResource::addSearchPath(path);
+QT_WARNING_POP
#else
Q_UNUSED(path)
#endif
diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h
index 1d3224614c..272591ce7a 100644
--- a/src/corelib/io/qfilesystemwatcher_win_p.h
+++ b/src/corelib/io/qfilesystemwatcher_win_p.h
@@ -77,8 +77,8 @@ public:
explicit QWindowsFileSystemWatcherEngine(QObject *parent);
~QWindowsFileSystemWatcherEngine();
- QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories);
- QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories);
+ QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
+ QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
class Handle
{
@@ -154,7 +154,7 @@ public:
QWindowsFileSystemWatcherEngineThread();
~QWindowsFileSystemWatcherEngineThread();
- void run();
+ void run() override;
void stop();
void wakeup();
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 83849980ae..d5d67d86f3 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -1175,7 +1175,10 @@ bool QProcessPrivate::_q_processDied()
//emit q->standardErrorClosed();
#if QT_DEPRECATED_SINCE(5, 13)
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
emit q->finished(exitCode);
+QT_WARNING_POP
#endif
emit q->finished(exitCode, exitStatus);
}
diff --git a/src/corelib/itemmodels/qidentityproxymodel.cpp b/src/corelib/itemmodels/qidentityproxymodel.cpp
index f869601d3f..bb92857786 100644
--- a/src/corelib/itemmodels/qidentityproxymodel.cpp
+++ b/src/corelib/itemmodels/qidentityproxymodel.cpp
@@ -480,13 +480,13 @@ void QIdentityProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &topLeft
Q_ASSERT(topLeft.isValid() ? topLeft.model() == model : true);
Q_ASSERT(bottomRight.isValid() ? bottomRight.model() == model : true);
Q_Q(QIdentityProxyModel);
- q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight), roles);
+ emit q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight), roles);
}
void QIdentityProxyModelPrivate::_q_sourceHeaderDataChanged(Qt::Orientation orientation, int first, int last)
{
Q_Q(QIdentityProxyModel);
- q->headerDataChanged(orientation, first, last);
+ emit q->headerDataChanged(orientation, first, last);
}
void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &sourceParents, QAbstractItemModel::LayoutChangeHint hint)
@@ -505,7 +505,7 @@ void QIdentityProxyModelPrivate::_q_sourceLayoutAboutToBeChanged(const QList<QPe
parents << mappedParent;
}
- q->layoutAboutToBeChanged(parents, hint);
+ emit q->layoutAboutToBeChanged(parents, hint);
const auto proxyPersistentIndexes = q->persistentIndexList();
for (const QPersistentModelIndex &proxyPersistentIndex : proxyPersistentIndexes) {
@@ -540,7 +540,7 @@ void QIdentityProxyModelPrivate::_q_sourceLayoutChanged(const QList<QPersistentM
parents << mappedParent;
}
- q->layoutChanged(parents, hint);
+ emit q->layoutChanged(parents, hint);
}
void QIdentityProxyModelPrivate::_q_sourceModelAboutToBeReset()
diff --git a/src/corelib/itemmodels/qtransposeproxymodel.cpp b/src/corelib/itemmodels/qtransposeproxymodel.cpp
index dd84b97118..f15435739c 100644
--- a/src/corelib/itemmodels/qtransposeproxymodel.cpp
+++ b/src/corelib/itemmodels/qtransposeproxymodel.cpp
@@ -81,7 +81,7 @@ void QTransposeProxyModelPrivate::onLayoutChanged(const QList<QPersistentModelIn
proxyHint = QAbstractItemModel::HorizontalSortHint;
else if (hint == QAbstractItemModel::HorizontalSortHint)
proxyHint = QAbstractItemModel::VerticalSortHint;
- q->layoutChanged(proxyParents, proxyHint);
+ emit q->layoutChanged(proxyParents, proxyHint);
}
void QTransposeProxyModelPrivate::onLayoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint)
@@ -108,19 +108,19 @@ void QTransposeProxyModelPrivate::onLayoutAboutToBeChanged(const QList<QPersiste
proxyHint = QAbstractItemModel::HorizontalSortHint;
else if (hint == QAbstractItemModel::HorizontalSortHint)
proxyHint = QAbstractItemModel::VerticalSortHint;
- q->layoutAboutToBeChanged(proxyParents, proxyHint);
+ emit q->layoutAboutToBeChanged(proxyParents, proxyHint);
}
void QTransposeProxyModelPrivate::onDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles)
{
Q_Q(QTransposeProxyModel);
- q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight), roles);
+ emit q->dataChanged(q->mapFromSource(topLeft), q->mapFromSource(bottomRight), roles);
}
void QTransposeProxyModelPrivate::onHeaderDataChanged(Qt::Orientation orientation, int first, int last)
{
Q_Q(QTransposeProxyModel);
- q->headerDataChanged(orientation == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal, first, last);
+ emit q->headerDataChanged(orientation == Qt::Horizontal ? Qt::Vertical : Qt::Horizontal, first, last);
}
void QTransposeProxyModelPrivate::onColumnsAboutToBeInserted(const QModelIndex &parent, int first, int last)
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm
index bc23e821fd..4550891e2a 100644
--- a/src/corelib/kernel/qcore_mac_objc.mm
+++ b/src/corelib/kernel/qcore_mac_objc.mm
@@ -48,6 +48,11 @@
#include <UIKit/UIKit.h>
#endif
+#include <execinfo.h>
+#include <dlfcn.h>
+#include <cxxabi.h>
+#include <objc/runtime.h>
+
#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -127,12 +132,54 @@ QT_USE_NAMESPACE
}
@end
QT_NAMESPACE_ALIAS_OBJC_CLASS(QMacAutoReleasePoolTracker);
+
QT_BEGIN_NAMESPACE
QMacAutoReleasePool::QMacAutoReleasePool()
: pool([[NSAutoreleasePool alloc] init])
{
- [[[QMacAutoReleasePoolTracker alloc] initWithPool:
+ Class trackerClass = [QMacAutoReleasePoolTracker class];
+
+#ifdef QT_DEBUG
+ void *poolFrame = nullptr;
+ if (__builtin_available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)) {
+ void *frame;
+ if (backtrace_from_fp(__builtin_frame_address(0), &frame, 1))
+ poolFrame = frame;
+ } else {
+ static const int maxFrames = 3;
+ void *callstack[maxFrames];
+ if (backtrace(callstack, maxFrames) == maxFrames)
+ poolFrame = callstack[maxFrames - 1];
+ }
+
+ if (poolFrame) {
+ Dl_info info;
+ if (dladdr(poolFrame, &info) && info.dli_sname) {
+ const char *symbolName = info.dli_sname;
+ if (symbolName[0] == '_') {
+ int status;
+ if (char *demangled = abi::__cxa_demangle(info.dli_sname, nullptr, 0, &status))
+ symbolName = demangled;
+ }
+
+ char *className = nullptr;
+ asprintf(&className, " ^-- allocated in function: %s", symbolName);
+
+ if (Class existingClass = objc_getClass(className))
+ trackerClass = existingClass;
+ else
+ trackerClass = objc_duplicateClass(trackerClass, className, 0);
+
+ free(className);
+
+ if (symbolName != info.dli_sname)
+ free((char*)symbolName);
+ }
+ }
+#endif
+
+ [[[trackerClass alloc] initWithPool:
reinterpret_cast<NSAutoreleasePool **>(&pool)] autorelease];
}
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 7524d2e6c4..9ff27642c8 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1622,14 +1622,15 @@ bool QCoreApplication::compressEvent(QEvent *event, QObject *receiver, QPostEven
/*!
Immediately dispatches all events which have been previously queued
- with QCoreApplication::postEvent() and which are for the object \a receiver
- and have the event type \a event_type.
+ with QCoreApplication::postEvent() and which are for the object \a
+ receiver and have the event type \a event_type.
Events from the window system are \e not dispatched by this
function, but by processEvents().
- If \a receiver is null, the events of \a event_type are sent for all
- objects. If \a event_type is 0, all the events are sent for \a receiver.
+ If \a receiver is \nullptr, the events of \a event_type are sent for
+ all objects. If \a event_type is 0, all the events are sent for
+ \a receiver.
\note This method must be called from the thread in which its QObject
parameter, \a receiver, lives.
@@ -1810,10 +1811,10 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type
call it, be aware that killing events may cause \a receiver to
break one or more invariants.
- If \a receiver is null, the events of \a eventType are removed for
- all objects. If \a eventType is 0, all the events are removed for
- \a receiver. You should never call this function with \a eventType
- of 0.
+ If \a receiver is \nullptr, the events of \a eventType are removed
+ for all objects. If \a eventType is 0, all the events are removed
+ for \a receiver. You should never call this function with \a
+ eventType of 0.
\threadsafe
*/
@@ -2126,7 +2127,7 @@ static void replacePercentN(QString *result, int n)
\a disambiguation is an identifying string, for when the same \a
sourceText is used in different roles within the same context. By
- default, it is null.
+ default, it is \nullptr.
See the \l QTranslator and \l QObject::tr() documentation for
more information about contexts, disambiguations and comments.
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index a7ed8dda8a..707bc79407 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -80,31 +80,31 @@ public:
explicit QEventDispatcherWin32(QObject *parent = 0);
~QEventDispatcherWin32();
- bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags);
- bool hasPendingEvents();
+ bool QT_ENSURE_STACK_ALIGNED_FOR_SSE processEvents(QEventLoop::ProcessEventsFlags flags) override;
+ bool hasPendingEvents() override;
- void registerSocketNotifier(QSocketNotifier *notifier);
- void unregisterSocketNotifier(QSocketNotifier *notifier);
+ void registerSocketNotifier(QSocketNotifier *notifier) override;
+ void unregisterSocketNotifier(QSocketNotifier *notifier) override;
- void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object);
- bool unregisterTimer(int timerId);
- bool unregisterTimers(QObject *object);
- QList<TimerInfo> registeredTimers(QObject *object) const;
+ void registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *object) override;
+ bool unregisterTimer(int timerId) override;
+ bool unregisterTimers(QObject *object) override;
+ QList<TimerInfo> registeredTimers(QObject *object) const override;
- bool registerEventNotifier(QWinEventNotifier *notifier);
- void unregisterEventNotifier(QWinEventNotifier *notifier);
+ bool registerEventNotifier(QWinEventNotifier *notifier) override;
+ void unregisterEventNotifier(QWinEventNotifier *notifier) override;
void activateEventNotifiers();
- int remainingTime(int timerId);
+ int remainingTime(int timerId) override;
- void wakeUp();
- void interrupt();
- void flush();
+ void wakeUp() override;
+ void interrupt() override;
+ void flush() override;
- void startingUp();
- void closingDown();
+ void startingUp() override;
+ void closingDown() override;
- bool event(QEvent *e);
+ bool event(QEvent *e) override;
HWND internalHwnd();
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 8082b7fe9b..c15a9f7b0f 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -3522,7 +3522,7 @@ bool QMetaProperty::isStored(const QObject *object) const
false. e.g., the \c text property is the \c USER editable property
of a QLineEdit.
- If \a object is null, the function returns \c false if the \c
+ If \a object is \nullptr, the function returns \c false if the \c
{Q_PROPERTY()}'s \c USER attribute is false. Otherwise it returns
true.
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index a1d53be197..45d0b5df6c 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -432,7 +432,7 @@ struct DefinedTypesFilter {
\since 5.0
Returns a copy of \a copy, assuming it is of the type that this
- QMetaType instance was created for. If \a copy is null, creates
+ QMetaType instance was created for. If \a copy is \nullptr, creates
a default constructed instance.
\sa QMetaType::destroy()
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 3db43ba1c4..257575e141 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3225,7 +3225,7 @@ QMetaObject::Connection QMetaObject::connect(const QObject *sender, int signal_i
\internal
Same as the QMetaObject::connect, but \a signal_index must be the result of QObjectPrivate::signalIndex
- method_index is relative to the rmeta metaobject, if rmeta is null, then it is absolute index
+ method_index is relative to the rmeta metaobject, if rmeta is \nullptr, then it is absolute index
the QObjectPrivate::Connection* has a refcount of 2, so it must be passed to a QMetaObject::Connection
*/
@@ -3779,7 +3779,7 @@ void QMetaObject::activate(QObject *sender, int signal_index, void **argv)
It is different from QMetaObject::indexOfSignal(): indexOfSignal is the same as indexOfMethod
while QObjectPrivate::signalIndex is smaller because it doesn't give index to slots.
- If \a meta is not 0, it is set to the meta-object where the signal was found.
+ If \a meta is not \nullptr, it is set to the meta-object where the signal was found.
*/
int QObjectPrivate::signalIndex(const char *signalName,
const QMetaObject **meta) const
@@ -4996,11 +4996,14 @@ bool QObjectPrivate::disconnect(const QObject *sender, int signal_index, void **
/*! \class QMetaObject::Connection
\inmodule QtCore
- Represents a handle to a signal-slot connection.
- It can be used to disconnect that connection, or check if
- the connection was successful
+ Represents a handle to a signal-slot (or signal-functor) connection.
- \sa QObject::disconnect()
+ It can be used to check if the connection is valid and to disconnect it using
+ QObject::disconnect(). For a signal-functor connection without a context object,
+ it is the only way to selectively disconnect that connection.
+
+ As Connection is just a handle, the underlying signal-slot connection is unaffected
+ when Connection is destroyed or reassigned.
*/
/*!
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 6541b97595..18c7f7648d 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1052,11 +1052,13 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
return false;
#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(regularexpression)
case QMetaType::QRegularExpression:
if (d->type != QMetaType::QCborValue || !v_cast<QCborValue>(d)->isRegularExpression())
return false;
*static_cast<QRegularExpression *>(result) = v_cast<QCborValue>(d)->toRegularExpression();
break;
+#endif
case QMetaType::QJsonValue:
switch (d->type) {
case QMetaType::Nullptr:
@@ -1232,9 +1234,11 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok)
case QVariant::Url:
*static_cast<QCborValue *>(result) = QCborValue(*v_cast<QUrl>(d));
break;
+#if QT_CONFIG(regularexpression)
case QVariant::RegularExpression:
*static_cast<QCborValue *>(result) = QCborValue(*v_cast<QRegularExpression>(d));
break;
+#endif
case QVariant::Uuid:
*static_cast<QCborValue *>(result) = QCborValue(*v_cast<QUuid>(d));
break;
@@ -1764,7 +1768,7 @@ Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names
\fn QVariant::QVariant(int typeId, const void *copy)
Constructs variant of type \a typeId, and initializes with
- \a copy if \a copy is not 0.
+ \a copy if \a copy is not \nullptr.
Note that you have to pass the address of the variable you want stored.
@@ -1793,7 +1797,7 @@ Q_CORE_EXPORT void QVariantPrivate::registerHandler(const int /* Modules::Names
\internal
Constructs a variant private of type \a type, and initializes with \a copy if
- \a copy is not 0.
+ \a copy is not \nullptr.
*/
void QVariant::create(int type, const void *copy)
diff --git a/src/corelib/platform/platform.pri b/src/corelib/platform/platform.pri
new file mode 100644
index 0000000000..1fe2db81b0
--- /dev/null
+++ b/src/corelib/platform/platform.pri
@@ -0,0 +1 @@
+wasm:include(wasm/wasm.pri)
diff --git a/src/corelib/platform/wasm/qstdweb.cpp b/src/corelib/platform/wasm/qstdweb.cpp
new file mode 100644
index 0000000000..1afd91d860
--- /dev/null
+++ b/src/corelib/platform/wasm/qstdweb.cpp
@@ -0,0 +1,236 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstdweb_p.h"
+
+#include <emscripten/bind.h>
+#include <cstdint>
+#include <iostream>
+
+QT_BEGIN_NAMESPACE
+
+namespace qstdweb {
+
+typedef double uint53_t; // see Number.MAX_SAFE_INTEGER
+
+ArrayBuffer::ArrayBuffer(const emscripten::val &arrayBuffer)
+ :m_arrayBuffer(arrayBuffer)
+{
+
+}
+
+uint32_t ArrayBuffer::byteLength() const
+{
+ if (m_arrayBuffer.isUndefined() || m_arrayBuffer.isNull())
+ return 0;
+
+ return m_arrayBuffer["byteLength"].as<uint32_t>();
+}
+
+Blob::Blob(const emscripten::val &blob)
+ :m_blob(blob)
+{
+
+}
+
+uint32_t Blob::size() const
+{
+ return m_blob["size"].as<uint32_t>();
+}
+
+File::File(const emscripten::val &file)
+:m_file(file)
+{
+
+}
+
+Blob File::slice(uint64_t begin, uint64_t end) const
+{
+ return Blob(m_file.call<emscripten::val>("slice", uint53_t(begin), uint53_t(end)));
+}
+
+std::string File::name() const
+{
+ return m_file["name"].as<std::string>();
+}
+
+uint64_t File::size() const
+{
+ return uint64_t(m_file["size"].as<uint53_t>());
+}
+
+FileList::FileList(const emscripten::val &fileList)
+ :m_fileList(fileList)
+{
+
+}
+
+int FileList::length() const
+{
+ return m_fileList["length"].as<int>();
+}
+
+File FileList::item(int index) const
+{
+ return File(m_fileList[index]);
+}
+
+File FileList::operator[](int index) const
+{
+ return item(index);
+}
+
+ArrayBuffer FileReader::result() const
+{
+ return ArrayBuffer(m_fileReader["result"]);
+}
+
+void FileReader::readAsArrayBuffer(const Blob &blob) const
+{
+ m_fileReader.call<void>("readAsArrayBuffer", blob.m_blob);
+}
+
+void FileReader::onLoad(const std::function<void ()> &onLoad)
+{
+ m_onLoad.reset(new EventCallback(m_fileReader, "load", onLoad));
+}
+
+void FileReader::onError(const std::function<void ()> &onError)
+{
+ m_onError.reset(new EventCallback(m_fileReader, "error", onError));
+}
+
+void FileReader::onAbort(const std::function<void ()> &onAbort)
+{
+ m_onAbort.reset(new EventCallback(m_fileReader, "abort", onAbort));
+}
+
+Uint8Array Uint8Array::heap()
+{
+ return Uint8Array(heap_());
+}
+
+Uint8Array::Uint8Array(const emscripten::val &uint8Array)
+: m_uint8Array(uint8Array)
+{
+
+}
+
+Uint8Array::Uint8Array(const ArrayBuffer &buffer)
+: m_uint8Array(Uint8Array::constructor_().new_(buffer.m_arrayBuffer))
+{
+
+}
+
+Uint8Array::Uint8Array(const ArrayBuffer &buffer, uint32_t offset, uint32_t length)
+: m_uint8Array(Uint8Array::constructor_().new_(buffer.m_arrayBuffer, offset, length))
+{
+
+}
+
+Uint8Array::Uint8Array(char *buffer, uint32_t size)
+:m_uint8Array(Uint8Array::constructor_().new_(Uint8Array::heap().buffer().m_arrayBuffer, uint32_t(buffer), size))
+{
+
+}
+
+ArrayBuffer Uint8Array::buffer() const
+{
+ return ArrayBuffer(m_uint8Array["buffer"]);
+}
+
+uint32_t Uint8Array::length() const
+{
+ return m_uint8Array["length"].as<uint32_t>();
+}
+
+void Uint8Array::set(const Uint8Array &source)
+{
+ m_uint8Array.call<void>("set", source.m_uint8Array); // copies source content
+}
+
+void Uint8Array::copyTo(char *destination) const
+{
+ Uint8Array(destination, length()).set(*this);
+}
+
+void Uint8Array::copy(char *destination, const Uint8Array &source)
+{
+ Uint8Array(destination, source.length()).set(source);
+}
+
+emscripten::val Uint8Array::heap_()
+{
+ return emscripten::val::module_property("HEAPU8");
+}
+
+emscripten::val Uint8Array::constructor_()
+{
+ return emscripten::val::global("Uint8Array");
+}
+
+// Registers a callback function for a named event on the given element. The event
+// name must be the name as returned by the Event.type property: e.g. "load", "error".
+EventCallback::EventCallback(emscripten::val element, const std::string &name, const std::function<void ()> &fn)
+:m_fn(fn)
+{
+ element.set(contextPropertyName(name).c_str(), emscripten::val(intptr_t(this)));
+ element.set((std::string("on") + name).c_str(), emscripten::val::module_property("qtStdWebEventCallbackActivate"));
+}
+
+void EventCallback::activate(emscripten::val event)
+{
+ emscripten::val target = event["target"];
+ std::string eventName = event["type"].as<std::string>();
+ EventCallback *that = reinterpret_cast<EventCallback *>(target[contextPropertyName(eventName).c_str()].as<intptr_t>());
+ that->m_fn();
+}
+
+std::string EventCallback::contextPropertyName(const std::string &eventName)
+{
+ return std::string("data-qtEventCallbackContext") + eventName;
+}
+
+EMSCRIPTEN_BINDINGS(QtStdwebCalback) {
+ emscripten::function("qtStdWebEventCallbackActivate", &EventCallback::activate);
+}
+
+} // namespace qstdweb
+
+QT_END_NAMESPACE
diff --git a/src/corelib/platform/wasm/qstdweb_p.h b/src/corelib/platform/wasm/qstdweb_p.h
new file mode 100644
index 0000000000..75c2ec34b1
--- /dev/null
+++ b/src/corelib/platform/wasm/qstdweb_p.h
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSTDWEB_P_H
+#define QSTDWEB_P_H
+
+//
+// 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.
+//
+
+#include <qglobal.h>
+#include <emscripten/val.h>
+#include <cstdint>
+#include <functional>
+
+QT_BEGIN_NAMESPACE
+
+namespace qstdweb {
+
+ // DOM API in C++, implemented using emscripten val.h and bind.h.
+ // This is private API and can be extened and changed as needed.
+
+ class ArrayBuffer;
+ class Blob;
+ class File;
+ class FileList;
+ class FileReader;
+ class Uint8Array;
+ class EventCallback;
+
+ class ArrayBuffer {
+ public:
+ explicit ArrayBuffer(const emscripten::val &arrayBuffer);
+ uint32_t byteLength() const;
+
+ private:
+ friend class Uint8Array;
+ emscripten::val m_arrayBuffer = emscripten::val::undefined();
+ };
+
+ class Blob {
+ public:
+ explicit Blob(const emscripten::val &blob);
+ uint32_t size() const;
+
+ private:
+ friend class FileReader;
+ emscripten::val m_blob = emscripten::val::undefined();
+ };
+
+ class File {
+ public:
+ File() = default;
+ explicit File(const emscripten::val &file);
+
+ Blob slice(uint64_t begin, uint64_t end) const;
+ std::string name() const;
+ uint64_t size() const;
+
+ private:
+ emscripten::val m_file = emscripten::val::undefined();
+ };
+
+ class FileList {
+ public:
+ FileList() = default;
+ explicit FileList(const emscripten::val &fileList);
+
+ int length() const;
+ File item(int index) const;
+ File operator[](int index) const;
+
+ private:
+ emscripten::val m_fileList = emscripten::val::undefined();
+ };
+
+ class FileReader {
+ public:
+ ArrayBuffer result() const;
+ void readAsArrayBuffer(const Blob &blob) const;
+
+ void onLoad(const std::function<void ()> &onLoad);
+ void onError(const std::function<void ()> &onError);
+ void onAbort(const std::function<void ()> &onAbort);
+
+ private:
+ emscripten::val m_fileReader = emscripten::val::global("FileReader").new_();
+ std::unique_ptr<EventCallback> m_onLoad;
+ std::unique_ptr<EventCallback> m_onError;
+ std::unique_ptr<EventCallback> m_onAbort;
+ };
+
+ class Uint8Array {
+ public:
+ static Uint8Array heap();
+ explicit Uint8Array(const emscripten::val &uint8Array);
+ explicit Uint8Array(const ArrayBuffer &buffer);
+ Uint8Array(const ArrayBuffer &buffer, uint32_t offset, uint32_t length);
+ Uint8Array(char *buffer, uint32_t size);
+
+ ArrayBuffer buffer() const;
+ uint32_t length() const;
+ void set(const Uint8Array &source);
+
+ void copyTo(char *destination) const;
+ static void copy(char *destination, const Uint8Array &source);
+ private:
+ static emscripten::val heap_();
+ static emscripten::val constructor_();
+ emscripten::val m_uint8Array = emscripten::val::undefined();
+ };
+
+ class EventCallback
+ {
+ public:
+ EventCallback(emscripten::val element, const std::string &name, const std::function<void ()> &fn);
+ static void activate(emscripten::val event);
+ private:
+ static std::string contextPropertyName(const std::string &eventName);
+ std::function<void ()> m_fn;
+ };
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/corelib/platform/wasm/wasm.pri b/src/corelib/platform/wasm/wasm.pri
new file mode 100644
index 0000000000..73447030fb
--- /dev/null
+++ b/src/corelib/platform/wasm/wasm.pri
@@ -0,0 +1,3 @@
+INCLUDEDIR += $$PWD
+HEADERS += $$PWD/qstdweb_p.h
+SOURCES += $$PWD/qstdweb.cpp
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index b113ca13ce..8bb5e1463a 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -112,7 +112,7 @@ static char *_q_uuidToHex(const QUuid &uuid, char *dst, QUuid::StringFormat mode
Parses the string representation of a UUID (with optional surrounding "{}")
by reading at most MaxStringUuidLength (38) characters from \a src, which
- may be \c nullptr. Stops at the first invalid character (which includes a
+ may be \nullptr. Stops at the first invalid character (which includes a
premature NUL).
Returns the successfully parsed QUuid, or a null QUuid in case of failure.
diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp
index 9e8c98837c..288446878c 100644
--- a/src/corelib/serialization/qcborvalue.cpp
+++ b/src/corelib/serialization/qcborvalue.cpp
@@ -108,7 +108,7 @@ QT_BEGIN_NAMESPACE
QCborValue can contain a value of "null", which is not of any specific type.
It resembles the C++ \c {std::nullptr_t} type, whose only possible value is
- \c nullptr. QCborValue has a constructor taking such a type and creates a
+ \nullptr. QCborValue has a constructor taking such a type and creates a
null QCborValue.
Null values are used to indicate that an optional value is not present. In
@@ -417,7 +417,7 @@ QT_BEGIN_NAMESPACE
using toSimpleType() as well as isSimpleType(st).
CBOR simple types are types that do not have any associated value, like
- C++'s \c{std::nullptr_t} type, whose only possible value is \c nullptr.
+ C++'s \c{std::nullptr_t} type, whose only possible value is \nullptr.
If \a st is \c{QCborSimpleType::Null}, the resulting QCborValue will be of
the \l{Type}{Null} type and similarly for \c{QCborSimpleType::Undefined}.
@@ -1772,6 +1772,7 @@ QCborValue::QCborValue(const QUrl &url)
container->elements[1].type = String;
}
+#if QT_CONFIG(regularexpression)
/*!
Creates a QCborValue object of the regular expression pattern extended type
and containing the value represented by \a rx. The value can later be retrieved
@@ -1790,6 +1791,7 @@ QCborValue::QCborValue(const QRegularExpression &rx)
// change type
t = RegularExpression;
}
+#endif // QT_CONFIG(regularexpression)
/*!
Creates a QCborValue object of the UUID extended type and containing the
@@ -1943,6 +1945,7 @@ QUrl QCborValue::toUrl(const QUrl &defaultValue) const
return QUrl::fromEncoded(byteData->asByteArrayView());
}
+#if QT_CONFIG(regularexpression)
/*!
Returns the regular expression value stored in this QCborValue, if it is of
the regular expression pattern extended type. Otherwise, it returns \a
@@ -1961,6 +1964,7 @@ QRegularExpression QCborValue::toRegularExpression(const QRegularExpression &def
Q_ASSERT(n == -1);
return QRegularExpression(container->stringAt(1));
}
+#endif // QT_CONFIG(regularexpression)
/*!
Returns the UUID value stored in this QCborValue, if it is of the UUID
@@ -2870,12 +2874,16 @@ uint qHash(const QCborValue &value, uint seed)
return qHash(value.toDateTime(), seed);
case QCborValue::Url:
return qHash(value.toUrl(), seed);
+#if QT_CONFIG(regularexpression)
case QCborValue::RegularExpression:
return qHash(value.toRegularExpression(), seed);
+#endif
case QCborValue::Uuid:
return qHash(value.toUuid(), seed);
case QCborValue::Invalid:
return seed;
+ default:
+ break;
}
Q_ASSERT(value.isSimpleType());
@@ -2920,12 +2928,16 @@ static QDebug debugContents(QDebug &dbg, const QCborValue &v)
return dbg << v.toDateTime();
case QCborValue::Url:
return dbg << v.toUrl();
+#if QT_CONFIG(regularexpression)
case QCborValue::RegularExpression:
return dbg << v.toRegularExpression();
+#endif
case QCborValue::Uuid:
return dbg << v.toUuid();
case QCborValue::Invalid:
return dbg << "<invalid>";
+ default:
+ break;
}
if (v.isSimpleType())
return dbg << v.toSimpleType();
diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h
index e6e73e1fb6..f542e44c47 100644
--- a/src/corelib/serialization/qcborvalue.h
+++ b/src/corelib/serialization/qcborvalue.h
@@ -43,7 +43,9 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qcborcommon.h>
-#include <QtCore/qregularexpression.h>
+#if QT_CONFIG(regularexpression)
+# include <QtCore/qregularexpression.h>
+#endif
#include <QtCore/qstring.h>
#include <QtCore/qstringview.h>
#include <QtCore/qurl.h>
@@ -157,7 +159,9 @@ public:
explicit QCborValue(const QDateTime &dt);
explicit QCborValue(const QUrl &url);
+#if QT_CONFIG(regularexpression)
explicit QCborValue(const QRegularExpression &rx);
+#endif
explicit QCborValue(const QUuid &uuid);
~QCborValue() { if (container) dispose(); }
@@ -235,7 +239,9 @@ public:
QString toString(const QString &defaultValue = {}) const;
QDateTime toDateTime(const QDateTime &defaultValue = {}) const;
QUrl toUrl(const QUrl &defaultValue = {}) const;
+#if QT_CONFIG(regularexpression)
QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const;
+#endif
QUuid toUuid(const QUuid &defaultValue = {}) const;
// only forward-declared, need split functions
@@ -380,8 +386,10 @@ public:
{ return concrete().toDateTime(defaultValue); }
QUrl toUrl(const QUrl &defaultValue = {}) const
{ return concrete().toUrl(defaultValue); }
+#if QT_CONFIG(regularexpression)
QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const
{ return concrete().toRegularExpression(defaultValue); }
+#endif
QUuid toUuid(const QUuid &defaultValue = {}) const
{ return concrete().toUuid(defaultValue); }
diff --git a/src/corelib/serialization/qjsoncbor.cpp b/src/corelib/serialization/qjsoncbor.cpp
index b4d3b4db18..dc5f384108 100644
--- a/src/corelib/serialization/qjsoncbor.cpp
+++ b/src/corelib/serialization/qjsoncbor.cpp
@@ -543,14 +543,19 @@ QVariant QCborValue::toVariant() const
case Url:
return toUrl();
+#if QT_CONFIG(regularexpression)
case RegularExpression:
return toRegularExpression();
+#endif
case Uuid:
return toUuid();
case Invalid:
return QVariant();
+
+ default:
+ break;
}
if (isSimpleType())
@@ -714,8 +719,10 @@ QCborValue QCborValue::fromVariant(const QVariant &variant)
case QVariant::Hash:
return QCborMap::fromVariantHash(variant.toHash());
#ifndef QT_BOOTSTRAPPED
+#if QT_CONFIG(regularexpression)
case QVariant::RegularExpression:
return QCborValue(variant.toRegularExpression());
+#endif
case QMetaType::QJsonValue:
return fromJsonValue(variant.toJsonValue());
case QMetaType::QJsonObject:
diff --git a/src/corelib/thread/qfuturewatcher.cpp b/src/corelib/thread/qfuturewatcher.cpp
index faeb6b3a28..4ee7693ace 100644
--- a/src/corelib/thread/qfuturewatcher.cpp
+++ b/src/corelib/thread/qfuturewatcher.cpp
@@ -479,7 +479,7 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event)
emit q->progressValueChanged(event->index1);
if (!event->text.isNull()) // ###
- q->progressTextChanged(event->text);
+ emit q->progressTextChanged(event->text);
break;
case QFutureCallOutEvent::ProgressRange:
emit q->progressRangeChanged(event->index1, event->index2);
diff --git a/src/corelib/thread/qsemaphore.cpp b/src/corelib/thread/qsemaphore.cpp
index aa04fb10ff..2e0b6f2bc0 100644
--- a/src/corelib/thread/qsemaphore.cpp
+++ b/src/corelib/thread/qsemaphore.cpp
@@ -606,7 +606,7 @@ bool QSemaphore::tryAcquire(int n, int timeout)
\fn QSemaphoreReleaser::semaphore() const
Returns a pointer to the QSemaphore object provided to the constructor,
- or by the last move assignment, if any. Otherwise, returns \c nullptr.
+ or by the last move assignment, if any. Otherwise, returns \nullptr.
*/
/*!
@@ -614,7 +614,7 @@ bool QSemaphore::tryAcquire(int n, int timeout)
Cancels this QSemaphoreReleaser such that the destructor will no longer
call \c{semaphore()->release()}. Returns the value of semaphore()
- before this call. After this call, semaphore() will return \c nullptr.
+ before this call. After this call, semaphore() will return \nullptr.
To enable again, assign a new QSemaphoreReleaser:
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 329caa02ba..a13f8ca215 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -100,6 +100,9 @@
#include <sys/neutrino.h>
#endif
+#if defined(Q_OS_WASM)
+#include <emscripten/val.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -499,6 +502,8 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW
// as of aug 2008 VxWorks < 6.6 only supports one single core CPU
cores = 1;
# endif
+#elif defined(Q_OS_WASM)
+ cores = emscripten::val::global("navigator")["hardwareConcurrency"].as<int>();
#else
// the rest: Linux, Solaris, AIX, Tru64
cores = (int)sysconf(_SC_NPROCESSORS_ONLN);
diff --git a/src/corelib/thread/qwaitcondition_unix.cpp b/src/corelib/thread/qwaitcondition_unix.cpp
index c93328b4bc..0ba90763cf 100644
--- a/src/corelib/thread/qwaitcondition_unix.cpp
+++ b/src/corelib/thread/qwaitcondition_unix.cpp
@@ -204,7 +204,7 @@ void QWaitCondition::wakeAll()
bool QWaitCondition::wait(QMutex *mutex, unsigned long time)
{
- if (quint64(time) > quint64(std::numeric_limits<qint64>::max()))
+ if (time == std::numeric_limits<unsigned long>::max())
return wait(mutex, QDeadlineTimer(QDeadlineTimer::Forever));
return wait(mutex, QDeadlineTimer(time));
}
@@ -231,6 +231,8 @@ bool QWaitCondition::wait(QMutex *mutex, QDeadlineTimer deadline)
bool QWaitCondition::wait(QReadWriteLock *readWriteLock, unsigned long time)
{
+ if (time == std::numeric_limits<unsigned long>::max())
+ return wait(readWriteLock, QDeadlineTimer(QDeadlineTimer::Forever));
return wait(readWriteLock, QDeadlineTimer(time));
}
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 70eae9e463..64674ddc00 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -239,8 +239,8 @@ qCalculateGrowingBlockSize(size_t elementCount, size_t elementSize, size_t heade
Returns a duplicate string.
Allocates space for a copy of \a src, copies it, and returns a
- pointer to the copy. If \a src is nullptr, it immediately returns
- nullptr.
+ pointer to the copy. If \a src is \nullptr, it immediately returns
+ \nullptr.
Ownership is passed to the caller, so the returned string must be
deleted using \c delete[].
@@ -258,7 +258,7 @@ char *qstrdup(const char *src)
Copies all the characters up to and including the '\\0' from \a
src into \a dst and returns a pointer to \a dst. If \a src is
- nullptr, it immediately returns nullptr.
+ \nullptr, it immediately returns \nullptr.
This function assumes that \a dst is large enough to hold the
contents of \a src.
@@ -291,7 +291,7 @@ char *qstrcpy(char *dst, const char *src)
Copies at most \a len bytes from \a src (stopping at \a len or the
terminating '\\0' whichever comes first) into \a dst and returns a
pointer to \a dst. Guarantees that \a dst is '\\0'-terminated. If
- \a src or \a dst is nullptr, returns nullptr immediately.
+ \a src or \a dst is \nullptr, returns \nullptr immediately.
This function assumes that \a dst is at least \a len characters
long.
@@ -326,7 +326,7 @@ char *qstrncpy(char *dst, const char *src, uint len)
A safe \c strlen() function.
Returns the number of characters that precede the terminating '\\0',
- or 0 if \a str is nullptr.
+ or 0 if \a str is \nullptr.
\sa qstrnlen()
*/
@@ -338,7 +338,7 @@ char *qstrncpy(char *dst, const char *src, uint len)
A safe \c strnlen() function.
Returns the number of characters that precede the terminating '\\0', but
- at most \a maxlen. If \a str is nullptr, returns 0.
+ at most \a maxlen. If \a str is \nullptr, returns 0.
\sa qstrlen()
*/
@@ -352,10 +352,10 @@ char *qstrncpy(char *dst, const char *src, uint len)
is less than \a str2, 0 if \a str1 is equal to \a str2 or a
positive value if \a str1 is greater than \a str2.
- Special case 1: Returns 0 if \a str1 and \a str2 are both nullptr.
+ Special case 1: Returns 0 if \a str1 and \a str2 are both \nullptr.
Special case 2: Returns an arbitrary non-zero value if \a str1 is
- nullptr or \a str2 is nullptr (but not both).
+ \nullptr or \a str2 is \nullptr (but not both).
\sa qstrncmp(), qstricmp(), qstrnicmp(), {8-bit Character Comparisons},
QByteArray::compare()
@@ -378,10 +378,10 @@ int qstrcmp(const char *str1, const char *str2)
str1 is equal to \a str2 or a positive value if \a str1 is greater
than \a str2.
- Special case 1: Returns 0 if \a str1 and \a str2 are both nullptr.
+ Special case 1: Returns 0 if \a str1 and \a str2 are both \nullptr.
- Special case 2: Returns a random non-zero value if \a str1 is nullptr
- or \a str2 is nullptr (but not both).
+ Special case 2: Returns a random non-zero value if \a str1 is \nullptr
+ or \a str2 is \nullptr (but not both).
\sa qstrcmp(), qstricmp(), qstrnicmp(), {8-bit Character Comparisons},
QByteArray::compare()
@@ -398,10 +398,10 @@ int qstrcmp(const char *str1, const char *str2)
str1 is equal to \a str2 or a positive value if \a str1 is greater
than \a str2.
- Special case 1: Returns 0 if \a str1 and \a str2 are both nullptr.
+ Special case 1: Returns 0 if \a str1 and \a str2 are both \nullptr.
- Special case 2: Returns a random non-zero value if \a str1 is nullptr
- or \a str2 is nullptr (but not both).
+ Special case 2: Returns a random non-zero value if \a str1 is \nullptr
+ or \a str2 is \nullptr (but not both).
\sa qstrcmp(), qstrncmp(), qstrnicmp(), {8-bit Character Comparisons},
QByteArray::compare()
@@ -491,10 +491,10 @@ int qstricmp(const char *str1, const char *str2)
is equal to \a str2 or a positive value if \a str1 is greater than \a
str2.
- Special case 1: Returns 0 if \a str1 and \a str2 are both nullptr.
+ Special case 1: Returns 0 if \a str1 and \a str2 are both \nullptr.
- Special case 2: Returns a random non-zero value if \a str1 is nullptr
- or \a str2 is nullptr (but not both).
+ Special case 2: Returns a random non-zero value if \a str1 is \nullptr
+ or \a str2 is \nullptr (but not both).
\sa qstrcmp(), qstrncmp(), qstricmp(), {8-bit Character Comparisons},
QByteArray::compare()
@@ -3912,7 +3912,7 @@ T toIntegral_helper(const char *data, bool *ok, int base)
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\note The conversion of the number is performed in the default C locale,
@@ -3938,7 +3938,7 @@ qlonglong QByteArray::toLongLong(bool *ok, int base) const
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\note The conversion of the number is performed in the default C locale,
@@ -3963,7 +3963,7 @@ qulonglong QByteArray::toULongLong(bool *ok, int base) const
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\snippet code/src_corelib_tools_qbytearray.cpp 36
@@ -3990,7 +3990,7 @@ int QByteArray::toInt(bool *ok, int base) const
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\note The conversion of the number is performed in the default C locale,
@@ -4017,7 +4017,7 @@ uint QByteArray::toUInt(bool *ok, int base) const
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\snippet code/src_corelib_tools_qbytearray.cpp 37
@@ -4045,7 +4045,7 @@ long QByteArray::toLong(bool *ok, int base) const
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\note The conversion of the number is performed in the default C locale,
@@ -4069,7 +4069,7 @@ ulong QByteArray::toULong(bool *ok, int base) const
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\note The conversion of the number is performed in the default C locale,
@@ -4094,7 +4094,7 @@ short QByteArray::toShort(bool *ok, int base) const
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\note The conversion of the number is performed in the default C locale,
@@ -4115,7 +4115,7 @@ ushort QByteArray::toUShort(bool *ok, int base) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for other reasons (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\snippet code/src_corelib_tools_qbytearray.cpp 38
@@ -4151,7 +4151,7 @@ double QByteArray::toDouble(bool *ok) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for other reasons (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\snippet code/src_corelib_tools_qbytearray.cpp 38float
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 600bd1e0e5..80d6dada60 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -908,10 +908,16 @@ QString QDate::toString(Qt::DateFormat format) const
a minus sign is prepended in addition.
\endtable
- All other input characters will be ignored. Any sequence of characters that
- are enclosed in single quotes will be treated as text and not be used as an
- expression. Two consecutive single quotes ("''") are replaced by a singlequote
- in the output. Formats without separators (e.g. "ddMM") are currently not supported.
+ Any 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 replaced by
+ a single quote in the output. All other characters in the format string are
+ included verbatim in the output string.
+
+ Formats without separators (e.g. "ddMM") are supported but must be used with
+ care, as the resulting strings aren't always reliably readable (e.g. if "dM"
+ produces "212" it could mean either the 2nd of December or the 21st of
+ February).
Example format strings (assuming that the QDate is the 20 July
1969):
@@ -1672,10 +1678,16 @@ QString QTime::toString(Qt::DateFormat format) const
\row \li t \li the timezone (for example "CEST")
\endtable
- All other input characters will be ignored. Any sequence of characters that
- are enclosed in single quotes will be treated as text and not be used as an
- expression. Two consecutive single quotes ("''") are replaced by a singlequote
- in the output. Formats without separators (e.g. "HHmm") are currently not supported.
+ Any 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 replaced by
+ a single quote in the output. All other characters in the format string are
+ included verbatim in the output string.
+
+ Formats without separators (e.g. "ddMM") are supported but must be used with
+ care, as the resulting strings aren't always reliably readable (e.g. if "dM"
+ produces "212" it could mean either the 2nd of December or the 21st of
+ February).
Example format strings (assuming that the QTime is 14:13:09.042 and the system
locale is \c{en_US})
@@ -3952,10 +3964,16 @@ QString QDateTime::toString(Qt::DateFormat format) const
\row \li t \li the timezone (for example "CEST")
\endtable
- All other input characters will be ignored. Any sequence of characters that
- are enclosed in single quotes will be treated as text and not be used as an
- expression. Two consecutive single quotes ("''") are replaced by a singlequote
- in the output. Formats without separators (e.g. "HHmm") are currently not supported.
+ Any 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 replaced by
+ a single quote in the output. All other characters in the format string are
+ included verbatim in the output string.
+
+ Formats without separators (e.g. "ddMM") are supported but must be used with
+ care, as the resulting strings aren't always reliably readable (e.g. if "dM"
+ produces "212" it could mean either the 2nd of December or the 21st of
+ February).
Example format strings (assumed that the QDateTime is 21 May 2001
14:13:09.120):
diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp
index e6afd510fd..e8470f6cde 100644
--- a/src/corelib/tools/qdatetimeparser.cpp
+++ b/src/corelib/tools/qdatetimeparser.cpp
@@ -1125,13 +1125,14 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
for (int index = 0; index < sectionNodesCount; ++index) {
Q_ASSERT(state != Invalid);
- if (QStringRef(input, pos, separators.at(index).size()) != separators.at(index)) {
- QDTPDEBUG << "invalid because" << input->midRef(pos, separators.at(index).size())
- << "!=" << separators.at(index)
+ const QString &separator = separators.at(index);
+ if (input->midRef(pos, separator.size()) != separator) {
+ QDTPDEBUG << "invalid because" << input->midRef(pos, separator.size())
+ << "!=" << separator
<< index << pos << currentSectionIndex;
return StateNode();
}
- pos += separators.at(index).size();
+ pos += separator.size();
sectionNodes[index].pos = pos;
int *current = 0;
const SectionNode sn = sectionNodes.at(index);
@@ -1227,7 +1228,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
isSet |= sn.type;
}
- if (QStringRef(input, pos, input->size() - pos) != separators.last()) {
+ if (input->midRef(pos) != separators.last()) {
QDTPDEBUG << "invalid because" << input->midRef(pos)
<< "!=" << separators.last() << pos;
return StateNode();
diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp
index 1de93ff9e1..6f8084c676 100644
--- a/src/corelib/tools/qlist.cpp
+++ b/src/corelib/tools/qlist.cpp
@@ -971,6 +971,7 @@ void **QListData::erase(void **xi)
*/
/*! \fn template <class T> void QList<T>::swapItemsAt(int i, int j)
+ \since 5.13
Exchange the item at index position \a i with the item at index
position \a j. This function assumes that both \a i and \a j are
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 86b73bf634..b3fb079342 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2019 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -788,7 +788,7 @@ static const int locale_data_size = sizeof(locale_data)/sizeof(QLocaleData) - 1;
Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, defaultLocalePrivate,
(QLocalePrivate::create(defaultData(), default_number_options)))
-Q_GLOBAL_STATIC_WITH_ARGS(QSharedDataPointer<QLocalePrivate>, systemLocalePrivate,
+Q_GLOBAL_STATIC_WITH_ARGS(QExplicitlySharedDataPointer<QLocalePrivate>, systemLocalePrivate,
(QLocalePrivate::create(systemData())))
static QLocalePrivate *localePrivateByName(const QString &name)
@@ -1265,7 +1265,7 @@ QString QLocale::scriptToString(QLocale::Script script)
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1283,7 +1283,7 @@ short QLocale::toShort(const QString &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1301,7 +1301,7 @@ ushort QLocale::toUShort(const QString &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1319,7 +1319,7 @@ int QLocale::toInt(const QString &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1337,7 +1337,7 @@ uint QLocale::toUInt(const QString &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1357,7 +1357,7 @@ qlonglong QLocale::toLongLong(const QString &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1376,7 +1376,7 @@ qulonglong QLocale::toULongLong(const QString &s, bool *ok) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for any other reason (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function does not fall back to the 'C' locale if the string
@@ -1398,7 +1398,7 @@ float QLocale::toFloat(const QString &s, bool *ok) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for any other reason (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function does not fall back to the 'C' locale if the string
@@ -1424,7 +1424,7 @@ double QLocale::toDouble(const QString &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1444,7 +1444,7 @@ short QLocale::toShort(const QStringRef &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1464,7 +1464,7 @@ ushort QLocale::toUShort(const QStringRef &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1484,7 +1484,7 @@ int QLocale::toInt(const QStringRef &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1504,7 +1504,7 @@ uint QLocale::toUInt(const QStringRef &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1526,7 +1526,7 @@ qlonglong QLocale::toLongLong(const QStringRef &s, bool *ok) const
If the conversion fails the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1547,7 +1547,7 @@ qulonglong QLocale::toULongLong(const QStringRef &s, bool *ok) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for any other reason (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function does not fall back to the 'C' locale if the string
@@ -1571,7 +1571,7 @@ float QLocale::toFloat(const QStringRef &s, bool *ok) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for any other reason (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function does not fall back to the 'C' locale if the string
@@ -1600,7 +1600,7 @@ double QLocale::toDouble(const QStringRef &s, bool *ok) const
If the conversion fails, the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1620,7 +1620,7 @@ short QLocale::toShort(QStringView s, bool *ok) const
If the conversion fails, the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1640,7 +1640,7 @@ ushort QLocale::toUShort(QStringView s, bool *ok) const
If the conversion fails, the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1660,7 +1660,7 @@ int QLocale::toInt(QStringView s, bool *ok) const
If the conversion fails, the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1680,7 +1680,7 @@ uint QLocale::toUInt(QStringView s, bool *ok) const
If the conversion fails, the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1702,7 +1702,7 @@ qlonglong QLocale::toLongLong(QStringView s, bool *ok) const
If the conversion fails, the function returns 0.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1723,7 +1723,7 @@ qulonglong QLocale::toULongLong(QStringView s, bool *ok) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for any other reason (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
This function ignores leading and trailing whitespace.
@@ -1744,7 +1744,7 @@ float QLocale::toFloat(QStringView s, bool *ok) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for any other reason (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
Unlike QString::toDouble(), this function does not fall back to
diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp
index c334f71fa0..dcfda40eda 100644
--- a/src/corelib/tools/qshareddata.cpp
+++ b/src/corelib/tools/qshareddata.cpp
@@ -368,7 +368,7 @@ QT_BEGIN_NAMESPACE
*/
/*! \fn template <class T> bool QSharedDataPointer<T>::operator!() const
- Returns \c true if the \e{d pointer} of \e this is null.
+ Returns \c true if the \e{d pointer} of \e this is \nullptr.
*/
/*! \fn template <class T> void QSharedDataPointer<T>::detach()
@@ -583,7 +583,7 @@ QT_BEGIN_NAMESPACE
\since 5.12
Returns a pointer to the shared object, and resets \e this to be null.
- That is, this function sets the \e{d pointer} of \e this to \c nullptr.
+ That is, this function sets the \e{d pointer} of \e this to \nullptr.
*/
/*! \fn template <class T> QExplicitlySharedDataPointer<T>::operator bool () const
@@ -591,7 +591,7 @@ QT_BEGIN_NAMESPACE
*/
/*! \fn template <class T> bool QExplicitlySharedDataPointer<T>::operator!() const
- Returns \c true if the \e{d pointer} of \e this is null.
+ Returns \c true if the \e{d pointer} of \e this is \nullptr.
*/
/*! \fn template <class T> void QExplicitlySharedDataPointer<T>::detach()
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index a1caeeb135..ce0a1ad9cb 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -579,8 +579,8 @@
/*!
\fn template <class T> bool QSharedPointer<T>::operator !() const
- Returns \c true if this object is null. This function is suitable
- for use in \tt if-constructs, like:
+ Returns \c true if this object is \nullptr. This function is
+ suitable for use in \tt if-constructs, like:
\snippet code/src_corelib_tools_qsharedpointer.cpp 5
@@ -854,8 +854,8 @@
/*!
\fn template <class T> bool QWeakPointer<T>::operator !() const
- Returns \c true if this object is null. This function is suitable
- for use in \tt if-constructs, like:
+ Returns \c true if this object is \nullptr. This function is
+ suitable for use in \tt if-constructs, like:
\snippet code/src_corelib_tools_qsharedpointer.cpp 9
diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp
index 1508681021..ddd715f745 100644
--- a/src/corelib/tools/qsimd.cpp
+++ b/src/corelib/tools/qsimd.cpp
@@ -290,6 +290,10 @@ static void cpuidFeatures07_00(uint &ebx, uint &ecx, uint &edx)
ebx = info[1];
ecx = info[2];
edx = info[3];
+#else
+ Q_UNUSED(ebx);
+ Q_UNUSED(ecx);
+ Q_UNUSED(edx);
#endif
}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index dc09c8e729..59c4884ff5 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -7231,7 +7231,7 @@ QString QString::vasprintf(const char *cformat, va_list ap)
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -7273,7 +7273,7 @@ qlonglong QString::toIntegral_helper(const QChar *data, int len, bool *ok, int b
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -7317,7 +7317,7 @@ qulonglong QString::toIntegral_helper(const QChar *data, uint len, bool *ok, int
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -7348,7 +7348,7 @@ long QString::toLong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -7378,7 +7378,7 @@ ulong QString::toULong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -7407,7 +7407,7 @@ int QString::toInt(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -7436,7 +7436,7 @@ uint QString::toUInt(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -7465,7 +7465,7 @@ short QString::toShort(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -7496,7 +7496,7 @@ ushort QString::toUShort(bool *ok, int base) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for other reasons (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\snippet qstring/main.cpp 66
@@ -7535,7 +7535,7 @@ double QString::toDouble(bool *ok) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for other reasons (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
\warning The QString content may only contain valid numerical characters
@@ -9440,11 +9440,11 @@ QString &QString::setRawData(const QChar *unicode, int size)
The range \c{[first,last)} must remain valid for the lifetime of
this Latin-1 string object.
- Passing \c nullptr as \a first is safe if \a last is \c nullptr,
+ Passing \nullptr as \a first is safe if \a last is \nullptr,
too, and results in a null Latin-1 string.
The behavior is undefined if \a last precedes \a first, \a first
- is \c nullptr and \a last is not, or if \c{last - first >
+ is \nullptr and \a last is not, or if \c{last - first >
INT_MAX}.
*/
@@ -11933,7 +11933,7 @@ QStringRef QStringRef::trimmed() const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -11958,7 +11958,7 @@ qint64 QStringRef::toLongLong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -11985,7 +11985,7 @@ quint64 QStringRef::toULongLong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -12012,7 +12012,7 @@ long QStringRef::toLong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -12038,7 +12038,7 @@ ulong QStringRef::toULong(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -12063,7 +12063,7 @@ int QStringRef::toInt(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -12088,7 +12088,7 @@ uint QStringRef::toUInt(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -12113,7 +12113,7 @@ short QStringRef::toShort(bool *ok, int base) const
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
If \a base is 0, the C language convention is used: If the string
@@ -12140,7 +12140,7 @@ ushort QStringRef::toUShort(bool *ok, int base) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for other reasons (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
The string conversion will always happen in the 'C' locale. For locale
@@ -12166,7 +12166,7 @@ double QStringRef::toDouble(bool *ok) const
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for other reasons (e.g. underflow).
- If \a ok is not \c nullptr, failure is reported by setting *\a{ok}
+ If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
The string conversion will always happen in the 'C' locale. For locale
diff --git a/src/corelib/tools/qstringview.cpp b/src/corelib/tools/qstringview.cpp
index a7d9426fa6..b97e989110 100644
--- a/src/corelib/tools/qstringview.cpp
+++ b/src/corelib/tools/qstringview.cpp
@@ -232,9 +232,9 @@ QT_BEGIN_NAMESPACE
The range \c{[str,len)} must remain valid for the lifetime of this string view object.
- Passing \c nullptr as \a str is safe if \a len is 0, too, and results in a null string view.
+ Passing \nullptr as \a str is safe if \a len is 0, too, and results in a null string view.
- The behavior is undefined if \a len is negative or, when positive, if \a str is \c nullptr.
+ The behavior is undefined if \a len is negative or, when positive, if \a str is \nullptr.
This constructor only participates in overload resolution if \c Char is a compatible
character type. The compatible character types are: \c QChar, \c ushort, \c char16_t and
@@ -249,11 +249,11 @@ QT_BEGIN_NAMESPACE
The range \c{[first,last)} must remain valid for the lifetime of
this string view object.
- Passing \c nullptr as \a first is safe if \a last is nullptr, too,
+ Passing \c \nullptr as \a first is safe if \a last is \nullptr, too,
and results in a null string view.
The behavior is undefined if \a last precedes \a first, or \a first
- is \c nullptr and \a last is not.
+ is \nullptr and \a last is not.
This constructor only participates in overload resolution if \c Char
is a compatible character type. The compatible character types
@@ -269,7 +269,7 @@ QT_BEGIN_NAMESPACE
\a str must remain valid for the lifetime of this string view object.
- Passing \c nullptr as \a str is safe and results in a null string view.
+ Passing \nullptr as \a str is safe and results in a null string view.
This constructor only participates in overload resolution if \a
str is not an array and if \c Char is a compatible character
@@ -332,7 +332,7 @@ QT_BEGIN_NAMESPACE
The string view will be empty if and only if \c{str.empty()}. It is unspecified
whether this constructor can result in a null string view (\c{str.data()} would
- have to return \c nullptr for this).
+ have to return \nullptr for this).
\sa isNull(), isEmpty()
*/
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index b51cd819c5..988d5a9e1b 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -672,7 +672,6 @@ void QVector<T>::realloc(int aalloc, QArrayData::AllocationOptions options)
Data *x = d;
const bool isShared = d->ref.isShared();
- Q_ASSERT(aalloc != int(d->alloc) || isShared);
QT_TRY {
// allocate memory