From 58c14c4a7edcecdd9d58b682a9360c83e2274ec5 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 18 Sep 2017 11:49:52 +0200 Subject: Replace Q_NULLPTR with nullptr where possible Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen Reviewed-by: Lars Knoll Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/animation/qabstractanimation.h | 8 +- src/corelib/animation/qanimationgroup.h | 2 +- src/corelib/animation/qparallelanimationgroup.h | 2 +- src/corelib/animation/qpauseanimation.h | 4 +- src/corelib/animation/qpropertyanimation.h | 4 +- src/corelib/animation/qsequentialanimationgroup.h | 2 +- src/corelib/animation/qvariantanimation.h | 4 +- src/corelib/arch/qatomic_cxx11.h | 8 +- src/corelib/codecs/qtextcodec.h | 6 +- src/corelib/global/qflags.h | 2 +- src/corelib/global/qglobal.h | 2 +- src/corelib/global/qlogging.h | 6 +- src/corelib/io/qbuffer.h | 4 +- src/corelib/io/qfile.h | 2 +- src/corelib/io/qfiledevice.h | 2 +- src/corelib/io/qfileselector.h | 2 +- src/corelib/io/qfilesystemwatcher.h | 4 +- src/corelib/io/qfilesystemwatcher_fsevents.mm | 2 +- src/corelib/io/qiodevice.h | 2 +- src/corelib/io/qiodevice_p.h | 4 +- src/corelib/io/qprocess.h | 4 +- src/corelib/io/qprocess_p.h | 2 +- src/corelib/io/qprocess_unix.cpp | 2 +- src/corelib/io/qsavefile.h | 2 +- src/corelib/io/qsettings.h | 10 +-- src/corelib/io/qsettings_mac.cpp | 2 +- src/corelib/io/qstorageinfo_mac.cpp | 6 +- src/corelib/io/qstorageinfo_unix.cpp | 6 +- src/corelib/io/qstorageinfo_win.cpp | 4 +- src/corelib/io/qtextstream.h | 4 +- src/corelib/io/qurl.h | 2 +- src/corelib/itemmodels/qabstractitemmodel.h | 16 ++-- src/corelib/itemmodels/qabstractproxymodel.h | 2 +- src/corelib/itemmodels/qidentityproxymodel.h | 2 +- src/corelib/itemmodels/qitemselectionmodel.h | 2 +- src/corelib/itemmodels/qsortfilterproxymodel.h | 2 +- src/corelib/itemmodels/qstringlistmodel.h | 4 +- src/corelib/json/qjsonarray.h | 4 +- src/corelib/json/qjsondocument.h | 2 +- src/corelib/json/qjsonobject.h | 4 +- src/corelib/json/qjsonvalue.h | 2 +- src/corelib/kernel/qabstracteventdispatcher.h | 6 +- src/corelib/kernel/qcore_unix.cpp | 2 +- src/corelib/kernel/qcore_unix_p.h | 2 +- src/corelib/kernel/qcoreapplication.cpp | 2 +- src/corelib/kernel/qcoreapplication.h | 8 +- src/corelib/kernel/qeventloop.h | 2 +- src/corelib/kernel/qjni.cpp | 2 +- src/corelib/kernel/qjnihelpers.cpp | 14 ++-- src/corelib/kernel/qjnionload.cpp | 2 +- src/corelib/kernel/qmetaobject.cpp | 6 +- src/corelib/kernel/qmetaobject.h | 38 +++++----- src/corelib/kernel/qmetatype.h | 92 +++++++++++------------ src/corelib/kernel/qobject.cpp | 6 +- src/corelib/kernel/qobject.h | 46 ++++++------ src/corelib/kernel/qobject_impl.h | 4 +- src/corelib/kernel/qobjectdefs.h | 24 +++--- src/corelib/kernel/qobjectdefs_impl.h | 6 +- src/corelib/kernel/qsharedmemory.h | 4 +- src/corelib/kernel/qsocketnotifier.h | 2 +- src/corelib/kernel/qtimer.h | 2 +- src/corelib/kernel/qtranslator.h | 4 +- src/corelib/kernel/qvariant.h | 16 ++-- src/corelib/kernel/qwineventnotifier.h | 4 +- src/corelib/mimetypes/qmimemagicrule_p.h | 2 +- src/corelib/plugin/qlibrary.h | 8 +- src/corelib/plugin/qpluginloader.h | 4 +- src/corelib/statemachine/qabstractstate.h | 2 +- src/corelib/statemachine/qabstracttransition.cpp | 2 +- src/corelib/statemachine/qabstracttransition.h | 2 +- src/corelib/statemachine/qeventtransition.h | 4 +- src/corelib/statemachine/qfinalstate.h | 2 +- src/corelib/statemachine/qhistorystate.cpp | 2 +- src/corelib/statemachine/qhistorystate.h | 4 +- src/corelib/statemachine/qsignaltransition.h | 8 +- src/corelib/statemachine/qstate.cpp | 2 +- src/corelib/statemachine/qstate.h | 4 +- src/corelib/statemachine/qstatemachine.cpp | 6 +- src/corelib/statemachine/qstatemachine.h | 4 +- src/corelib/thread/qexception.cpp | 4 +- src/corelib/thread/qexception.h | 2 +- src/corelib/thread/qfutureinterface.h | 2 +- src/corelib/thread/qfuturewatcher.h | 4 +- src/corelib/thread/qmutex.h | 10 +-- src/corelib/thread/qreadwritelock.h | 4 +- src/corelib/thread/qresultstore.h | 4 +- src/corelib/thread/qthread.h | 4 +- src/corelib/thread/qthreadpool.h | 2 +- src/corelib/tools/qarraydata.h | 4 +- src/corelib/tools/qbytearray.h | 20 ++--- src/corelib/tools/qbytearraylist.h | 2 +- src/corelib/tools/qcollator.h | 2 +- src/corelib/tools/qdatetime.h | 2 +- src/corelib/tools/qeasingcurve.cpp | 2 +- src/corelib/tools/qeasingcurve.h | 2 +- src/corelib/tools/qhash.h | 8 +- src/corelib/tools/qlinkedlist.h | 4 +- src/corelib/tools/qlist.h | 4 +- src/corelib/tools/qlocale.h | 32 ++++---- src/corelib/tools/qmap.h | 46 ++++++------ src/corelib/tools/qringbuffer_p.h | 2 +- src/corelib/tools/qscopedpointer.h | 12 +-- src/corelib/tools/qshareddata.h | 12 +-- src/corelib/tools/qsharedpointer_impl.h | 38 +++++----- src/corelib/tools/qstring.cpp | 6 +- src/corelib/tools/qstring.h | 48 ++++++------ src/corelib/tools/qtextboundaryfinder.h | 2 +- src/corelib/tools/qtimeline.h | 2 +- src/corelib/tools/qversionnumber.h | 2 +- src/corelib/xml/qxmlstream.h | 2 +- 110 files changed, 398 insertions(+), 398 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/animation/qabstractanimation.h b/src/corelib/animation/qabstractanimation.h index 4b6eb9e14e..0ff6bc5176 100644 --- a/src/corelib/animation/qabstractanimation.h +++ b/src/corelib/animation/qabstractanimation.h @@ -82,7 +82,7 @@ public: DeleteWhenStopped }; - QAbstractAnimation(QObject *parent = Q_NULLPTR); + QAbstractAnimation(QObject *parent = nullptr); virtual ~QAbstractAnimation(); State state() const; @@ -117,7 +117,7 @@ public Q_SLOTS: void setCurrentTime(int msecs); protected: - QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = Q_NULLPTR); + QAbstractAnimation(QAbstractAnimationPrivate &dd, QObject *parent = nullptr); bool event(QEvent *event) override; virtual void updateCurrentTime(int currentTime) = 0; @@ -136,7 +136,7 @@ class Q_CORE_EXPORT QAnimationDriver : public QObject Q_DECLARE_PRIVATE(QAnimationDriver) public: - QAnimationDriver(QObject *parent = Q_NULLPTR); + QAnimationDriver(QObject *parent = nullptr); ~QAnimationDriver(); virtual void advance(); @@ -162,7 +162,7 @@ protected: virtual void start(); virtual void stop(); - QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent = Q_NULLPTR); + QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent = nullptr); private: friend class QUnifiedTimer; diff --git a/src/corelib/animation/qanimationgroup.h b/src/corelib/animation/qanimationgroup.h index 574a828ee1..136ad3ca9f 100644 --- a/src/corelib/animation/qanimationgroup.h +++ b/src/corelib/animation/qanimationgroup.h @@ -53,7 +53,7 @@ class Q_CORE_EXPORT QAnimationGroup : public QAbstractAnimation Q_OBJECT public: - QAnimationGroup(QObject *parent = Q_NULLPTR); + QAnimationGroup(QObject *parent = nullptr); ~QAnimationGroup(); QAbstractAnimation *animationAt(int index) const; diff --git a/src/corelib/animation/qparallelanimationgroup.h b/src/corelib/animation/qparallelanimationgroup.h index 19a7f2fd83..09a439ef24 100644 --- a/src/corelib/animation/qparallelanimationgroup.h +++ b/src/corelib/animation/qparallelanimationgroup.h @@ -53,7 +53,7 @@ class Q_CORE_EXPORT QParallelAnimationGroup : public QAnimationGroup Q_OBJECT public: - QParallelAnimationGroup(QObject *parent = Q_NULLPTR); + QParallelAnimationGroup(QObject *parent = nullptr); ~QParallelAnimationGroup(); int duration() const override; diff --git a/src/corelib/animation/qpauseanimation.h b/src/corelib/animation/qpauseanimation.h index 541186fa48..e2095a39d6 100644 --- a/src/corelib/animation/qpauseanimation.h +++ b/src/corelib/animation/qpauseanimation.h @@ -54,8 +54,8 @@ class Q_CORE_EXPORT QPauseAnimation : public QAbstractAnimation Q_OBJECT Q_PROPERTY(int duration READ duration WRITE setDuration) public: - QPauseAnimation(QObject *parent = Q_NULLPTR); - QPauseAnimation(int msecs, QObject *parent = Q_NULLPTR); + QPauseAnimation(QObject *parent = nullptr); + QPauseAnimation(int msecs, QObject *parent = nullptr); ~QPauseAnimation(); int duration() const override; diff --git a/src/corelib/animation/qpropertyanimation.h b/src/corelib/animation/qpropertyanimation.h index 419fd1e51c..3270591d1d 100644 --- a/src/corelib/animation/qpropertyanimation.h +++ b/src/corelib/animation/qpropertyanimation.h @@ -55,8 +55,8 @@ class Q_CORE_EXPORT QPropertyAnimation : public QVariantAnimation Q_PROPERTY(QObject* targetObject READ targetObject WRITE setTargetObject) public: - QPropertyAnimation(QObject *parent = Q_NULLPTR); - QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = Q_NULLPTR); + QPropertyAnimation(QObject *parent = nullptr); + QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = nullptr); ~QPropertyAnimation(); QObject *targetObject() const; diff --git a/src/corelib/animation/qsequentialanimationgroup.h b/src/corelib/animation/qsequentialanimationgroup.h index 636e39a075..1c8e67d256 100644 --- a/src/corelib/animation/qsequentialanimationgroup.h +++ b/src/corelib/animation/qsequentialanimationgroup.h @@ -56,7 +56,7 @@ class Q_CORE_EXPORT QSequentialAnimationGroup : public QAnimationGroup Q_PROPERTY(QAbstractAnimation* currentAnimation READ currentAnimation NOTIFY currentAnimationChanged) public: - QSequentialAnimationGroup(QObject *parent = Q_NULLPTR); + QSequentialAnimationGroup(QObject *parent = nullptr); ~QSequentialAnimationGroup(); QPauseAnimation *addPause(int msecs); diff --git a/src/corelib/animation/qvariantanimation.h b/src/corelib/animation/qvariantanimation.h index 74d804dacd..ed38979ad0 100644 --- a/src/corelib/animation/qvariantanimation.h +++ b/src/corelib/animation/qvariantanimation.h @@ -65,7 +65,7 @@ public: typedef QPair KeyValue; typedef QVector KeyValues; - QVariantAnimation(QObject *parent = Q_NULLPTR); + QVariantAnimation(QObject *parent = nullptr); ~QVariantAnimation(); QVariant startValue() const; @@ -94,7 +94,7 @@ Q_SIGNALS: void valueChanged(const QVariant &value); protected: - QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = Q_NULLPTR); + QVariantAnimation(QVariantAnimationPrivate &dd, QObject *parent = nullptr); bool event(QEvent *event) override; void updateCurrentTime(int) override; diff --git a/src/corelib/arch/qatomic_cxx11.h b/src/corelib/arch/qatomic_cxx11.h index 1404849382..2fc0bf5419 100644 --- a/src/corelib/arch/qatomic_cxx11.h +++ b/src/corelib/arch/qatomic_cxx11.h @@ -276,7 +276,7 @@ template struct QAtomicOps static inline Q_DECL_CONSTEXPR bool isTestAndSetWaitFree() Q_DECL_NOTHROW { return false; } template - static bool testAndSetRelaxed(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW + static bool testAndSetRelaxed(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_relaxed, std::memory_order_relaxed); if (currentValue) @@ -285,7 +285,7 @@ template struct QAtomicOps } template - static bool testAndSetAcquire(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW + static bool testAndSetAcquire(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acquire, std::memory_order_acquire); if (currentValue) @@ -294,7 +294,7 @@ template struct QAtomicOps } template - static bool testAndSetRelease(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW + static bool testAndSetRelease(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_release, std::memory_order_relaxed); if (currentValue) @@ -303,7 +303,7 @@ template struct QAtomicOps } template - static bool testAndSetOrdered(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = Q_NULLPTR) Q_DECL_NOTHROW + static bool testAndSetOrdered(std::atomic &_q_value, T expectedValue, T newValue, T *currentValue = nullptr) Q_DECL_NOTHROW { bool tmp = _q_value.compare_exchange_strong(expectedValue, newValue, std::memory_order_acq_rel, std::memory_order_acquire); if (currentValue) diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h index 5163d37238..8153bebac8 100644 --- a/src/corelib/codecs/qtextcodec.h +++ b/src/corelib/codecs/qtextcodec.h @@ -100,7 +100,7 @@ public: struct Q_CORE_EXPORT ConverterState { ConverterState(ConversionFlags f = DefaultConversion) - : flags(f), remainingChars(0), invalidChars(0), d(Q_NULLPTR) { state_data[0] = state_data[1] = state_data[2] = 0; } + : flags(f), remainingChars(0), invalidChars(0), d(nullptr) { state_data[0] = state_data[1] = state_data[2] = 0; } ~ConverterState(); ConversionFlags flags; int remainingChars; @@ -111,9 +111,9 @@ public: Q_DISABLE_COPY(ConverterState) }; - QString toUnicode(const char *in, int length, ConverterState *state = Q_NULLPTR) const + QString toUnicode(const char *in, int length, ConverterState *state = nullptr) const { return convertToUnicode(in, length, state); } - QByteArray fromUnicode(const QChar *in, int length, ConverterState *state = Q_NULLPTR) const + QByteArray fromUnicode(const QChar *in, int length, ConverterState *state = nullptr) const { return convertFromUnicode(in, length, state); } QTextDecoder* makeDecoder(ConversionFlags flags = DefaultConversion) const; diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index feeb488acd..4806f6cd74 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -118,7 +118,7 @@ public: Q_DECL_CONSTEXPR inline QFlags &operator=(const QFlags &other); #endif Q_DECL_CONSTEXPR inline QFlags(Enum f) Q_DECL_NOTHROW : i(Int(f)) {} - Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {} + Q_DECL_CONSTEXPR inline QFlags(Zero = nullptr) Q_DECL_NOTHROW : i(0) {} Q_DECL_CONSTEXPR inline QFlags(QFlag f) Q_DECL_NOTHROW : i(f) {} #ifdef Q_COMPILER_INITIALIZER_LISTS diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index ff388770f5..c9ec46c67f 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1138,7 +1138,7 @@ Q_CORE_EXPORT bool qunsetenv(const char *varName); Q_CORE_EXPORT bool qEnvironmentVariableIsEmpty(const char *varName) Q_DECL_NOEXCEPT; Q_CORE_EXPORT bool qEnvironmentVariableIsSet(const char *varName) Q_DECL_NOEXCEPT; -Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=Q_NULLPTR) Q_DECL_NOEXCEPT; +Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) Q_DECL_NOEXCEPT; inline int qIntCast(double f) { return int(f); } inline int qIntCast(float f) { return int(f); } diff --git a/src/corelib/global/qlogging.h b/src/corelib/global/qlogging.h index ec21198784..0c8d7dab38 100644 --- a/src/corelib/global/qlogging.h +++ b/src/corelib/global/qlogging.h @@ -64,7 +64,7 @@ class QMessageLogContext Q_DISABLE_COPY(QMessageLogContext) public: Q_DECL_CONSTEXPR QMessageLogContext() - : version(2), line(0), file(Q_NULLPTR), function(Q_NULLPTR), category(Q_NULLPTR) {} + : version(2), line(0), file(nullptr), function(nullptr), category(nullptr) {} Q_DECL_CONSTEXPR QMessageLogContext(const char *fileName, int lineNumber, const char *functionName, const char *categoryName) : version(2), line(lineNumber), file(fileName), function(functionName), category(categoryName) {} @@ -150,9 +150,9 @@ private: #define QT_MESSAGELOG_LINE __LINE__ #define QT_MESSAGELOG_FUNC Q_FUNC_INFO #else - #define QT_MESSAGELOG_FILE Q_NULLPTR + #define QT_MESSAGELOG_FILE nullptr #define QT_MESSAGELOG_LINE 0 - #define QT_MESSAGELOG_FUNC Q_NULLPTR + #define QT_MESSAGELOG_FUNC nullptr #endif #define qDebug QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC).debug diff --git a/src/corelib/io/qbuffer.h b/src/corelib/io/qbuffer.h index 1c5b16ee50..39e1e7b39d 100644 --- a/src/corelib/io/qbuffer.h +++ b/src/corelib/io/qbuffer.h @@ -57,8 +57,8 @@ class Q_CORE_EXPORT QBuffer : public QIODevice public: #ifndef QT_NO_QOBJECT - explicit QBuffer(QObject *parent = Q_NULLPTR); - QBuffer(QByteArray *buf, QObject *parent = Q_NULLPTR); + explicit QBuffer(QObject *parent = nullptr); + QBuffer(QByteArray *buf, QObject *parent = nullptr); #else QBuffer(); explicit QBuffer(QByteArray *buf); diff --git a/src/corelib/io/qfile.h b/src/corelib/io/qfile.h index 02d644446d..e6f3d942fe 100644 --- a/src/corelib/io/qfile.h +++ b/src/corelib/io/qfile.h @@ -142,7 +142,7 @@ protected: #ifdef QT_NO_QOBJECT QFile(QFilePrivate &dd); #else - QFile(QFilePrivate &dd, QObject *parent = Q_NULLPTR); + QFile(QFilePrivate &dd, QObject *parent = nullptr); #endif private: diff --git a/src/corelib/io/qfiledevice.h b/src/corelib/io/qfiledevice.h index 020c90afaf..af41bec2f6 100644 --- a/src/corelib/io/qfiledevice.h +++ b/src/corelib/io/qfiledevice.h @@ -136,7 +136,7 @@ protected: QFileDevice(QFileDevicePrivate &dd); #else explicit QFileDevice(QObject *parent); - QFileDevice(QFileDevicePrivate &dd, QObject *parent = Q_NULLPTR); + QFileDevice(QFileDevicePrivate &dd, QObject *parent = nullptr); #endif qint64 readData(char *data, qint64 maxlen) override; diff --git a/src/corelib/io/qfileselector.h b/src/corelib/io/qfileselector.h index fafb7f7609..c9c2f564f6 100644 --- a/src/corelib/io/qfileselector.h +++ b/src/corelib/io/qfileselector.h @@ -50,7 +50,7 @@ class Q_CORE_EXPORT QFileSelector : public QObject { Q_OBJECT public: - explicit QFileSelector(QObject *parent = Q_NULLPTR); + explicit QFileSelector(QObject *parent = nullptr); ~QFileSelector(); QString select(const QString &filePath) const; diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h index 09d4e8e65e..057a20672c 100644 --- a/src/corelib/io/qfilesystemwatcher.h +++ b/src/corelib/io/qfilesystemwatcher.h @@ -55,8 +55,8 @@ class Q_CORE_EXPORT QFileSystemWatcher : public QObject Q_DECLARE_PRIVATE(QFileSystemWatcher) public: - QFileSystemWatcher(QObject *parent = Q_NULLPTR); - QFileSystemWatcher(const QStringList &paths, QObject *parent = Q_NULLPTR); + QFileSystemWatcher(QObject *parent = nullptr); + QFileSystemWatcher(const QStringList &paths, QObject *parent = nullptr); ~QFileSystemWatcher(); bool addPath(const QString &file); diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm index b4517cbac7..792ea387ac 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.mm +++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm @@ -336,7 +336,7 @@ QStringList QFseventsFileSystemWatcherEngine::addPaths(const QStringList &paths, QMutexLocker locker(&lock); - bool wasRunning = stream != Q_NULLPTR; + bool wasRunning = stream != nullptr; bool needsRestart = false; WatchingState oldState = watchingState; diff --git a/src/corelib/io/qiodevice.h b/src/corelib/io/qiodevice.h index e64a4d0bb1..af37b3fd53 100644 --- a/src/corelib/io/qiodevice.h +++ b/src/corelib/io/qiodevice.h @@ -161,7 +161,7 @@ protected: #ifdef QT_NO_QOBJECT QIODevice(QIODevicePrivate &dd); #else - QIODevice(QIODevicePrivate &dd, QObject *parent = Q_NULLPTR); + QIODevice(QIODevicePrivate &dd, QObject *parent = nullptr); #endif virtual qint64 readData(char *data, qint64 maxlen) = 0; virtual qint64 readLineData(char *data, qint64 maxlen); diff --git a/src/corelib/io/qiodevice_p.h b/src/corelib/io/qiodevice_p.h index de2aa1597e..15a53a67dc 100644 --- a/src/corelib/io/qiodevice_p.h +++ b/src/corelib/io/qiodevice_p.h @@ -88,14 +88,14 @@ public: class QRingBufferRef { QRingBuffer *m_buf; - inline QRingBufferRef() : m_buf(Q_NULLPTR) { } + inline QRingBufferRef() : m_buf(nullptr) { } friend class QIODevicePrivate; public: // wrap functions from QRingBuffer inline void setChunkSize(int size) { Q_ASSERT(m_buf); m_buf->setChunkSize(size); } inline int chunkSize() const { Q_ASSERT(m_buf); return m_buf->chunkSize(); } inline qint64 nextDataBlockSize() const { return (m_buf ? m_buf->nextDataBlockSize() : Q_INT64_C(0)); } - inline const char *readPointer() const { return (m_buf ? m_buf->readPointer() : Q_NULLPTR); } + inline const char *readPointer() const { return (m_buf ? m_buf->readPointer() : nullptr); } inline const char *readPointerAtPosition(qint64 pos, qint64 &length) const { Q_ASSERT(m_buf); return m_buf->readPointerAtPosition(pos, length); } inline void free(qint64 bytes) { Q_ASSERT(m_buf); m_buf->free(bytes); } inline char *reserve(qint64 bytes) { Q_ASSERT(m_buf); return m_buf->reserve(bytes); } diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index 7ce94d5ecd..474fc87de8 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -155,7 +155,7 @@ public: }; Q_ENUM(ExitStatus) - explicit QProcess(QObject *parent = Q_NULLPTR); + explicit QProcess(QObject *parent = nullptr); virtual ~QProcess(); void start(const QString &program, const QStringList &arguments, OpenMode mode = ReadWrite); @@ -253,7 +253,7 @@ public: #if defined(Q_QDOC) = QString() #endif - , qint64 *pid = Q_NULLPTR); + , qint64 *pid = nullptr); #if !defined(Q_QDOC) static bool startDetached(const QString &program, const QStringList &arguments); // ### Qt6: merge overloads #endif diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index deb29dca0a..aa7ecbe91d 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -352,7 +352,7 @@ public: #if defined(Q_OS_UNIX) void execChild(const char *workingDirectory, char **argv, char **envp); #endif - bool processStarted(QString *errorMessage = Q_NULLPTR); + bool processStarted(QString *errorMessage = nullptr); void terminateProcess(); void killProcess(); void findExitCode(); diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 15752f84b2..68b7a8bf9b 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -885,7 +885,7 @@ bool QProcessPrivate::waitForDeadChild() // read the process information from our fd forkfd_info info; int ret; - EINTR_LOOP(ret, forkfd_wait(forkfd, &info, Q_NULLPTR)); + EINTR_LOOP(ret, forkfd_wait(forkfd, &info, nullptr)); exitCode = info.status; crashed = info.code != CLD_EXITED; diff --git a/src/corelib/io/qsavefile.h b/src/corelib/io/qsavefile.h index 8bfd14eb63..200068d30d 100644 --- a/src/corelib/io/qsavefile.h +++ b/src/corelib/io/qsavefile.h @@ -67,7 +67,7 @@ public: explicit QSaveFile(const QString &name); #ifndef QT_NO_QOBJECT - explicit QSaveFile(QObject *parent = Q_NULLPTR); + explicit QSaveFile(QObject *parent = nullptr); explicit QSaveFile(const QString &name, QObject *parent); #endif ~QSaveFile(); diff --git a/src/corelib/io/qsettings.h b/src/corelib/io/qsettings.h index d68d4d65f9..f34e6bea1b 100644 --- a/src/corelib/io/qsettings.h +++ b/src/corelib/io/qsettings.h @@ -125,13 +125,13 @@ public: #ifndef QT_NO_QOBJECT explicit QSettings(const QString &organization, - const QString &application = QString(), QObject *parent = Q_NULLPTR); + const QString &application = QString(), QObject *parent = nullptr); QSettings(Scope scope, const QString &organization, - const QString &application = QString(), QObject *parent = Q_NULLPTR); + const QString &application = QString(), QObject *parent = nullptr); QSettings(Format format, Scope scope, const QString &organization, - const QString &application = QString(), QObject *parent = Q_NULLPTR); - QSettings(const QString &fileName, Format format, QObject *parent = Q_NULLPTR); - explicit QSettings(QObject *parent = Q_NULLPTR); + const QString &application = QString(), QObject *parent = nullptr); + QSettings(const QString &fileName, Format format, QObject *parent = nullptr); + explicit QSettings(QObject *parent = nullptr); #else explicit QSettings(const QString &organization, const QString &application = QString()); diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp index 2a08ee2e64..aa14d8435a 100644 --- a/src/corelib/io/qsettings_mac.cpp +++ b/src/corelib/io/qsettings_mac.cpp @@ -616,7 +616,7 @@ bool QConfFileSettingsPrivate::readPlistFile(const QByteArray &data, ParsedSetti { QCFType cfData = data.toRawCFData(); QCFType propertyList = - CFPropertyListCreateWithData(kCFAllocatorDefault, cfData, kCFPropertyListImmutable, Q_NULLPTR, Q_NULLPTR); + CFPropertyListCreateWithData(kCFAllocatorDefault, cfData, kCFPropertyListImmutable, nullptr, nullptr); if (!propertyList) return true; diff --git a/src/corelib/io/qstorageinfo_mac.cpp b/src/corelib/io/qstorageinfo_mac.cpp index 0f271f2bc6..8b06543d71 100644 --- a/src/corelib/io/qstorageinfo_mac.cpp +++ b/src/corelib/io/qstorageinfo_mac.cpp @@ -112,7 +112,7 @@ void QStorageInfoPrivate::retrieveUrlProperties(bool initRootPath) QCFType keys = CFArrayCreate(kCFAllocatorDefault, initRootPath ? rootPathKeys : propertyKeys, size, - Q_NULLPTR); + nullptr); if (!keys) return; @@ -178,9 +178,9 @@ QList QStorageInfoPrivate::mountedVolumes() QList volumes; QCFType enumerator; - enumerator = CFURLEnumeratorCreateForMountedVolumes(Q_NULLPTR, + enumerator = CFURLEnumeratorCreateForMountedVolumes(nullptr, kCFURLEnumeratorSkipInvisibles, - Q_NULLPTR); + nullptr); CFURLEnumeratorResult result = kCFURLEnumeratorSuccess; do { diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 9072b34f54..0911083bac 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -257,7 +257,7 @@ inline QStorageIterator::~QStorageIterator() inline bool QStorageIterator::isValid() const { - return fp != Q_NULLPTR; + return fp != nullptr; } inline bool QStorageIterator::next() @@ -357,12 +357,12 @@ inline QStorageIterator::~QStorageIterator() inline bool QStorageIterator::isValid() const { - return fp != Q_NULLPTR; + return fp != nullptr; } inline bool QStorageIterator::next() { - return ::getmntent_r(fp, &mnt, buffer.data(), buffer.size()) != Q_NULLPTR; + return ::getmntent_r(fp, &mnt, buffer.data(), buffer.size()) != nullptr; } inline QString QStorageIterator::rootPath() const diff --git a/src/corelib/io/qstorageinfo_win.cpp b/src/corelib/io/qstorageinfo_win.cpp index 3830c5480c..8a3db90f87 100644 --- a/src/corelib/io/qstorageinfo_win.cpp +++ b/src/corelib/io/qstorageinfo_win.cpp @@ -147,8 +147,8 @@ void QStorageInfoPrivate::retrieveVolumeInfo() const bool result = ::GetVolumeInformation(reinterpret_cast(path.utf16()), nameBuffer, defaultBufferSize, - Q_NULLPTR, - Q_NULLPTR, + nullptr, + nullptr, &fileSystemFlags, fileSystemTypeBuffer, defaultBufferSize); diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h index e72b7942fd..ee0b09419d 100644 --- a/src/corelib/io/qtextstream.h +++ b/src/corelib/io/qtextstream.h @@ -212,8 +212,8 @@ typedef void (QTextStream::*QTSMFC)(QChar); // manipulator w/QChar argument class Q_CORE_EXPORT QTextStreamManipulator { public: - Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) Q_DECL_NOTHROW : mf(m), mc(Q_NULLPTR), arg(a), ch() {} - Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) Q_DECL_NOTHROW : mf(Q_NULLPTR), mc(m), arg(-1), ch(c) {} + Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFI m, int a) Q_DECL_NOTHROW : mf(m), mc(nullptr), arg(a), ch() {} + Q_DECL_CONSTEXPR QTextStreamManipulator(QTSMFC m, QChar c) Q_DECL_NOTHROW : mf(nullptr), mc(m), arg(-1), ch(c) {} void exec(QTextStream &s) { if (mf) { (s.*mf)(arg); } else { (s.*mc)(ch); } } private: diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 0bb8707ff9..5062ef7905 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -184,7 +184,7 @@ public: #endif #ifdef Q_COMPILER_RVALUE_REFS QUrl(QUrl &&other) Q_DECL_NOTHROW : d(other.d) - { other.d = Q_NULLPTR; } + { other.d = nullptr; } inline QUrl &operator=(QUrl &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h index 48e0791cb5..d012be6c61 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.h +++ b/src/corelib/itemmodels/qabstractitemmodel.h @@ -55,7 +55,7 @@ class Q_CORE_EXPORT QModelIndex { friend class QAbstractItemModel; public: - Q_DECL_CONSTEXPR inline QModelIndex() Q_DECL_NOTHROW : r(-1), c(-1), i(0), m(Q_NULLPTR) {} + Q_DECL_CONSTEXPR inline QModelIndex() Q_DECL_NOTHROW : r(-1), c(-1), i(0), m(nullptr) {} // compiler-generated copy/move ctors/assignment operators are fine! Q_DECL_CONSTEXPR inline int row() const Q_DECL_NOTHROW { return r; } Q_DECL_CONSTEXPR inline int column() const Q_DECL_NOTHROW { return c; } @@ -69,7 +69,7 @@ public: inline QVariant data(int role = Qt::DisplayRole) const; inline Qt::ItemFlags flags() const; Q_DECL_CONSTEXPR inline const QAbstractItemModel *model() const Q_DECL_NOTHROW { return m; } - Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW { return (r >= 0) && (c >= 0) && (m != Q_NULLPTR); } + Q_DECL_CONSTEXPR inline bool isValid() const Q_DECL_NOTHROW { return (r >= 0) && (c >= 0) && (m != nullptr); } Q_DECL_CONSTEXPR inline bool operator==(const QModelIndex &other) const Q_DECL_NOTHROW { return (other.r == r) && (other.i == i) && (other.c == c) && (other.m == m); } Q_DECL_CONSTEXPR inline bool operator!=(const QModelIndex &other) const Q_DECL_NOTHROW @@ -115,7 +115,7 @@ public: QPersistentModelIndex &operator=(const QPersistentModelIndex &other); #ifdef Q_COMPILER_RVALUE_REFS inline QPersistentModelIndex(QPersistentModelIndex &&other) Q_DECL_NOTHROW - : d(other.d) { other.d = Q_NULLPTR; } + : d(other.d) { other.d = nullptr; } inline QPersistentModelIndex &operator=(QPersistentModelIndex &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif @@ -171,7 +171,7 @@ class Q_CORE_EXPORT QAbstractItemModel : public QObject friend class QIdentityProxyModel; public: - explicit QAbstractItemModel(QObject *parent = Q_NULLPTR); + explicit QAbstractItemModel(QObject *parent = nullptr); virtual ~QAbstractItemModel(); Q_INVOKABLE bool hasIndex(int row, int column, const QModelIndex &parent = QModelIndex()) const; @@ -286,9 +286,9 @@ protected Q_SLOTS: void resetInternalData(); protected: - QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = Q_NULLPTR); + QAbstractItemModel(QAbstractItemModelPrivate &dd, QObject *parent = nullptr); - inline QModelIndex createIndex(int row, int column, void *data = Q_NULLPTR) const; + inline QModelIndex createIndex(int row, int column, void *data = nullptr) const; inline QModelIndex createIndex(int row, int column, quintptr id) const; void encodeData(const QModelIndexList &indexes, QDataStream &stream) const; @@ -367,7 +367,7 @@ class Q_CORE_EXPORT QAbstractTableModel : public QAbstractItemModel Q_OBJECT public: - explicit QAbstractTableModel(QObject *parent = Q_NULLPTR); + explicit QAbstractTableModel(QObject *parent = nullptr); ~QAbstractTableModel(); QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; @@ -393,7 +393,7 @@ class Q_CORE_EXPORT QAbstractListModel : public QAbstractItemModel Q_OBJECT public: - explicit QAbstractListModel(QObject *parent = Q_NULLPTR); + explicit QAbstractListModel(QObject *parent = nullptr); ~QAbstractListModel(); QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const override; diff --git a/src/corelib/itemmodels/qabstractproxymodel.h b/src/corelib/itemmodels/qabstractproxymodel.h index ed7bc91b79..6aa82b21ee 100644 --- a/src/corelib/itemmodels/qabstractproxymodel.h +++ b/src/corelib/itemmodels/qabstractproxymodel.h @@ -56,7 +56,7 @@ class Q_CORE_EXPORT QAbstractProxyModel : public QAbstractItemModel Q_PROPERTY(QAbstractItemModel* sourceModel READ sourceModel WRITE setSourceModel NOTIFY sourceModelChanged) public: - explicit QAbstractProxyModel(QObject *parent = Q_NULLPTR); + explicit QAbstractProxyModel(QObject *parent = nullptr); ~QAbstractProxyModel(); virtual void setSourceModel(QAbstractItemModel *sourceModel); diff --git a/src/corelib/itemmodels/qidentityproxymodel.h b/src/corelib/itemmodels/qidentityproxymodel.h index 4c5f08f7d3..d2b1ed9498 100644 --- a/src/corelib/itemmodels/qidentityproxymodel.h +++ b/src/corelib/itemmodels/qidentityproxymodel.h @@ -54,7 +54,7 @@ class Q_CORE_EXPORT QIdentityProxyModel : public QAbstractProxyModel { Q_OBJECT public: - explicit QIdentityProxyModel(QObject* parent = Q_NULLPTR); + explicit QIdentityProxyModel(QObject* parent = nullptr); ~QIdentityProxyModel(); int columnCount(const QModelIndex& parent = QModelIndex()) const override; diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h index 9d33303ddc..091c5a21a5 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.h +++ b/src/corelib/itemmodels/qitemselectionmodel.h @@ -164,7 +164,7 @@ public: Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag) Q_FLAG(SelectionFlags) - explicit QItemSelectionModel(QAbstractItemModel *model = Q_NULLPTR); + explicit QItemSelectionModel(QAbstractItemModel *model = nullptr); explicit QItemSelectionModel(QAbstractItemModel *model, QObject *parent); virtual ~QItemSelectionModel(); diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h index 3c840406e0..2f93836544 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.h +++ b/src/corelib/itemmodels/qsortfilterproxymodel.h @@ -70,7 +70,7 @@ class Q_CORE_EXPORT QSortFilterProxyModel : public QAbstractProxyModel Q_PROPERTY(bool recursiveFiltering READ recursiveFiltering WRITE setRecursiveFiltering) public: - explicit QSortFilterProxyModel(QObject *parent = Q_NULLPTR); + explicit QSortFilterProxyModel(QObject *parent = nullptr); ~QSortFilterProxyModel(); void setSourceModel(QAbstractItemModel *sourceModel) override; diff --git a/src/corelib/itemmodels/qstringlistmodel.h b/src/corelib/itemmodels/qstringlistmodel.h index bd601e4f4e..38da1022ea 100644 --- a/src/corelib/itemmodels/qstringlistmodel.h +++ b/src/corelib/itemmodels/qstringlistmodel.h @@ -52,8 +52,8 @@ class Q_CORE_EXPORT QStringListModel : public QAbstractListModel { Q_OBJECT public: - explicit QStringListModel(QObject *parent = Q_NULLPTR); - explicit QStringListModel(const QStringList &strings, QObject *parent = Q_NULLPTR); + explicit QStringListModel(QObject *parent = nullptr); + explicit QStringListModel(const QStringList &strings, QObject *parent = nullptr); int rowCount(const QModelIndex &parent = QModelIndex()) const override; QModelIndex sibling(int row, int column, const QModelIndex &idx) const override; diff --git a/src/corelib/json/qjsonarray.h b/src/corelib/json/qjsonarray.h index ddba2ca78e..8d41138c97 100644 --- a/src/corelib/json/qjsonarray.h +++ b/src/corelib/json/qjsonarray.h @@ -133,7 +133,7 @@ public: typedef QJsonValueRef reference; typedef QJsonValueRefPtr pointer; - inline iterator() : a(Q_NULLPTR), i(0) { } + inline iterator() : a(nullptr), i(0) { } explicit inline iterator(QJsonArray *array, int index) : a(array), i(index) { } inline QJsonValueRef operator*() const { return QJsonValueRef(a, i); } @@ -178,7 +178,7 @@ public: typedef QJsonValue reference; typedef QJsonValuePtr pointer; - inline const_iterator() : a(Q_NULLPTR), i(0) { } + inline const_iterator() : a(nullptr), i(0) { } explicit inline const_iterator(const QJsonArray *array, int index) : a(array), i(index) { } #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) inline const_iterator(const const_iterator &o) : a(o.a), i(o.i) {} // ### Qt 6: Removed so class can be trivially-copyable diff --git a/src/corelib/json/qjsondocument.h b/src/corelib/json/qjsondocument.h index 4e76af21e2..e1730cf374 100644 --- a/src/corelib/json/qjsondocument.h +++ b/src/corelib/json/qjsondocument.h @@ -129,7 +129,7 @@ public: Compact }; - static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = Q_NULLPTR); + static QJsonDocument fromJson(const QByteArray &json, QJsonParseError *error = nullptr); #ifdef Q_QDOC QByteArray toJson(JsonFormat format = Indented) const; diff --git a/src/corelib/json/qjsonobject.h b/src/corelib/json/qjsonobject.h index c77e2164a8..610bce694c 100644 --- a/src/corelib/json/qjsonobject.h +++ b/src/corelib/json/qjsonobject.h @@ -135,7 +135,7 @@ public: typedef QJsonValueRef reference; typedef QJsonValuePtr pointer; - Q_DECL_CONSTEXPR inline iterator() : o(Q_NULLPTR), i(0) {} + Q_DECL_CONSTEXPR inline iterator() : o(nullptr), i(0) {} Q_DECL_CONSTEXPR inline iterator(QJsonObject *obj, int index) : o(obj), i(index) {} inline QString key() const { return o->keyAt(i); } @@ -178,7 +178,7 @@ public: typedef QJsonValue reference; typedef QJsonValuePtr pointer; - Q_DECL_CONSTEXPR inline const_iterator() : o(Q_NULLPTR), i(0) {} + Q_DECL_CONSTEXPR inline const_iterator() : o(nullptr), i(0) {} Q_DECL_CONSTEXPR inline const_iterator(const QJsonObject *obj, int index) : o(obj), i(index) {} inline const_iterator(const iterator &other) diff --git a/src/corelib/json/qjsonvalue.h b/src/corelib/json/qjsonvalue.h index 5d5ec72605..96538ebbf9 100644 --- a/src/corelib/json/qjsonvalue.h +++ b/src/corelib/json/qjsonvalue.h @@ -82,7 +82,7 @@ public: QJsonValue(QLatin1String s); #ifndef QT_NO_CAST_FROM_ASCII inline QT_ASCII_CAST_WARN QJsonValue(const char *s) - : d(Q_NULLPTR), t(String) { stringDataFromQStringHelper(QString::fromUtf8(s)); } + : d(nullptr), t(String) { stringDataFromQStringHelper(QString::fromUtf8(s)); } #endif QJsonValue(const QJsonArray &a); QJsonValue(const QJsonObject &o); diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h index 3a530cf1de..b84e047f3f 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.h +++ b/src/corelib/kernel/qabstracteventdispatcher.h @@ -70,10 +70,10 @@ public: { } }; - explicit QAbstractEventDispatcher(QObject *parent = Q_NULLPTR); + explicit QAbstractEventDispatcher(QObject *parent = nullptr); ~QAbstractEventDispatcher(); - static QAbstractEventDispatcher *instance(QThread *thread = Q_NULLPTR); + static QAbstractEventDispatcher *instance(QThread *thread = nullptr); virtual bool processEvents(QEventLoop::ProcessEventsFlags flags) = 0; virtual bool hasPendingEvents() = 0; // ### Qt6: remove, mark final or make protected @@ -112,7 +112,7 @@ public: bool filterNativeEvent(const QByteArray &eventType, void *message, long *result); #if QT_DEPRECATED_SINCE(5, 0) QT_DEPRECATED bool filterEvent(void *message) - { return filterNativeEvent("", message, Q_NULLPTR); } + { return filterNativeEvent("", message, nullptr); } #endif Q_SIGNALS: diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp index 3b0da136ca..eb98cbef8f 100644 --- a/src/corelib/kernel/qcore_unix.cpp +++ b/src/corelib/kernel/qcore_unix.cpp @@ -130,7 +130,7 @@ int qt_safe_poll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout if (!timeout_ts) { // no timeout -> block forever int ret; - EINTR_LOOP(ret, qt_ppoll(fds, nfds, Q_NULLPTR)); + EINTR_LOOP(ret, qt_ppoll(fds, nfds, nullptr)); return ret; } diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h index f78d2b9f24..e538a7e22b 100644 --- a/src/corelib/kernel/qcore_unix_p.h +++ b/src/corelib/kernel/qcore_unix_p.h @@ -362,7 +362,7 @@ Q_CORE_EXPORT int qt_safe_poll(struct pollfd *fds, nfds_t nfds, const struct tim static inline int qt_poll_msecs(struct pollfd *fds, nfds_t nfds, int timeout) { - timespec ts, *pts = Q_NULLPTR; + timespec ts, *pts = nullptr; if (timeout >= 0) { ts.tv_sec = timeout / 1000; diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 6b6009d757..19db06b015 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -426,7 +426,7 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint , argv(aargv) #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) , origArgc(0) - , origArgv(Q_NULLPTR) + , origArgv(nullptr) #endif , application_type(QCoreApplicationPrivate::Tty) #ifndef QT_NO_QOBJECT diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index f36c62845a..b4d83414ae 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -123,7 +123,7 @@ public: static bool sendEvent(QObject *receiver, QEvent *event); static void postEvent(QObject *receiver, QEvent *event, int priority = Qt::NormalEventPriority); - static void sendPostedEvents(QObject *receiver = Q_NULLPTR, int event_type = 0); + static void sendPostedEvents(QObject *receiver = nullptr, int event_type = 0); static void removePostedEvents(QObject *receiver, int eventType = 0); #if QT_DEPRECATED_SINCE(5, 3) QT_DEPRECATED static bool hasPendingEvents(); @@ -155,7 +155,7 @@ public: static QString translate(const char * context, const char * key, - const char * disambiguation = Q_NULLPTR, + const char * disambiguation = nullptr, int n = -1); #if QT_DEPRECATED_SINCE(5, 0) enum Encoding { UnicodeUTF8, Latin1, DefaultCodec = UnicodeUTF8, CodecForTr = UnicodeUTF8 }; @@ -241,13 +241,13 @@ inline bool QCoreApplication::sendSpontaneousEvent(QObject *receiver, QEvent *ev # define QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) #else # define QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) \ - QT_DEPRECATED static inline QString trUtf8(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) \ + QT_DEPRECATED static inline QString trUtf8(const char *sourceText, const char *disambiguation = nullptr, int n = -1) \ { return QCoreApplication::translate(#context, sourceText, disambiguation, n); } #endif #define Q_DECLARE_TR_FUNCTIONS(context) \ public: \ - static inline QString tr(const char *sourceText, const char *disambiguation = Q_NULLPTR, int n = -1) \ + static inline QString tr(const char *sourceText, const char *disambiguation = nullptr, int n = -1) \ { return QCoreApplication::translate(#context, sourceText, disambiguation, n); } \ QT_DECLARE_DEPRECATED_TR_FUNCTIONS(context) \ private: diff --git a/src/corelib/kernel/qeventloop.h b/src/corelib/kernel/qeventloop.h index 0cb431d7ce..eb1348220b 100644 --- a/src/corelib/kernel/qeventloop.h +++ b/src/corelib/kernel/qeventloop.h @@ -53,7 +53,7 @@ class Q_CORE_EXPORT QEventLoop : public QObject Q_DECLARE_PRIVATE(QEventLoop) public: - explicit QEventLoop(QObject *parent = Q_NULLPTR); + explicit QEventLoop(QObject *parent = nullptr); ~QEventLoop(); enum ProcessEventsFlag { diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp index 60154328c2..75a2436d9d 100644 --- a/src/corelib/kernel/qjni.cpp +++ b/src/corelib/kernel/qjni.cpp @@ -260,7 +260,7 @@ QJNIEnvironmentPrivate::QJNIEnvironmentPrivate() return; if (ret == JNI_EDETACHED) { // We need to (re-)attach - JavaVMAttachArgs args = { JNI_VERSION_1_6, qJniThreadName, Q_NULLPTR }; + JavaVMAttachArgs args = { JNI_VERSION_1_6, qJniThreadName, nullptr }; if (vm->AttachCurrentThread(&jniEnv, &args) != JNI_OK) return; diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp index 02c58858ff..c7109a6506 100644 --- a/src/corelib/kernel/qjnihelpers.cpp +++ b/src/corelib/kernel/qjnihelpers.cpp @@ -64,14 +64,14 @@ namespace QtAndroidPrivate { KeyEventListener::~KeyEventListener() {} } -static JavaVM *g_javaVM = Q_NULLPTR; -static jobject g_jActivity = Q_NULLPTR; -static jobject g_jService = Q_NULLPTR; -static jobject g_jClassLoader = Q_NULLPTR; +static JavaVM *g_javaVM = nullptr; +static jobject g_jActivity = nullptr; +static jobject g_jService = nullptr; +static jobject g_jClassLoader = nullptr; static jint g_androidSdkVersion = 0; -static jclass g_jNativeClass = Q_NULLPTR; -static jmethodID g_runPendingCppRunnablesMethodID = Q_NULLPTR; -static jmethodID g_hideSplashScreenMethodID = Q_NULLPTR; +static jclass g_jNativeClass = nullptr; +static jmethodID g_runPendingCppRunnablesMethodID = nullptr; +static jmethodID g_hideSplashScreenMethodID = nullptr; Q_GLOBAL_STATIC(std::deque, g_pendingRunnables); static QBasicMutex g_pendingRunnablesMutex; diff --git a/src/corelib/kernel/qjnionload.cpp b/src/corelib/kernel/qjnionload.cpp index 8f60800dba..0550b86553 100644 --- a/src/corelib/kernel/qjnionload.cpp +++ b/src/corelib/kernel/qjnionload.cpp @@ -61,7 +61,7 @@ Q_CORE_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) __android_log_print(ANDROID_LOG_INFO, logTag, "Start"); _JNIEnv uenv; - uenv.venv = Q_NULLPTR; + uenv.venv = nullptr; if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK) { diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index f07b463482..f24a511295 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -1589,7 +1589,7 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase * */ /*! - \fn bool QMetaObject::invokeMethod(QObject *receiver, PointerToMemberFunction function, Qt::ConnectionType type = Qt::AutoConnection, MemberFunctionReturnType *ret = Q_NULLPTR) + \fn bool QMetaObject::invokeMethod(QObject *receiver, PointerToMemberFunction function, Qt::ConnectionType type = Qt::AutoConnection, MemberFunctionReturnType *ret = nullptr) \since 5.10 @@ -1607,7 +1607,7 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase * */ /*! - \fn bool QMetaObject::invokeMethod(QObject *context, Functor function, Qt::ConnectionType type = Qt::AutoConnection, FunctorReturnType *ret = Q_NULLPTR) + \fn bool QMetaObject::invokeMethod(QObject *context, Functor function, Qt::ConnectionType type = Qt::AutoConnection, FunctorReturnType *ret = nullptr) \since 5.10 @@ -1617,7 +1617,7 @@ bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase * */ /*! - \fn bool QMetaObject::invokeMethod(QObject *context, Functor function, FunctorReturnType *ret = Q_NULLPTR) + \fn bool QMetaObject::invokeMethod(QObject *context, Functor function, FunctorReturnType *ret = nullptr) \since 5.10 diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h index 40b2aa6402..51df8faad3 100644 --- a/src/corelib/kernel/qmetaobject.h +++ b/src/corelib/kernel/qmetaobject.h @@ -54,7 +54,7 @@ template class QList; class Q_CORE_EXPORT QMetaMethod { public: - Q_DECL_CONSTEXPR inline QMetaMethod() : mobj(Q_NULLPTR), handle(0) {} + Q_DECL_CONSTEXPR inline QMetaMethod() : mobj(nullptr), handle(0) {} QByteArray methodSignature() const; QByteArray name() const; @@ -80,7 +80,7 @@ public: bool invoke(QObject *object, Qt::ConnectionType connectionType, QGenericReturnArgument returnValue, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -92,7 +92,7 @@ public: QGenericArgument val9 = QGenericArgument()) const; inline bool invoke(QObject *object, QGenericReturnArgument returnValue, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -108,7 +108,7 @@ public: } inline bool invoke(QObject *object, Qt::ConnectionType connectionType, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -123,7 +123,7 @@ public: val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); } inline bool invoke(QObject *object, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -140,7 +140,7 @@ public: bool invokeOnGadget(void *gadget, QGenericReturnArgument returnValue, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -151,7 +151,7 @@ public: QGenericArgument val8 = QGenericArgument(), QGenericArgument val9 = QGenericArgument()) const; inline bool invokeOnGadget(void *gadget, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -166,7 +166,7 @@ public: val0, val1, val2, val3, val4, val5, val6, val7, val8, val9); } - inline bool isValid() const { return mobj != Q_NULLPTR; } + inline bool isValid() const { return mobj != nullptr; } template static inline QMetaMethod fromSignal(PointerToMemberFunction signal) @@ -183,7 +183,7 @@ private: // signature() has been renamed to methodSignature() in Qt 5. // Warning, that function returns a QByteArray; check the life time if // you convert to char*. - char *signature(struct renamedInQt5_warning_checkTheLifeTime * = Q_NULLPTR) Q_DECL_EQ_DELETE; + char *signature(struct renamedInQt5_warning_checkTheLifeTime * = nullptr) Q_DECL_EQ_DELETE; #endif static QMetaMethod fromSignalImpl(const QMetaObject *, void **); @@ -206,7 +206,7 @@ inline bool operator!=(const QMetaMethod &m1, const QMetaMethod &m2) class Q_CORE_EXPORT QMetaEnum { public: - Q_DECL_CONSTEXPR inline QMetaEnum() : mobj(Q_NULLPTR), handle(0) {} + Q_DECL_CONSTEXPR inline QMetaEnum() : mobj(nullptr), handle(0) {} const char *name() const; bool isFlag() const; @@ -218,14 +218,14 @@ public: const char *scope() const; - int keyToValue(const char *key, bool *ok = Q_NULLPTR) const; + int keyToValue(const char *key, bool *ok = nullptr) const; const char* valueToKey(int value) const; - int keysToValue(const char * keys, bool *ok = Q_NULLPTR) const; + int keysToValue(const char * keys, bool *ok = nullptr) const; QByteArray valueToKeys(int value) const; inline const QMetaObject *enclosingMetaObject() const { return mobj; } - inline bool isValid() const { return name() != Q_NULLPTR; } + inline bool isValid() const { return name() != nullptr; } template static QMetaEnum fromType() { Q_STATIC_ASSERT_X(QtPrivate::IsQEnumHelper::Value, @@ -256,11 +256,11 @@ public: bool isReadable() const; bool isWritable() const; bool isResettable() const; - bool isDesignable(const QObject *obj = Q_NULLPTR) const; - bool isScriptable(const QObject *obj = Q_NULLPTR) const; - bool isStored(const QObject *obj = Q_NULLPTR) const; - bool isEditable(const QObject *obj = Q_NULLPTR) const; - bool isUser(const QObject *obj = Q_NULLPTR) const; + bool isDesignable(const QObject *obj = nullptr) const; + bool isScriptable(const QObject *obj = nullptr) const; + bool isStored(const QObject *obj = nullptr) const; + bool isEditable(const QObject *obj = nullptr) const; + bool isUser(const QObject *obj = nullptr) const; bool isConstant() const; bool isFinal() const; @@ -300,7 +300,7 @@ private: class Q_CORE_EXPORT QMetaClassInfo { public: - Q_DECL_CONSTEXPR inline QMetaClassInfo() : mobj(Q_NULLPTR), handle(0) {} + Q_DECL_CONSTEXPR inline QMetaClassInfo() : mobj(nullptr), handle(0) {} const char *name() const; const char *value() const; inline const QMetaObject *enclosingMetaObject() const { return mobj; } diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index f704c5b21a..47c3a1c6f6 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -234,7 +234,7 @@ struct AbstractDebugStreamFunction { typedef void (*Stream)(const AbstractDebugStreamFunction *, QDebug&, const void *); typedef void (*Destroy)(AbstractDebugStreamFunction *); - explicit AbstractDebugStreamFunction(Stream s = Q_NULLPTR, Destroy d = Q_NULLPTR) + explicit AbstractDebugStreamFunction(Stream s = nullptr, Destroy d = nullptr) : stream(s), destroy(d) {} Q_DISABLE_COPY(AbstractDebugStreamFunction) Stream stream; @@ -264,7 +264,7 @@ struct AbstractComparatorFunction typedef bool (*LessThan)(const AbstractComparatorFunction *, const void *, const void *); typedef bool (*Equals)(const AbstractComparatorFunction *, const void *, const void *); typedef void (*Destroy)(AbstractComparatorFunction *); - explicit AbstractComparatorFunction(LessThan lt = Q_NULLPTR, Equals e = Q_NULLPTR, Destroy d = Q_NULLPTR) + explicit AbstractComparatorFunction(LessThan lt = nullptr, Equals e = nullptr, Destroy d = nullptr) : lessThan(lt), equals(e), destroy(d) {} Q_DISABLE_COPY(AbstractComparatorFunction) LessThan lessThan; @@ -301,7 +301,7 @@ template struct BuiltInEqualsComparatorFunction : public AbstractComparatorFunction { BuiltInEqualsComparatorFunction() - : AbstractComparatorFunction(Q_NULLPTR, equals, destroy) {} + : AbstractComparatorFunction(nullptr, equals, destroy) {} static bool equals(const AbstractComparatorFunction *, const void *l, const void *r) { const T *lhs = static_cast(l); @@ -318,7 +318,7 @@ struct BuiltInEqualsComparatorFunction : public AbstractComparatorFunction struct AbstractConverterFunction { typedef bool (*Converter)(const AbstractConverterFunction *, const void *, void*); - explicit AbstractConverterFunction(Converter c = Q_NULLPTR) + explicit AbstractConverterFunction(Converter c = nullptr) : convert(c) {} Q_DISABLE_COPY(AbstractConverterFunction) Converter convert; @@ -513,9 +513,9 @@ public: static TypeFlags typeFlags(int type); static const QMetaObject *metaObjectForType(int type); static bool isRegistered(int type); - static void *create(int type, const void *copy = Q_NULLPTR); + static void *create(int type, const void *copy = nullptr); #if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED static void *construct(int type, const void *copy = Q_NULLPTR) + QT_DEPRECATED static void *construct(int type, const void *copy = nullptr) { return create(type, copy); } #endif static void destroy(int type, void *data); @@ -536,9 +536,9 @@ public: inline TypeFlags flags() const; inline const QMetaObject *metaObject() const; - inline void *create(const void *copy = Q_NULLPTR) const; + inline void *create(const void *copy = nullptr) const; inline void destroy(void *data) const; - inline void *construct(void *where, const void *copy = Q_NULLPTR) const; + inline void *construct(void *where, const void *copy = nullptr) const; inline void destruct(void *data) const; public: @@ -617,7 +617,7 @@ public: return registerConverterFunction(&f, fromTypeId, toTypeId); } - // member function as in "double QString::toDouble(bool *ok = Q_NULLPTR) const" + // member function as in "double QString::toDouble(bool *ok = nullptr) const" template static bool registerConverter(To(From::*function)(bool*) const) { @@ -680,9 +680,9 @@ private: uint sizeExtended() const; QMetaType::TypeFlags flagsExtended() const; const QMetaObject *metaObjectExtended() const; - void *createExtended(const void *copy = Q_NULLPTR) const; + void *createExtended(const void *copy = nullptr) const; void destroyExtended(void *data) const; - void *constructExtended(void *where, const void *copy = Q_NULLPTR) const; + void *constructExtended(void *where, const void *copy = nullptr) const; void destructExtended(void *data) const; static bool registerComparatorFunction(const QtPrivate::AbstractComparatorFunction *f, int type); @@ -782,7 +782,7 @@ struct QMetaTypeFunctionHelper { template struct QMetaTypeFunctionHelper { static void Destruct(void *) {} - static void *Construct(void *, const void *) { return Q_NULLPTR; } + static void *Construct(void *, const void *) { return nullptr; } #ifndef QT_NO_DATASTREAM static void Save(QDataStream &, const void *) {} static void Load(QDataStream &, void *) {} @@ -1020,7 +1020,7 @@ public: public: template QSequentialIterableImpl(const T*p) : _iterable(p) - , _iterator(Q_NULLPTR) + , _iterator(nullptr) , _metaType_id(qMetaTypeId()) , _metaType_flags(QTypeInfo::isPointer) , _iteratorCapabilities(ContainerAPI::IteratorCapabilities) @@ -1037,20 +1037,20 @@ public: } QSequentialIterableImpl() - : _iterable(Q_NULLPTR) - , _iterator(Q_NULLPTR) + : _iterable(nullptr) + , _iterator(nullptr) , _metaType_id(QMetaType::UnknownType) , _metaType_flags(0) , _iteratorCapabilities(0) - , _size(Q_NULLPTR) - , _at(Q_NULLPTR) - , _moveToBegin(Q_NULLPTR) - , _moveToEnd(Q_NULLPTR) - , _advance(Q_NULLPTR) - , _get(Q_NULLPTR) - , _destroyIter(Q_NULLPTR) - , _equalIter(Q_NULLPTR) - , _copyIter(Q_NULLPTR) + , _size(nullptr) + , _at(nullptr) + , _moveToBegin(nullptr) + , _moveToEnd(nullptr) + , _advance(nullptr) + , _get(nullptr) + , _destroyIter(nullptr) + , _equalIter(nullptr) + , _copyIter(nullptr) { } @@ -1189,7 +1189,7 @@ public: public: template QAssociativeIterableImpl(const T*p) : _iterable(p) - , _iterator(Q_NULLPTR) + , _iterator(nullptr) , _metaType_id_key(qMetaTypeId()) , _metaType_flags_key(QTypeInfo::isPointer) , _metaType_id_value(qMetaTypeId()) @@ -1208,22 +1208,22 @@ public: } QAssociativeIterableImpl() - : _iterable(Q_NULLPTR) - , _iterator(Q_NULLPTR) + : _iterable(nullptr) + , _iterator(nullptr) , _metaType_id_key(QMetaType::UnknownType) , _metaType_flags_key(0) , _metaType_id_value(QMetaType::UnknownType) , _metaType_flags_value(0) - , _size(Q_NULLPTR) - , _find(Q_NULLPTR) - , _begin(Q_NULLPTR) - , _end(Q_NULLPTR) - , _advance(Q_NULLPTR) - , _getKey(Q_NULLPTR) - , _getValue(Q_NULLPTR) - , _destroyIter(Q_NULLPTR) - , _equalIter(Q_NULLPTR) - , _copyIter(Q_NULLPTR) + , _size(nullptr) + , _find(nullptr) + , _begin(nullptr) + , _end(nullptr) + , _advance(nullptr) + , _getKey(nullptr) + , _getValue(nullptr) + , _destroyIter(nullptr) + , _equalIter(nullptr) + , _copyIter(nullptr) { } @@ -1292,13 +1292,13 @@ public: } QPairVariantInterfaceImpl() - : _pair(Q_NULLPTR) + : _pair(nullptr) , _metaType_id_first(QMetaType::UnknownType) , _metaType_flags_first(0) , _metaType_id_second(QMetaType::UnknownType) , _metaType_flags_second(0) - , _getFirst(Q_NULLPTR) - , _getSecond(Q_NULLPTR) + , _getFirst(nullptr) + , _getSecond(nullptr) { } @@ -1374,7 +1374,7 @@ namespace QtPrivate #endif static no_type checkType(...); Q_STATIC_ASSERT_X(sizeof(T), "Type argument of Q_DECLARE_METATYPE(T*) must be fully defined"); - enum { Value = sizeof(checkType(static_cast(Q_NULLPTR))) == sizeof(yes_type) }; + enum { Value = sizeof(checkType(static_cast(nullptr))) == sizeof(yes_type) }; }; template @@ -1419,12 +1419,12 @@ namespace QtPrivate template struct MetaObjectForType { - static inline const QMetaObject *value() { return Q_NULLPTR; } + static inline const QMetaObject *value() { return nullptr; } }; template<> struct MetaObjectForType { - static inline const QMetaObject *value() { return Q_NULLPTR; } + static inline const QMetaObject *value() { return nullptr; } }; template struct MetaObjectForType::Value>::type> @@ -1720,7 +1720,7 @@ int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normaliz template int qRegisterMetaType(const char *typeName #ifndef Q_QDOC - , T * dummy = Q_NULLPTR + , T * dummy = nullptr , typename QtPrivate::MetaTypeDefinedHelper::Defined && !QMetaTypeId2::IsBuiltIn>::DefinedType defined = QtPrivate::MetaTypeDefinedHelper::Defined && !QMetaTypeId2::IsBuiltIn>::Defined #endif ) @@ -1737,7 +1737,7 @@ int qRegisterMetaType(const char *typeName template void qRegisterMetaTypeStreamOperators(const char *typeName #ifndef Q_QDOC - , T * /* dummy */ = Q_NULLPTR + , T * /* dummy */ = nullptr #endif ) { @@ -2150,7 +2150,7 @@ inline QMetaType::QMetaType(const ExtensionFlag extensionFlags, const QMetaTypeI , m_loadOp(loadOp) , m_constructor(constructor) , m_destructor(destructor) - , m_extension(Q_NULLPTR) + , m_extension(nullptr) , m_size(size) , m_typeFlags(theTypeFlags) , m_extensionFlags(extensionFlags) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 3b0f7ead09..aa228af21a 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -998,7 +998,7 @@ QObject::~QObject() if (senderLists) senderLists->dirty = true; - QtPrivate::QSlotObjectBase *slotObj = Q_NULLPTR; + QtPrivate::QSlotObjectBase *slotObj = nullptr; if (node->isSlotObject) { slotObj = node->slotObj; node->isSlotObject = false; @@ -1468,14 +1468,14 @@ void QObject::moveToThread(QThread *targetThread) } QThreadData *currentData = QThreadData::current(); - QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : Q_NULLPTR; + QThreadData *targetData = targetThread ? QThreadData::get2(targetThread) : nullptr; if (d->threadData->thread == 0 && currentData == targetData) { // one exception to the rule: we allow moving objects with no thread affinity to the current thread currentData = d->threadData; } else if (d->threadData != currentData) { qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n" "Cannot move to target thread (%p)\n", - currentData->thread.load(), d->threadData->thread.load(), targetData ? targetData->thread.load() : Q_NULLPTR); + currentData->thread.load(), d->threadData->thread.load(), targetData ? targetData->thread.load() : nullptr); #ifdef Q_OS_MAC qWarning("You might be loading two sets of Qt binaries into the same process. " diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 2e66daa914..d297109acb 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -120,23 +120,23 @@ class Q_CORE_EXPORT QObject Q_DECLARE_PRIVATE(QObject) public: - Q_INVOKABLE explicit QObject(QObject *parent=Q_NULLPTR); + Q_INVOKABLE explicit QObject(QObject *parent=nullptr); virtual ~QObject(); virtual bool event(QEvent *event); virtual bool eventFilter(QObject *watched, QEvent *event); #ifdef Q_QDOC - static QString tr(const char *sourceText, const char *comment = Q_NULLPTR, int n = -1); - static QString trUtf8(const char *sourceText, const char *comment = Q_NULLPTR, int n = -1); + static QString tr(const char *sourceText, const char *comment = nullptr, int n = -1); + static QString trUtf8(const char *sourceText, const char *comment = nullptr, int n = -1); virtual const QMetaObject *metaObject() const; static const QMetaObject staticMetaObject; #endif #ifdef QT_NO_TRANSLATION - static QString tr(const char *sourceText, const char * = Q_NULLPTR, int = -1) + static QString tr(const char *sourceText, const char * = nullptr, int = -1) { return QString::fromUtf8(sourceText); } #if QT_DEPRECATED_SINCE(5, 0) - QT_DEPRECATED static QString trUtf8(const char *sourceText, const char * = Q_NULLPTR, int = -1) + QT_DEPRECATED static QString trUtf8(const char *sourceText, const char * = nullptr, int = -1) { return QString::fromUtf8(sourceText); } #endif #endif //QT_NO_TRANSLATION @@ -248,7 +248,7 @@ public: Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible::value), "Return type of the slot is not compatible with the return type of the signal."); - const int *types = Q_NULLPTR; + const int *types = nullptr; if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection) types = QtPrivate::ConnectionTypes::types(); @@ -288,11 +288,11 @@ public: Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible::value), "Return type of the slot is not compatible with the return type of the signal."); - const int *types = Q_NULLPTR; + const int *types = nullptr; if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection) types = QtPrivate::ConnectionTypes::types(); - return connectImpl(sender, reinterpret_cast(&signal), context, Q_NULLPTR, + return connectImpl(sender, reinterpret_cast(&signal), context, nullptr, new QtPrivate::QStaticSlotObject::Value, typename SignalType::ReturnType>(slot), @@ -327,11 +327,11 @@ public: Q_STATIC_ASSERT_X(QtPrivate::HasQ_OBJECT_Macro::Value, "No Q_OBJECT in the class with the signal"); - const int *types = Q_NULLPTR; + const int *types = nullptr; if (type == Qt::QueuedConnection || type == Qt::BlockingQueuedConnection) types = QtPrivate::ConnectionTypes::types(); - return connectImpl(sender, reinterpret_cast(&signal), context, Q_NULLPTR, + return connectImpl(sender, reinterpret_cast(&signal), context, nullptr, new QtPrivate::QFunctorSlotObject::Value, typename SignalType::ReturnType>(std::move(slot)), @@ -343,11 +343,11 @@ public: const QObject *receiver, const char *member); static bool disconnect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member); - inline bool disconnect(const char *signal = Q_NULLPTR, - const QObject *receiver = Q_NULLPTR, const char *member = Q_NULLPTR) const + inline bool disconnect(const char *signal = nullptr, + const QObject *receiver = nullptr, const char *member = nullptr) const { return disconnect(this, signal, receiver, member); } - inline bool disconnect(const QObject *receiver, const char *member = Q_NULLPTR) const - { return disconnect(this, Q_NULLPTR, receiver, member); } + inline bool disconnect(const QObject *receiver, const char *member = nullptr) const + { return disconnect(this, nullptr, receiver, member); } static bool disconnect(const QMetaObject::Connection &); #ifdef Q_QDOC @@ -375,7 +375,7 @@ public: static inline bool disconnect(const typename QtPrivate::FunctionPointer::Object *sender, Func1 signal, const QObject *receiver, void **zero) { - // This is the overload for when one wish to disconnect a signal from any slot. (slot=Q_NULLPTR) + // This is the overload for when one wish to disconnect a signal from any slot. (slot=nullptr) // Since the function template parameter cannot be deduced from '0', we use a // dummy void ** parameter that must be equal to 0 Q_ASSERT(!zero); @@ -406,14 +406,14 @@ public: #endif // QT_NO_USERDATA Q_SIGNALS: - void destroyed(QObject * = Q_NULLPTR); + void destroyed(QObject * = nullptr); void objectNameChanged(const QString &objectName, QPrivateSignal); public: inline QObject *parent() const { return d_ptr->parent; } inline bool inherits(const char *classname) const - { return const_cast(this)->qt_metacast(classname) != Q_NULLPTR; } + { return const_cast(this)->qt_metacast(classname) != nullptr; } public Q_SLOTS: void deleteLater(); @@ -432,7 +432,7 @@ protected: virtual void disconnectNotify(const QMetaMethod &signal); protected: - QObject(QObjectPrivate &dd, QObject *parent = Q_NULLPTR); + QObject(QObjectPrivate &dd, QObject *parent = nullptr); protected: QScopedPointer d_ptr; @@ -525,16 +525,16 @@ inline T qobject_cast(const QObject *object) template inline const char * qobject_interface_iid() -{ return Q_NULLPTR; } +{ return nullptr; } #ifndef Q_MOC_RUN # define Q_DECLARE_INTERFACE(IFace, IId) \ template <> inline const char *qobject_interface_iid() \ { return IId; } \ template <> inline IFace *qobject_cast(QObject *object) \ - { return reinterpret_cast((object ? object->qt_metacast(IId) : Q_NULLPTR)); } \ + { return reinterpret_cast((object ? object->qt_metacast(IId) : nullptr)); } \ template <> inline IFace *qobject_cast(const QObject *object) \ - { return reinterpret_cast((object ? const_cast(object)->qt_metacast(IId) : Q_NULLPTR)); } + { return reinterpret_cast((object ? const_cast(object)->qt_metacast(IId) : nullptr)); } #endif // Q_MOC_RUN #ifndef QT_NO_DEBUG_STREAM @@ -580,7 +580,7 @@ QSignalBlocker::QSignalBlocker(QSignalBlocker &&other) Q_DECL_NOTHROW m_blocked(other.m_blocked), m_inhibited(other.m_inhibited) { - other.m_o = Q_NULLPTR; + other.m_o = nullptr; } QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) Q_DECL_NOTHROW @@ -594,7 +594,7 @@ QSignalBlocker &QSignalBlocker::operator=(QSignalBlocker &&other) Q_DECL_NOTHROW m_blocked = other.m_blocked; m_inhibited = other.m_inhibited; // disable other: - other.m_o = Q_NULLPTR; + other.m_o = nullptr; } return *this; } diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h index c775d807b1..1a14b93dcd 100644 --- a/src/corelib/kernel/qobject_impl.h +++ b/src/corelib/kernel/qobject_impl.h @@ -68,9 +68,9 @@ namespace QtPrivate { { enum { Value = QMetaTypeId2::Defined && TypesAreDeclaredMetaType>::Value }; }; template ::Value > struct ConnectionTypes - { static const int *types() { return Q_NULLPTR; } }; + { static const int *types() { return nullptr; } }; template <> struct ConnectionTypes, true> - { static const int *types() { return Q_NULLPTR; } }; + { static const int *types() { return nullptr; } }; template struct ConnectionTypes, true> { static const int *types() { static const int t[sizeof...(Args) + 1] = { (QtPrivate::QMetaTypeIdHelper::qt_metatype_id())..., 0 }; return t; } }; diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index 5fc8937f23..6cd0e82a86 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -137,9 +137,9 @@ class QString; #ifndef QT_NO_TRANSLATION // full set of tr functions # define QT_TR_FUNCTIONS \ - static inline QString tr(const char *s, const char *c = Q_NULLPTR, int n = -1) \ + static inline QString tr(const char *s, const char *c = nullptr, int n = -1) \ { return staticMetaObject.tr(s, c, n); } \ - QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = Q_NULLPTR, int n = -1) \ + QT_DEPRECATED static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) \ { return staticMetaObject.tr(s, c, n); } #else // inherit the ones from QObject @@ -294,7 +294,7 @@ class QMetaClassInfo; class Q_CORE_EXPORT QGenericArgument { public: - inline QGenericArgument(const char *aName = Q_NULLPTR, const void *aData = Q_NULLPTR) + inline QGenericArgument(const char *aName = nullptr, const void *aData = nullptr) : _data(aData), _name(aName) {} inline void *data() const { return const_cast(_data); } inline const char *name() const { return _name; } @@ -307,7 +307,7 @@ private: class Q_CORE_EXPORT QGenericReturnArgument: public QGenericArgument { public: - inline QGenericReturnArgument(const char *aName = Q_NULLPTR, void *aData = Q_NULLPTR) + inline QGenericReturnArgument(const char *aName = nullptr, void *aData = nullptr) : QGenericArgument(aName, aData) {} }; @@ -388,7 +388,7 @@ struct Q_CORE_EXPORT QMetaObject // internal index-based connect static Connection connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index, - int type = 0, int *types = Q_NULLPTR); + int type = 0, int *types = nullptr); // internal index-based disconnect static bool disconnect(const QObject *sender, int signal_index, const QObject *receiver, int method_index); @@ -405,7 +405,7 @@ struct Q_CORE_EXPORT QMetaObject static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -418,7 +418,7 @@ struct Q_CORE_EXPORT QMetaObject static inline bool invokeMethod(QObject *obj, const char *member, QGenericReturnArgument ret, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -435,7 +435,7 @@ struct Q_CORE_EXPORT QMetaObject static inline bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -451,7 +451,7 @@ struct Q_CORE_EXPORT QMetaObject } static inline bool invokeMethod(QObject *obj, const char *member, - QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -551,7 +551,7 @@ struct Q_CORE_EXPORT QMetaObject #endif - QObject *newInstance(QGenericArgument val0 = QGenericArgument(Q_NULLPTR), + QObject *newInstance(QGenericArgument val0 = QGenericArgument(nullptr), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument(), @@ -611,11 +611,11 @@ public: operator bool() const; #else typedef void *Connection::*RestrictedBool; - operator RestrictedBool() const { return d_ptr && isConnected_helper() ? &Connection::d_ptr : Q_NULLPTR; } + operator RestrictedBool() const { return d_ptr && isConnected_helper() ? &Connection::d_ptr : nullptr; } #endif #ifdef Q_COMPILER_RVALUE_REFS - inline Connection(Connection &&o) : d_ptr(o.d_ptr) { o.d_ptr = Q_NULLPTR; } + inline Connection(Connection &&o) : d_ptr(o.d_ptr) { o.d_ptr = nullptr; } inline Connection &operator=(Connection &&other) { qSwap(d_ptr, other.d_ptr); return *this; } #endif diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index b9f2e47e32..17872d830e 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -372,10 +372,10 @@ namespace QtPrivate { inline int ref() Q_DECL_NOTHROW { return m_ref.ref(); } inline void destroyIfLastRef() Q_DECL_NOTHROW - { if (!m_ref.deref()) m_impl(Destroy, this, Q_NULLPTR, Q_NULLPTR, Q_NULLPTR); } + { if (!m_ref.deref()) m_impl(Destroy, this, nullptr, nullptr, nullptr); } - inline bool compare(void **a) { bool ret = false; m_impl(Compare, this, Q_NULLPTR, a, &ret); return ret; } - inline void call(QObject *r, void **a) { m_impl(Call, this, r, a, Q_NULLPTR); } + inline bool compare(void **a) { bool ret = false; m_impl(Compare, this, nullptr, a, &ret); return ret; } + inline void call(QObject *r, void **a) { m_impl(Call, this, r, a, nullptr); } protected: ~QSlotObjectBase() {} private: diff --git a/src/corelib/kernel/qsharedmemory.h b/src/corelib/kernel/qsharedmemory.h index 0d4edef23d..67cf52ac17 100644 --- a/src/corelib/kernel/qsharedmemory.h +++ b/src/corelib/kernel/qsharedmemory.h @@ -74,8 +74,8 @@ public: UnknownError }; - QSharedMemory(QObject *parent = Q_NULLPTR); - QSharedMemory(const QString &key, QObject *parent = Q_NULLPTR); + QSharedMemory(QObject *parent = nullptr); + QSharedMemory(const QString &key, QObject *parent = nullptr); ~QSharedMemory(); void setKey(const QString &key); diff --git a/src/corelib/kernel/qsocketnotifier.h b/src/corelib/kernel/qsocketnotifier.h index 360e93a5fb..38e5f27247 100644 --- a/src/corelib/kernel/qsocketnotifier.h +++ b/src/corelib/kernel/qsocketnotifier.h @@ -53,7 +53,7 @@ class Q_CORE_EXPORT QSocketNotifier : public QObject public: enum Type { Read, Write, Exception }; - QSocketNotifier(qintptr socket, Type, QObject *parent = Q_NULLPTR); + QSocketNotifier(qintptr socket, Type, QObject *parent = nullptr); ~QSocketNotifier(); qintptr socket() const; diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index 6790841f8e..1a65e6298d 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -63,7 +63,7 @@ class Q_CORE_EXPORT QTimer : public QObject Q_PROPERTY(Qt::TimerType timerType READ timerType WRITE setTimerType) Q_PROPERTY(bool active READ isActive) public: - explicit QTimer(QObject *parent = Q_NULLPTR); + explicit QTimer(QObject *parent = nullptr); ~QTimer(); inline bool isActive() const { return id >= 0; } diff --git a/src/corelib/kernel/qtranslator.h b/src/corelib/kernel/qtranslator.h index 97be16bc90..e7c39191e7 100644 --- a/src/corelib/kernel/qtranslator.h +++ b/src/corelib/kernel/qtranslator.h @@ -55,11 +55,11 @@ class Q_CORE_EXPORT QTranslator : public QObject { Q_OBJECT public: - explicit QTranslator(QObject *parent = Q_NULLPTR); + explicit QTranslator(QObject *parent = nullptr); ~QTranslator(); virtual QString translate(const char *context, const char *sourceText, - const char *disambiguation = Q_NULLPTR, int n = -1) const; + const char *disambiguation = nullptr, int n = -1) const; virtual bool isEmpty() const; diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index a2c5711993..6d4c163e76 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -284,14 +284,14 @@ class Q_CORE_EXPORT QVariant void detach(); inline bool isDetached() const; - int toInt(bool *ok = Q_NULLPTR) const; - uint toUInt(bool *ok = Q_NULLPTR) const; - qlonglong toLongLong(bool *ok = Q_NULLPTR) const; - qulonglong toULongLong(bool *ok = Q_NULLPTR) const; + int toInt(bool *ok = nullptr) const; + uint toUInt(bool *ok = nullptr) const; + qlonglong toLongLong(bool *ok = nullptr) const; + qulonglong toULongLong(bool *ok = nullptr) const; bool toBool() const; - double toDouble(bool *ok = Q_NULLPTR) const; - float toFloat(bool *ok = Q_NULLPTR) const; - qreal toReal(bool *ok = Q_NULLPTR) const; + double toDouble(bool *ok = nullptr) const; + float toFloat(bool *ok = nullptr) const; + qreal toReal(bool *ok = nullptr) const; QByteArray toByteArray() const; QBitArray toBitArray() const; QString toString() const; @@ -370,7 +370,7 @@ class Q_CORE_EXPORT QVariant struct Private { inline Private() Q_DECL_NOTHROW : type(Invalid), is_shared(false), is_null(true) - { data.ptr = Q_NULLPTR; } + { data.ptr = nullptr; } // Internal constructor for initialized variants. explicit inline Private(uint variantType) Q_DECL_NOTHROW diff --git a/src/corelib/kernel/qwineventnotifier.h b/src/corelib/kernel/qwineventnotifier.h index f29f325d13..624e77e638 100644 --- a/src/corelib/kernel/qwineventnotifier.h +++ b/src/corelib/kernel/qwineventnotifier.h @@ -54,8 +54,8 @@ class Q_CORE_EXPORT QWinEventNotifier : public QObject typedef Qt::HANDLE HANDLE; public: - explicit QWinEventNotifier(QObject *parent = Q_NULLPTR); - explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = Q_NULLPTR); + explicit QWinEventNotifier(QObject *parent = nullptr); + explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = nullptr); ~QWinEventNotifier(); void setHandle(HANDLE hEvent); diff --git a/src/corelib/mimetypes/qmimemagicrule_p.h b/src/corelib/mimetypes/qmimemagicrule_p.h index 0c6c1dbcd7..9b27ef2657 100644 --- a/src/corelib/mimetypes/qmimemagicrule_p.h +++ b/src/corelib/mimetypes/qmimemagicrule_p.h @@ -90,7 +90,7 @@ public: int endPos() const { return m_endPos; } QByteArray mask() const; - bool isValid() const { return m_matchFunction != Q_NULLPTR; } + bool isValid() const { return m_matchFunction != nullptr; } bool matches(const QByteArray &data) const; diff --git a/src/corelib/plugin/qlibrary.h b/src/corelib/plugin/qlibrary.h index 89be52aac3..0b37b8b134 100644 --- a/src/corelib/plugin/qlibrary.h +++ b/src/corelib/plugin/qlibrary.h @@ -65,10 +65,10 @@ public: Q_FLAG(LoadHint) Q_FLAG(LoadHints) - explicit QLibrary(QObject *parent = Q_NULLPTR); - explicit QLibrary(const QString& fileName, QObject *parent = Q_NULLPTR); - explicit QLibrary(const QString& fileName, int verNum, QObject *parent = Q_NULLPTR); - explicit QLibrary(const QString& fileName, const QString &version, QObject *parent = Q_NULLPTR); + explicit QLibrary(QObject *parent = nullptr); + explicit QLibrary(const QString& fileName, QObject *parent = nullptr); + explicit QLibrary(const QString& fileName, int verNum, QObject *parent = nullptr); + explicit QLibrary(const QString& fileName, const QString &version, QObject *parent = nullptr); ~QLibrary(); QFunctionPointer resolve(const char *symbol); diff --git a/src/corelib/plugin/qpluginloader.h b/src/corelib/plugin/qpluginloader.h index 80b10f76bf..5e417249a4 100644 --- a/src/corelib/plugin/qpluginloader.h +++ b/src/corelib/plugin/qpluginloader.h @@ -59,8 +59,8 @@ class Q_CORE_EXPORT QPluginLoader : public QObject Q_PROPERTY(QString fileName READ fileName WRITE setFileName) Q_PROPERTY(QLibrary::LoadHints loadHints READ loadHints WRITE setLoadHints) public: - explicit QPluginLoader(QObject *parent = Q_NULLPTR); - explicit QPluginLoader(const QString &fileName, QObject *parent = Q_NULLPTR); + explicit QPluginLoader(QObject *parent = nullptr); + explicit QPluginLoader(const QString &fileName, QObject *parent = nullptr); ~QPluginLoader(); QObject *instance(); diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h index fa735ea33d..ffc2eaae13 100644 --- a/src/corelib/statemachine/qabstractstate.h +++ b/src/corelib/statemachine/qabstractstate.h @@ -68,7 +68,7 @@ Q_SIGNALS: void activeChanged(bool active); protected: - QAbstractState(QState *parent = Q_NULLPTR); + QAbstractState(QState *parent = nullptr); virtual void onEntry(QEvent *event) = 0; virtual void onExit(QEvent *event) = 0; diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index 53c713d6a8..272e681fb4 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -258,7 +258,7 @@ void QAbstractTransition::setTargetStates(const QList &targets) // Verify if any of the new target states is a null-pointer: for (int i = 0; i < targets.size(); ++i) { - if (targets.at(i) == Q_NULLPTR) { + if (targets.at(i) == nullptr) { qWarning("QAbstractTransition::setTargetStates: target state(s) cannot be null"); return; } diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h index ec81b8ec2e..9b35e0cdb6 100644 --- a/src/corelib/statemachine/qabstracttransition.h +++ b/src/corelib/statemachine/qabstracttransition.h @@ -72,7 +72,7 @@ public: }; Q_ENUM(TransitionType) - QAbstractTransition(QState *sourceState = Q_NULLPTR); + QAbstractTransition(QState *sourceState = nullptr); virtual ~QAbstractTransition(); QState *sourceState() const; diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h index 53f3b4cd36..ff4a991162 100644 --- a/src/corelib/statemachine/qeventtransition.h +++ b/src/corelib/statemachine/qeventtransition.h @@ -54,8 +54,8 @@ class Q_CORE_EXPORT QEventTransition : public QAbstractTransition Q_PROPERTY(QObject* eventSource READ eventSource WRITE setEventSource) Q_PROPERTY(QEvent::Type eventType READ eventType WRITE setEventType) public: - QEventTransition(QState *sourceState = Q_NULLPTR); - QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = Q_NULLPTR); + QEventTransition(QState *sourceState = nullptr); + QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = nullptr); ~QEventTransition(); QObject *eventSource() const; diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h index 3e7a844653..1e52a0411d 100644 --- a/src/corelib/statemachine/qfinalstate.h +++ b/src/corelib/statemachine/qfinalstate.h @@ -51,7 +51,7 @@ class Q_CORE_EXPORT QFinalState : public QAbstractState { Q_OBJECT public: - QFinalState(QState *parent = Q_NULLPTR); + QFinalState(QState *parent = nullptr); ~QFinalState(); protected: diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp index a179d7c75b..d4fb214a31 100644 --- a/src/corelib/statemachine/qhistorystate.cpp +++ b/src/corelib/statemachine/qhistorystate.cpp @@ -203,7 +203,7 @@ void QHistoryState::setDefaultTransition(QAbstractTransition *transition) QAbstractState *QHistoryState::defaultState() const { Q_D(const QHistoryState); - return d->defaultTransition ? d->defaultTransition->targetState() : Q_NULLPTR; + return d->defaultTransition ? d->defaultTransition->targetState() : nullptr; } static inline bool isSoleEntry(const QList &states, const QAbstractState * state) diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h index e531a2d9fb..44f4c5d6d4 100644 --- a/src/corelib/statemachine/qhistorystate.h +++ b/src/corelib/statemachine/qhistorystate.h @@ -61,8 +61,8 @@ public: }; Q_ENUM(HistoryType) - QHistoryState(QState *parent = Q_NULLPTR); - QHistoryState(HistoryType type, QState *parent = Q_NULLPTR); + QHistoryState(QState *parent = nullptr); + QHistoryState(HistoryType type, QState *parent = nullptr); ~QHistoryState(); QAbstractTransition *defaultTransition() const; diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h index e64d09384a..e785a18c73 100644 --- a/src/corelib/statemachine/qsignaltransition.h +++ b/src/corelib/statemachine/qsignaltransition.h @@ -55,17 +55,17 @@ class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition Q_PROPERTY(QByteArray signal READ signal WRITE setSignal NOTIFY signalChanged) public: - QSignalTransition(QState *sourceState = Q_NULLPTR); + QSignalTransition(QState *sourceState = nullptr); QSignalTransition(const QObject *sender, const char *signal, - QState *sourceState = Q_NULLPTR); + QState *sourceState = nullptr); #ifdef Q_QDOC template QSignalTransition(const QObject *object, PointerToMemberFunction signal, - QState *sourceState = Q_NULLPTR); + QState *sourceState = nullptr); #elif defined(Q_COMPILER_DELEGATING_CONSTRUCTORS) template QSignalTransition(const typename QtPrivate::FunctionPointer::Object *obj, - Func sig, QState *srcState = Q_NULLPTR) + Func sig, QState *srcState = nullptr) : QSignalTransition(obj, QMetaMethod::fromSignal(sig).methodSignature().constData(), srcState) { } diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index ada20cd6a5..6efa4897d6 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -524,7 +524,7 @@ void QState::setChildMode(ChildMode mode) if (mode == QState::ParallelStates && d->initialState) { qWarning("QState::setChildMode: setting the child-mode of state %p to " "parallel removes the initial state", this); - d->initialState = Q_NULLPTR; + d->initialState = nullptr; emit initialStateChanged(QState::QPrivateSignal()); } diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h index 1b39d37f3d..9f1f07dfcc 100644 --- a/src/corelib/statemachine/qstate.h +++ b/src/corelib/statemachine/qstate.h @@ -71,8 +71,8 @@ public: }; Q_ENUM(RestorePolicy) - QState(QState *parent = Q_NULLPTR); - QState(ChildMode childMode, QState *parent = Q_NULLPTR); + QState(QState *parent = nullptr); + QState(ChildMode childMode, QState *parent = nullptr); ~QState(); QAbstractState *errorState() const; diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index b6f0420db0..eb425bcd4f 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -560,7 +560,7 @@ QList QStateMachinePrivate::selectTransitions(QEvent *even QList enabledTransitions; const_cast(q)->beginSelectTransitions(event); for (QAbstractState *state : qAsConst(configuration_sorted)) { - QVector lst = getProperAncestors(state, Q_NULLPTR); + QVector lst = getProperAncestors(state, nullptr); if (QState *grp = toStandardState(state)) lst.prepend(grp); bool found = false; @@ -767,7 +767,7 @@ QSet QStateMachinePrivate::computeExitSet_Unordered(QAbstractTr QList effectiveTargetStates = getEffectiveTargetStates(t, cache); QAbstractState *domain = getTransitionDomain(t, effectiveTargetStates, cache); - if (domain == Q_NULLPTR && !t->targetStates().isEmpty()) { + if (domain == nullptr && !t->targetStates().isEmpty()) { // So we didn't find the least common ancestor for the source and target states of the // transition. If there were not target states, that would be fine: then the transition // will fire any events or signals, but not exit the state. @@ -909,7 +909,7 @@ QAbstractState *QStateMachinePrivate::getTransitionDomain(QAbstractTransition *t if (effectiveTargetStates.isEmpty()) return 0; - QAbstractState *domain = Q_NULLPTR; + QAbstractState *domain = nullptr; if (cache->transitionDomain(t, &domain)) return domain; diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h index 7268d0f233..fd90b86fd5 100644 --- a/src/corelib/statemachine/qstatemachine.h +++ b/src/corelib/statemachine/qstatemachine.h @@ -109,8 +109,8 @@ public: NoCommonAncestorForTransitionError }; - explicit QStateMachine(QObject *parent = Q_NULLPTR); - explicit QStateMachine(QState::ChildMode childMode, QObject *parent = Q_NULLPTR); + explicit QStateMachine(QObject *parent = nullptr); + explicit QStateMachine(QState::ChildMode childMode, QObject *parent = nullptr); ~QStateMachine(); void addState(QAbstractState *state); diff --git a/src/corelib/thread/qexception.cpp b/src/corelib/thread/qexception.cpp index 62c2b608d8..e00181e64b 100644 --- a/src/corelib/thread/qexception.cpp +++ b/src/corelib/thread/qexception.cpp @@ -171,7 +171,7 @@ public: }; ExceptionHolder::ExceptionHolder(QException *exception) -: base(exception ? new Base(exception) : Q_NULLPTR) {} +: base(exception ? new Base(exception) : nullptr) {} ExceptionHolder::ExceptionHolder(const ExceptionHolder &other) : base(other.base) @@ -188,7 +188,7 @@ ExceptionHolder::~ExceptionHolder() QException *ExceptionHolder::exception() const { if (!base) - return Q_NULLPTR; + return nullptr; return base->exception; } diff --git a/src/corelib/thread/qexception.h b/src/corelib/thread/qexception.h index 8bbe597f90..5c43cedffd 100644 --- a/src/corelib/thread/qexception.h +++ b/src/corelib/thread/qexception.h @@ -90,7 +90,7 @@ class Base; class Q_CORE_EXPORT ExceptionHolder { public: - ExceptionHolder(QException *exception = Q_NULLPTR); + ExceptionHolder(QException *exception = nullptr); ExceptionHolder(const ExceptionHolder &other); void operator=(const ExceptionHolder &other); // ### Qt6: copy-assign operator shouldn't return void. Remove this method and the copy-ctor, they are unneeded. ~ExceptionHolder(); diff --git a/src/corelib/thread/qfutureinterface.h b/src/corelib/thread/qfutureinterface.h index 7b12f51e3e..320c2d7b33 100644 --- a/src/corelib/thread/qfutureinterface.h +++ b/src/corelib/thread/qfutureinterface.h @@ -291,7 +291,7 @@ public: void reportResult(const void *, int) { } void reportResults(const QVector &, int) { } - void reportFinished(const void * = Q_NULLPTR) { QFutureInterfaceBase::reportFinished(); } + void reportFinished(const void * = nullptr) { QFutureInterfaceBase::reportFinished(); } }; QT_END_NAMESPACE diff --git a/src/corelib/thread/qfuturewatcher.h b/src/corelib/thread/qfuturewatcher.h index 531babb82a..5143db8d2e 100644 --- a/src/corelib/thread/qfuturewatcher.h +++ b/src/corelib/thread/qfuturewatcher.h @@ -58,7 +58,7 @@ class Q_CORE_EXPORT QFutureWatcherBase : public QObject Q_DECLARE_PRIVATE(QFutureWatcherBase) public: - explicit QFutureWatcherBase(QObject *parent = Q_NULLPTR); + explicit QFutureWatcherBase(QObject *parent = nullptr); // de-inline dtor int progressValue() const; @@ -185,7 +185,7 @@ template <> class QFutureWatcher : public QFutureWatcherBase { public: - explicit QFutureWatcher(QObject *_parent = Q_NULLPTR) + explicit QFutureWatcher(QObject *_parent = nullptr) : QFutureWatcherBase(_parent) { } ~QFutureWatcher() diff --git a/src/corelib/thread/qmutex.h b/src/corelib/thread/qmutex.h index 12987f16c3..f40dd3c814 100644 --- a/src/corelib/thread/qmutex.h +++ b/src/corelib/thread/qmutex.h @@ -92,16 +92,16 @@ public: private: inline bool fastTryLock() Q_DECL_NOTHROW { - return d_ptr.testAndSetAcquire(Q_NULLPTR, dummyLocked()); + return d_ptr.testAndSetAcquire(nullptr, dummyLocked()); } inline bool fastTryUnlock() Q_DECL_NOTHROW { - return d_ptr.testAndSetRelease(dummyLocked(), Q_NULLPTR); + return d_ptr.testAndSetRelease(dummyLocked(), nullptr); } inline bool fastTryLock(QMutexData *¤t) Q_DECL_NOTHROW { - return d_ptr.testAndSetAcquire(Q_NULLPTR, dummyLocked(), current); + return d_ptr.testAndSetAcquire(nullptr, dummyLocked(), current); } inline bool fastTryUnlock(QMutexData *¤t) Q_DECL_NOTHROW { - return d_ptr.testAndSetRelease(dummyLocked(), Q_NULLPTR, current); + return d_ptr.testAndSetRelease(dummyLocked(), nullptr, current); } void lockInternal() QT_MUTEX_LOCK_NOEXCEPT; @@ -287,7 +287,7 @@ public: inline void unlock() Q_DECL_NOTHROW {} void relock() Q_DECL_NOTHROW {} - inline QMutex *mutex() const Q_DECL_NOTHROW { return Q_NULLPTR; } + inline QMutex *mutex() const Q_DECL_NOTHROW { return nullptr; } private: Q_DISABLE_COPY(QMutexLocker) diff --git a/src/corelib/thread/qreadwritelock.h b/src/corelib/thread/qreadwritelock.h index 777efdb3bf..ecdb98f2f5 100644 --- a/src/corelib/thread/qreadwritelock.h +++ b/src/corelib/thread/qreadwritelock.h @@ -205,7 +205,7 @@ public: static inline void unlock() Q_DECL_NOTHROW { } static inline void relock() Q_DECL_NOTHROW { } - static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return Q_NULLPTR; } + static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return nullptr; } private: Q_DISABLE_COPY(QReadLocker) @@ -219,7 +219,7 @@ public: static inline void unlock() Q_DECL_NOTHROW { } static inline void relock() Q_DECL_NOTHROW { } - static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return Q_NULLPTR; } + static inline QReadWriteLock *readWriteLock() Q_DECL_NOTHROW { return nullptr; } private: Q_DISABLE_COPY(QWriteLocker) diff --git a/src/corelib/thread/qresultstore.h b/src/corelib/thread/qresultstore.h index 6c814ef854..5f0cefa133 100644 --- a/src/corelib/thread/qresultstore.h +++ b/src/corelib/thread/qresultstore.h @@ -67,8 +67,8 @@ class ResultItem public: ResultItem(const void *_result, int _count) : m_count(_count), result(_result) { } // contruct with vector of results ResultItem(const void *_result) : m_count(0), result(_result) { } // construct with result - ResultItem() : m_count(0), result(Q_NULLPTR) { } - bool isValid() const { return result != Q_NULLPTR; } + ResultItem() : m_count(0), result(nullptr) { } + bool isValid() const { return result != nullptr; } bool isVector() const { return m_count != 0; } int count() const { return (m_count == 0) ? 1 : m_count; } int m_count; // result is either a pointer to a result or to a vector of results, diff --git a/src/corelib/thread/qthread.h b/src/corelib/thread/qthread.h index 21e7cc74f9..b1d02a2b75 100644 --- a/src/corelib/thread/qthread.h +++ b/src/corelib/thread/qthread.h @@ -82,7 +82,7 @@ public: static int idealThreadCount() Q_DECL_NOTHROW; static void yieldCurrentThread(); - explicit QThread(QObject *parent = Q_NULLPTR); + explicit QThread(QObject *parent = nullptr); ~QThread(); enum Priority { @@ -153,7 +153,7 @@ protected: static void setTerminationEnabled(bool enabled = true); protected: - QThread(QThreadPrivate &dd, QObject *parent = Q_NULLPTR); + QThread(QThreadPrivate &dd, QObject *parent = nullptr); private: Q_DECLARE_PRIVATE(QThread) diff --git a/src/corelib/thread/qthreadpool.h b/src/corelib/thread/qthreadpool.h index a65eacc996..606e192768 100644 --- a/src/corelib/thread/qthreadpool.h +++ b/src/corelib/thread/qthreadpool.h @@ -62,7 +62,7 @@ class Q_CORE_EXPORT QThreadPool : public QObject friend class QFutureInterfaceBase; public: - QThreadPool(QObject *parent = Q_NULLPTR); + QThreadPool(QObject *parent = nullptr); ~QThreadPool(); static QThreadPool *globalInstance(); diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h index 88f0cfb0ea..f0cc56e899 100644 --- a/src/corelib/tools/qarraydata.h +++ b/src/corelib/tools/qarraydata.h @@ -139,7 +139,7 @@ struct QTypedArrayData typedef T *pointer; typedef T &reference; - inline iterator() : i(Q_NULLPTR) {} + inline iterator() : i(nullptr) {} inline iterator(T *n) : i(n) {} inline iterator(const iterator &o): i(o.i){} // #### Qt 6: remove, the implicit version is fine inline T &operator*() const { return *i; } @@ -173,7 +173,7 @@ struct QTypedArrayData typedef const T *pointer; typedef const T &reference; - inline const_iterator() : i(Q_NULLPTR) {} + inline const_iterator() : i(nullptr) {} inline const_iterator(const T *n) : i(n) {} inline const_iterator(const const_iterator &o): i(o.i) {} // #### Qt 6: remove, the default version is fine inline explicit const_iterator(const iterator &o): i(o.i) {} diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index 9a600ca366..38c1820685 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -340,16 +340,16 @@ public: inline QT_ASCII_CAST_WARN bool operator>=(const QString &s2) const; #endif - short toShort(bool *ok = Q_NULLPTR, int base = 10) const; - ushort toUShort(bool *ok = Q_NULLPTR, int base = 10) const; - int toInt(bool *ok = Q_NULLPTR, int base = 10) const; - uint toUInt(bool *ok = Q_NULLPTR, int base = 10) const; - long toLong(bool *ok = Q_NULLPTR, int base = 10) const; - ulong toULong(bool *ok = Q_NULLPTR, int base = 10) const; - qlonglong toLongLong(bool *ok = Q_NULLPTR, int base = 10) const; - qulonglong toULongLong(bool *ok = Q_NULLPTR, int base = 10) const; - float toFloat(bool *ok = Q_NULLPTR) const; - double toDouble(bool *ok = Q_NULLPTR) const; + short toShort(bool *ok = nullptr, int base = 10) const; + ushort toUShort(bool *ok = nullptr, int base = 10) const; + int toInt(bool *ok = nullptr, int base = 10) const; + uint toUInt(bool *ok = nullptr, int base = 10) const; + long toLong(bool *ok = nullptr, int base = 10) const; + ulong toULong(bool *ok = nullptr, int base = 10) const; + qlonglong toLongLong(bool *ok = nullptr, int base = 10) const; + qulonglong toULongLong(bool *ok = nullptr, int base = 10) const; + float toFloat(bool *ok = nullptr) const; + double toDouble(bool *ok = nullptr) const; QByteArray toBase64(Base64Options options) const; QByteArray toBase64() const; // ### Qt6 merge with previous QByteArray toHex() const; diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h index 501bb2e0d5..ed014dd157 100644 --- a/src/corelib/tools/qbytearraylist.h +++ b/src/corelib/tools/qbytearraylist.h @@ -70,7 +70,7 @@ protected: #endif public: inline QByteArray join() const - { return QtPrivate::QByteArrayList_join(self(), Q_NULLPTR, 0); } + { return QtPrivate::QByteArrayList_join(self(), nullptr, 0); } inline QByteArray join(const QByteArray &sep) const { return QtPrivate::QByteArrayList_join(self(), sep.constData(), sep.size()); } inline QByteArray join(char sep) const diff --git a/src/corelib/tools/qcollator.h b/src/corelib/tools/qcollator.h index d81c7c85e3..6fa199cb0f 100644 --- a/src/corelib/tools/qcollator.h +++ b/src/corelib/tools/qcollator.h @@ -89,7 +89,7 @@ public: QCollator &operator=(const QCollator &); #ifdef Q_COMPILER_RVALUE_REFS QCollator(QCollator &&other) Q_DECL_NOTHROW - : d(other.d) { other.d = Q_NULLPTR; } + : d(other.d) { other.d = nullptr; } QCollator &operator=(QCollator &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index adab47fc1f..a390bce95f 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -79,7 +79,7 @@ public: int dayOfYear() const; int daysInMonth() const; int daysInYear() const; - int weekNumber(int *yearNum = Q_NULLPTR) const; + int weekNumber(int *yearNum = nullptr) const; #if QT_DEPRECATED_SINCE(5, 11) && !defined QT_NO_TEXTDATE QT_DEPRECATED_X("Use QLocale::monthName or QLocale::standaloneMonthName") diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 1098d7e24c..0b8fa4ca74 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1488,7 +1488,7 @@ QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) bool hasConfig; stream >> hasConfig; delete easing.d_ptr->config; - easing.d_ptr->config = Q_NULLPTR; + easing.d_ptr->config = nullptr; if (hasConfig) { QEasingCurveFunction *config = curveToFunctionObject(type); stream >> config->_p; diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h index ba06de8f9e..74bde5825a 100644 --- a/src/corelib/tools/qeasingcurve.h +++ b/src/corelib/tools/qeasingcurve.h @@ -81,7 +81,7 @@ public: QEasingCurve &operator=(const QEasingCurve &other) { if ( this != &other ) { QEasingCurve copy(other); swap(copy); } return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QEasingCurve(QEasingCurve &&other) Q_DECL_NOTHROW : d_ptr(other.d_ptr) { other.d_ptr = Q_NULLPTR; } + QEasingCurve(QEasingCurve &&other) Q_DECL_NOTHROW : d_ptr(other.d_ptr) { other.d_ptr = nullptr; } QEasingCurve &operator=(QEasingCurve &&other) Q_DECL_NOTHROW { qSwap(d_ptr, other.d_ptr); return *this; } #endif diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 715acc77ce..e7ce4b658f 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -315,7 +315,7 @@ public: typedef T *pointer; typedef T &reference; - inline iterator() : i(Q_NULLPTR) { } + inline iterator() : i(nullptr) { } explicit inline iterator(void *node) : i(reinterpret_cast(node)) { } inline const Key &key() const { return concrete(i)->key; } @@ -373,7 +373,7 @@ public: typedef const T *pointer; typedef const T &reference; - Q_DECL_CONSTEXPR inline const_iterator() : i(Q_NULLPTR) { } + Q_DECL_CONSTEXPR inline const_iterator() : i(nullptr) { } explicit inline const_iterator(void *node) : i(reinterpret_cast(node)) { } #ifdef QT_STRICT_ITERATORS @@ -502,7 +502,7 @@ public: private: void detach_helper(); void freeData(QHashData *d); - Node **findNode(const Key &key, uint *hp = Q_NULLPTR) const; + Node **findNode(const Key &key, uint *hp = nullptr) const; Node **findNode(const Key &key, uint h) const; Node *createNode(uint h, const Key &key, const T &value, Node **nextNode); void deleteNode(Node *node); @@ -550,7 +550,7 @@ template Q_INLINE_TEMPLATE void QHash::duplicateNode(QHashData::Node *node, void *newNode) { Node *concreteNode = concrete(node); - new (newNode) Node(concreteNode->key, concreteNode->value, concreteNode->h, Q_NULLPTR); + new (newNode) Node(concreteNode->key, concreteNode->value, concreteNode->h, nullptr); } template diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index 9f54ba7825..c8f3f4c8c3 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -134,7 +134,7 @@ public: typedef T *pointer; typedef T &reference; Node *i; - inline iterator() : i(Q_NULLPTR) {} + inline iterator() : i(nullptr) {} inline iterator(Node *n) : i(n) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) iterator(const iterator &other) Q_DECL_NOTHROW : i(other.i) {} @@ -171,7 +171,7 @@ public: typedef const T *pointer; typedef const T &reference; Node *i; - inline const_iterator() : i(Q_NULLPTR) {} + inline const_iterator() : i(nullptr) {} inline const_iterator(Node *n) : i(n) {} inline const_iterator(iterator ci) : i(ci.i){} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 1042c29460..af7659e995 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -231,7 +231,7 @@ public: typedef T *pointer; typedef T &reference; - inline iterator() Q_DECL_NOTHROW : i(Q_NULLPTR) {} + inline iterator() Q_DECL_NOTHROW : i(nullptr) {} inline iterator(Node *n) Q_DECL_NOTHROW : i(n) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) // can't remove it in Qt 5, since doing so would make the type trivial, @@ -283,7 +283,7 @@ public: typedef const T *pointer; typedef const T &reference; - inline const_iterator() Q_DECL_NOTHROW : i(Q_NULLPTR) {} + inline const_iterator() Q_DECL_NOTHROW : i(nullptr) {} inline const_iterator(Node *n) Q_DECL_NOTHROW : i(n) {} #if QT_VERSION < QT_VERSION_CHECK(6,0,0) // can't remove it in Qt 5, since doing so would make the type trivial, diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index 54b1a32946..ef7a26ea79 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -949,23 +949,23 @@ public: QString nativeCountryName() const; #if QT_STRINGVIEW_LEVEL < 2 - short toShort(const QString &s, bool *ok = Q_NULLPTR) const; - ushort toUShort(const QString &s, bool *ok = Q_NULLPTR) const; - int toInt(const QString &s, bool *ok = Q_NULLPTR) const; - uint toUInt(const QString &s, bool *ok = Q_NULLPTR) const; - qlonglong toLongLong(const QString &s, bool *ok = Q_NULLPTR) const; - qulonglong toULongLong(const QString &s, bool *ok = Q_NULLPTR) const; - float toFloat(const QString &s, bool *ok = Q_NULLPTR) const; - double toDouble(const QString &s, bool *ok = Q_NULLPTR) const; + short toShort(const QString &s, bool *ok = nullptr) const; + ushort toUShort(const QString &s, bool *ok = nullptr) const; + int toInt(const QString &s, bool *ok = nullptr) const; + uint toUInt(const QString &s, bool *ok = nullptr) const; + qlonglong toLongLong(const QString &s, bool *ok = nullptr) const; + qulonglong toULongLong(const QString &s, bool *ok = nullptr) const; + float toFloat(const QString &s, bool *ok = nullptr) const; + double toDouble(const QString &s, bool *ok = nullptr) const; - short toShort(const QStringRef &s, bool *ok = Q_NULLPTR) const; - ushort toUShort(const QStringRef &s, bool *ok = Q_NULLPTR) const; - int toInt(const QStringRef &s, bool *ok = Q_NULLPTR) const; - uint toUInt(const QStringRef &s, bool *ok = Q_NULLPTR) const; - qlonglong toLongLong(const QStringRef &s, bool *ok = Q_NULLPTR) const; - qulonglong toULongLong(const QStringRef &s, bool *ok = Q_NULLPTR) const; - float toFloat(const QStringRef &s, bool *ok = Q_NULLPTR) const; - double toDouble(const QStringRef &s, bool *ok = Q_NULLPTR) const; + short toShort(const QStringRef &s, bool *ok = nullptr) const; + ushort toUShort(const QStringRef &s, bool *ok = nullptr) const; + int toInt(const QStringRef &s, bool *ok = nullptr) const; + uint toUInt(const QStringRef &s, bool *ok = nullptr) const; + qlonglong toLongLong(const QStringRef &s, bool *ok = nullptr) const; + qulonglong toULongLong(const QStringRef &s, bool *ok = nullptr) const; + float toFloat(const QStringRef &s, bool *ok = nullptr) const; + double toDouble(const QStringRef &s, bool *ok = nullptr) const; #endif short toShort(QStringView s, bool *ok = nullptr) const; diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 16442014ff..fc72c6e32c 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -150,7 +150,7 @@ template inline QMapNode *QMapNode::lowerBound(const Key &akey) { QMapNode *n = this; - QMapNode *lastNode = Q_NULLPTR; + QMapNode *lastNode = nullptr; while (n) { if (!qMapLessThanKey(n->key, akey)) { lastNode = n; @@ -166,7 +166,7 @@ template inline QMapNode *QMapNode::upperBound(const Key &akey) { QMapNode *n = this; - QMapNode *lastNode = Q_NULLPTR; + QMapNode *lastNode = nullptr; while (n) { if (qMapLessThanKey(akey, n->key)) { lastNode = n; @@ -220,7 +220,7 @@ struct QMapData : public QMapDataBase Node *findNode(const Key &akey) const; void nodeRange(const Key &akey, Node **firstNode, Node **lastNode); - Node *createNode(const Key &k, const T &v, Node *parent = Q_NULLPTR, bool left = false) + Node *createNode(const Key &k, const T &v, Node *parent = nullptr, bool left = false) { Node *n = static_cast(QMapDataBase::createNode(sizeof(Node), Q_ALIGNOF(Node), parent, left)); @@ -261,13 +261,13 @@ QMapNode *QMapNode::copy(QMapData *d) const n->left = leftNode()->copy(d); n->left->setParent(n); } else { - n->left = Q_NULLPTR; + n->left = nullptr; } if (right) { n->right = rightNode()->copy(d); n->right->setParent(n); } else { - n->right = Q_NULLPTR; + n->right = nullptr; } return n; } @@ -288,7 +288,7 @@ QMapNode *QMapData::findNode(const Key &akey) const if (lb && !qMapLessThanKey(akey, lb->key)) return lb; } - return Q_NULLPTR; + return nullptr; } @@ -304,10 +304,10 @@ void QMapData::nodeRange(const Key &akey, QMapNode **firstNode, } else if (qMapLessThanKey(n->key, akey)) { n = n->rightNode(); } else { - *firstNode = n->leftNode() ? n->leftNode()->lowerBound(akey) : Q_NULLPTR; + *firstNode = n->leftNode() ? n->leftNode()->lowerBound(akey) : nullptr; if (!*firstNode) *firstNode = n; - *lastNode = n->rightNode() ? n->rightNode()->upperBound(akey) : Q_NULLPTR; + *lastNode = n->rightNode() ? n->rightNode()->upperBound(akey) : nullptr; if (!*lastNode) *lastNode = l; return; @@ -416,7 +416,7 @@ public: typedef T *pointer; typedef T &reference; - inline iterator() : i(Q_NULLPTR) { } + inline iterator() : i(nullptr) { } inline iterator(Node *node) : i(node) { } inline const Key &key() const { return i->key; } @@ -473,7 +473,7 @@ public: typedef const T *pointer; typedef const T &reference; - Q_DECL_CONSTEXPR inline const_iterator() : i(Q_NULLPTR) { } + Q_DECL_CONSTEXPR inline const_iterator() : i(nullptr) { } inline const_iterator(const Node *node) : i(node) { } #ifdef QT_STRICT_ITERATORS explicit inline const_iterator(const iterator &o) @@ -695,7 +695,7 @@ Q_INLINE_TEMPLATE int QMap::count(const Key &akey) const template Q_INLINE_TEMPLATE bool QMap::contains(const Key &akey) const { - return d->findNode(akey) != Q_NULLPTR; + return d->findNode(akey) != nullptr; } template @@ -704,7 +704,7 @@ Q_INLINE_TEMPLATE typename QMap::iterator QMap::insert(const Key detach(); Node *n = d->root(); Node *y = d->end(); - Node *lastNode = Q_NULLPTR; + Node *lastNode = nullptr; bool left = true; while (n) { y = n; @@ -779,15 +779,15 @@ typename QMap::iterator QMap::insert(const_iterator pos, const K } // we need to insert (not overwrite) - if (prev->right == Q_NULLPTR) { + if (prev->right == nullptr) { Node *z = d->createNode(akey, avalue, prev, false); return iterator(z); } - if (next->left == Q_NULLPTR) { + if (next->left == nullptr) { Node *z = d->createNode(akey, avalue, next, true); return iterator(z); } - Q_ASSERT(false); // We should have prev->right == Q_NULLPTR or next->left == Q_NULLPTR. + Q_ASSERT(false); // We should have prev->right == nullptr or next->left == nullptr. return this->insert(akey, avalue); } } @@ -801,7 +801,7 @@ Q_INLINE_TEMPLATE typename QMap::iterator QMap::insertMulti(cons Node* y = d->end(); Node* x = static_cast(d->root()); bool left = true; - while (x != Q_NULLPTR) { + while (x != nullptr) { left = !qMapLessThanKey(x->key, akey); y = x; x = left ? x->leftNode() : x->rightNode(); @@ -848,15 +848,15 @@ typename QMap::iterator QMap::insertMulti(const_iterator pos, co return this->insertMulti(akey, avalue); // ignore hint // Hint is ok - do insert - if (prev->right == Q_NULLPTR) { + if (prev->right == nullptr) { Node *z = d->createNode(akey, avalue, prev, false); return iterator(z); } - if (next->left == Q_NULLPTR) { + if (next->left == nullptr) { Node *z = d->createNode(akey, avalue, next, true); return iterator(z); } - Q_ASSERT(false); // We should have prev->right == Q_NULLPTR or next->left == Q_NULLPTR. + Q_ASSERT(false); // We should have prev->right == nullptr or next->left == nullptr. return this->insertMulti(akey, avalue); } } @@ -1102,7 +1102,7 @@ Q_OUTOFLINE_TEMPLATE QList QMap::values(const Key &akey) const template Q_INLINE_TEMPLATE typename QMap::const_iterator QMap::lowerBound(const Key &akey) const { - Node *lb = d->root() ? d->root()->lowerBound(akey) : Q_NULLPTR; + Node *lb = d->root() ? d->root()->lowerBound(akey) : nullptr; if (!lb) lb = d->end(); return const_iterator(lb); @@ -1112,7 +1112,7 @@ template Q_INLINE_TEMPLATE typename QMap::iterator QMap::lowerBound(const Key &akey) { detach(); - Node *lb = d->root() ? d->root()->lowerBound(akey) : Q_NULLPTR; + Node *lb = d->root() ? d->root()->lowerBound(akey) : nullptr; if (!lb) lb = d->end(); return iterator(lb); @@ -1122,7 +1122,7 @@ template Q_INLINE_TEMPLATE typename QMap::const_iterator QMap::upperBound(const Key &akey) const { - Node *ub = d->root() ? d->root()->upperBound(akey) : Q_NULLPTR; + Node *ub = d->root() ? d->root()->upperBound(akey) : nullptr; if (!ub) ub = d->end(); return const_iterator(ub); @@ -1132,7 +1132,7 @@ template Q_INLINE_TEMPLATE typename QMap::iterator QMap::upperBound(const Key &akey) { detach(); - Node *ub = d->root() ? d->root()->upperBound(akey) : Q_NULLPTR; + Node *ub = d->root() ? d->root()->upperBound(akey) : nullptr; if (!ub) ub = d->end(); return iterator(ub); diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index 558a456515..1f3f2d3fb0 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -80,7 +80,7 @@ public: } inline const char *readPointer() const { - return bufferSize == 0 ? Q_NULLPTR : (buffers.first().constData() + head); + return bufferSize == 0 ? nullptr : (buffers.first().constData() + head); } Q_CORE_EXPORT const char *readPointerAtPosition(qint64 pos, qint64 &length) const; diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index eeed3afd83..2a4083466b 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -97,7 +97,7 @@ class QScopedPointer { typedef T *QScopedPointer:: *RestrictedBool; public: - explicit QScopedPointer(T *p = Q_NULLPTR) Q_DECL_NOTHROW : d(p) + explicit QScopedPointer(T *p = nullptr) Q_DECL_NOTHROW : d(p) { } @@ -126,12 +126,12 @@ public: #if defined(Q_QDOC) inline operator bool() const { - return isNull() ? Q_NULLPTR : &QScopedPointer::d; + return isNull() ? nullptr : &QScopedPointer::d; } #else operator RestrictedBool() const Q_DECL_NOTHROW { - return isNull() ? Q_NULLPTR : &QScopedPointer::d; + return isNull() ? nullptr : &QScopedPointer::d; } #endif @@ -150,7 +150,7 @@ public: return !d; } - void reset(T *other = Q_NULLPTR) Q_DECL_NOEXCEPT_EXPR(noexcept(Cleanup::cleanup(std::declval()))) + void reset(T *other = nullptr) Q_DECL_NOEXCEPT_EXPR(noexcept(Cleanup::cleanup(std::declval()))) { if (d == other) return; @@ -162,7 +162,7 @@ public: T *take() Q_DECL_NOTHROW { T *oldD = d; - d = Q_NULLPTR; + d = nullptr; return oldD; } @@ -226,7 +226,7 @@ class QScopedArrayPointer : public QScopedPointer template using if_same_type = typename std::enable_if::type, Ptr>::value, bool>::type; public: - inline QScopedArrayPointer() : QScopedPointer(Q_NULLPTR) {} + inline QScopedArrayPointer() : QScopedPointer(nullptr) {} template = true> explicit QScopedArrayPointer(D *p) diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 13b0032605..dbf0907a0f 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -85,7 +85,7 @@ public: inline bool operator==(const QSharedDataPointer &other) const { return d == other.d; } inline bool operator!=(const QSharedDataPointer &other) const { return d != other.d; } - inline QSharedDataPointer() { d = Q_NULLPTR; } + inline QSharedDataPointer() { d = nullptr; } inline ~QSharedDataPointer() { if (d && !d->ref.deref()) delete d; } explicit QSharedDataPointer(T *data) Q_DECL_NOTHROW; @@ -113,7 +113,7 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS - QSharedDataPointer(QSharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = Q_NULLPTR; } + QSharedDataPointer(QSharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; } inline QSharedDataPointer &operator=(QSharedDataPointer &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif @@ -151,17 +151,17 @@ public: if(d && !d->ref.deref()) delete d; - d = Q_NULLPTR; + d = nullptr; } - inline operator bool () const { return d != Q_NULLPTR; } + inline operator bool () const { return d != nullptr; } inline bool operator==(const QExplicitlySharedDataPointer &other) const { return d == other.d; } inline bool operator!=(const QExplicitlySharedDataPointer &other) const { return d != other.d; } inline bool operator==(const T *ptr) const { return d == ptr; } inline bool operator!=(const T *ptr) const { return d != ptr; } - inline QExplicitlySharedDataPointer() { d = Q_NULLPTR; } + inline QExplicitlySharedDataPointer() { d = nullptr; } inline ~QExplicitlySharedDataPointer() { if (d && !d->ref.deref()) delete d; } explicit QExplicitlySharedDataPointer(T *data) Q_DECL_NOTHROW; @@ -202,7 +202,7 @@ public: return *this; } #ifdef Q_COMPILER_RVALUE_REFS - inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = Q_NULLPTR; } + inline QExplicitlySharedDataPointer(QExplicitlySharedDataPointer &&o) Q_DECL_NOTHROW : d(o.d) { o.d = nullptr; } inline QExplicitlySharedDataPointer &operator=(QExplicitlySharedDataPointer &&other) Q_DECL_NOTHROW { qSwap(d, other.d); return *this; } #endif diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 9e1a5c7c62..736049b722 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -305,7 +305,7 @@ public: T *data() const Q_DECL_NOTHROW { return value; } T *get() const Q_DECL_NOTHROW { return value; } bool isNull() const Q_DECL_NOTHROW { return !data(); } - operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? Q_NULLPTR : &QSharedPointer::value; } + operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? nullptr : &QSharedPointer::value; } bool operator !() const Q_DECL_NOTHROW { return isNull(); } T &operator*() const { return *data(); } T *operator->() const Q_DECL_NOTHROW { return data(); } @@ -338,8 +338,8 @@ public: QSharedPointer(QSharedPointer &&other) Q_DECL_NOTHROW : value(other.value), d(other.d) { - other.d = Q_NULLPTR; - other.value = Q_NULLPTR; + other.d = nullptr; + other.value = nullptr; } QSharedPointer &operator=(QSharedPointer &&other) Q_DECL_NOTHROW { @@ -352,8 +352,8 @@ public: QSharedPointer(QSharedPointer &&other) Q_DECL_NOTHROW : value(other.value), d(other.d) { - other.d = Q_NULLPTR; - other.value = Q_NULLPTR; + other.d = nullptr; + other.value = nullptr; } template @@ -379,7 +379,7 @@ public: } template - inline QSharedPointer(const QWeakPointer &other) : value(Q_NULLPTR), d(Q_NULLPTR) + inline QSharedPointer(const QWeakPointer &other) : value(nullptr), d(nullptr) { *this = other; } template @@ -477,7 +477,7 @@ private: inline void internalConstruct(X *ptr, Deleter deleter) { if (!ptr) { - d = Q_NULLPTR; + d = nullptr; return; } @@ -528,14 +528,14 @@ public: o->weakref.ref(); } else { o->checkQObjectShared(actual); - o = Q_NULLPTR; + o = nullptr; } } qSwap(d, o); qSwap(this->value, actual); if (!d || d->strongref.load() == 0) - this->value = Q_NULLPTR; + this->value = nullptr; // dereference saved data deref(o); @@ -560,19 +560,19 @@ public: typedef const value_type &const_reference; typedef qptrdiff difference_type; - bool isNull() const Q_DECL_NOTHROW { return d == Q_NULLPTR || d->strongref.load() == 0 || value == Q_NULLPTR; } - operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? Q_NULLPTR : &QWeakPointer::value; } + bool isNull() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 || value == nullptr; } + operator RestrictedBool() const Q_DECL_NOTHROW { return isNull() ? nullptr : &QWeakPointer::value; } bool operator !() const Q_DECL_NOTHROW { return isNull(); } - T *data() const Q_DECL_NOTHROW { return d == Q_NULLPTR || d->strongref.load() == 0 ? Q_NULLPTR : value; } + T *data() const Q_DECL_NOTHROW { return d == nullptr || d->strongref.load() == 0 ? nullptr : value; } - inline QWeakPointer() Q_DECL_NOTHROW : d(Q_NULLPTR), value(Q_NULLPTR) { } + inline QWeakPointer() Q_DECL_NOTHROW : d(nullptr), value(nullptr) { } inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; } #ifndef QT_NO_QOBJECT // special constructor that is enabled only if X derives from QObject #if QT_DEPRECATED_SINCE(5, 0) template - QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? Data::getAndRef(ptr) : Q_NULLPTR), value(ptr) + QT_DEPRECATED inline QWeakPointer(X *ptr) : d(ptr ? Data::getAndRef(ptr) : nullptr), value(ptr) { } #endif #endif @@ -589,8 +589,8 @@ public: QWeakPointer(QWeakPointer &&other) Q_DECL_NOTHROW : d(other.d), value(other.value) { - other.d = Q_NULLPTR; - other.value = Q_NULLPTR; + other.d = nullptr; + other.value = nullptr; } QWeakPointer &operator=(QWeakPointer &&other) Q_DECL_NOTHROW { QWeakPointer moved(std::move(other)); swap(moved); return *this; } @@ -617,7 +617,7 @@ public: } template - inline QWeakPointer(const QWeakPointer &o) : d(Q_NULLPTR), value(Q_NULLPTR) + inline QWeakPointer(const QWeakPointer &o) : d(nullptr), value(nullptr) { *this = o; } template @@ -638,7 +638,7 @@ public: { return !(*this == o); } template - inline QWeakPointer(const QSharedPointer &o) : d(Q_NULLPTR), value(Q_NULLPTR) + inline QWeakPointer(const QSharedPointer &o) : d(nullptr), value(nullptr) { *this = o; } template @@ -682,7 +682,7 @@ public: #ifndef QT_NO_QOBJECT template - inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : Q_NULLPTR), value(ptr) + inline QWeakPointer(X *ptr, bool) : d(ptr ? Data::getAndRef(ptr) : nullptr), value(ptr) { } #endif diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 3826d7531a..ea157a23d0 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -4007,7 +4007,7 @@ int QString::count(const QRegExp& rx) const */ int QString::indexOf(const QRegularExpression& re, int from) const { - return indexOf(re, from, Q_NULLPTR); + return indexOf(re, from, nullptr); } /*! @@ -4058,7 +4058,7 @@ int QString::indexOf(const QRegularExpression &re, int from, QRegularExpressionM */ int QString::lastIndexOf(const QRegularExpression &re, int from) const { - return lastIndexOf(re, from, Q_NULLPTR); + return lastIndexOf(re, from, nullptr); } /*! @@ -4110,7 +4110,7 @@ int QString::lastIndexOf(const QRegularExpression &re, int from, QRegularExpress */ bool QString::contains(const QRegularExpression &re) const { - return contains(re, Q_NULLPTR); + return contains(re, nullptr); } /*! diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 16472ff6b9..1eca773c3e 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -91,7 +91,7 @@ template class QVector; class QLatin1String { public: - Q_DECL_CONSTEXPR inline QLatin1String() Q_DECL_NOTHROW : m_size(0), m_data(Q_NULLPTR) {} + Q_DECL_CONSTEXPR inline QLatin1String() Q_DECL_NOTHROW : m_size(0), m_data(nullptr) {} Q_DECL_CONSTEXPR inline explicit QLatin1String(const char *s) Q_DECL_NOTHROW : m_size(s ? int(strlen(s)) : 0), m_data(s) {} Q_DECL_CONSTEXPR explicit QLatin1String(const char *f, const char *l) : QLatin1String(f, int(l - f)) {} @@ -624,16 +624,16 @@ public: static int localeAwareCompare(const QString& s1, const QStringRef& s2); // ### Qt6: make inline except for the long long versions - short toShort(bool *ok=Q_NULLPTR, int base=10) const; - ushort toUShort(bool *ok=Q_NULLPTR, int base=10) const; - int toInt(bool *ok=Q_NULLPTR, int base=10) const; - uint toUInt(bool *ok=Q_NULLPTR, int base=10) const; - long toLong(bool *ok=Q_NULLPTR, int base=10) const; - ulong toULong(bool *ok=Q_NULLPTR, int base=10) const; - qlonglong toLongLong(bool *ok=Q_NULLPTR, int base=10) const; - qulonglong toULongLong(bool *ok=Q_NULLPTR, int base=10) const; - float toFloat(bool *ok=Q_NULLPTR) const; - double toDouble(bool *ok=Q_NULLPTR) const; + short toShort(bool *ok=nullptr, int base=10) const; + ushort toUShort(bool *ok=nullptr, int base=10) const; + int toInt(bool *ok=nullptr, int base=10) const; + uint toUInt(bool *ok=nullptr, int base=10) const; + long toLong(bool *ok=nullptr, int base=10) const; + ulong toULong(bool *ok=nullptr, int base=10) const; + qlonglong toLongLong(bool *ok=nullptr, int base=10) const; + qulonglong toULongLong(bool *ok=nullptr, int base=10) const; + float toFloat(bool *ok=nullptr) const; + double toDouble(bool *ok=nullptr) const; QString &setNum(short, int base=10); QString &setNum(ushort, int base=10); @@ -1417,7 +1417,7 @@ public: typedef QString::const_reference const_reference; // ### Qt 6: make this constructor constexpr, after the destructor is made trivial - inline QStringRef() : m_string(Q_NULLPTR), m_position(0), m_size(0) {} + inline QStringRef() : m_string(nullptr), m_position(0), m_size(0) {} inline QStringRef(const QString *string, int position, int size); inline QStringRef(const QString *string); @@ -1533,10 +1533,10 @@ public: Q_REQUIRED_RESULT QByteArray toLocal8Bit() const; Q_REQUIRED_RESULT QVector toUcs4() const; - inline void clear() { m_string = Q_NULLPTR; m_position = m_size = 0; } + inline void clear() { m_string = nullptr; m_position = m_size = 0; } QString toString() const; inline bool isEmpty() const { return m_size == 0; } - inline bool isNull() const { return m_string == Q_NULLPTR || m_string->isNull(); } + inline bool isNull() const { return m_string == nullptr || m_string->isNull(); } QStringRef appendTo(QString *string) const; @@ -1576,16 +1576,16 @@ public: static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2); Q_REQUIRED_RESULT QStringRef trimmed() const; - short toShort(bool *ok = Q_NULLPTR, int base = 10) const; - ushort toUShort(bool *ok = Q_NULLPTR, int base = 10) const; - int toInt(bool *ok = Q_NULLPTR, int base = 10) const; - uint toUInt(bool *ok = Q_NULLPTR, int base = 10) const; - long toLong(bool *ok = Q_NULLPTR, int base = 10) const; - ulong toULong(bool *ok = Q_NULLPTR, int base = 10) const; - qlonglong toLongLong(bool *ok = Q_NULLPTR, int base = 10) const; - qulonglong toULongLong(bool *ok = Q_NULLPTR, int base = 10) const; - float toFloat(bool *ok = Q_NULLPTR) const; - double toDouble(bool *ok = Q_NULLPTR) const; + short toShort(bool *ok = nullptr, int base = 10) const; + ushort toUShort(bool *ok = nullptr, int base = 10) const; + int toInt(bool *ok = nullptr, int base = 10) const; + uint toUInt(bool *ok = nullptr, int base = 10) const; + long toLong(bool *ok = nullptr, int base = 10) const; + ulong toULong(bool *ok = nullptr, int base = 10) const; + qlonglong toLongLong(bool *ok = nullptr, int base = 10) const; + qulonglong toULongLong(bool *ok = nullptr, int base = 10) const; + float toFloat(bool *ok = nullptr) const; + double toDouble(bool *ok = nullptr) const; }; Q_DECLARE_TYPEINFO(QStringRef, Q_PRIMITIVE_TYPE); diff --git a/src/corelib/tools/qtextboundaryfinder.h b/src/corelib/tools/qtextboundaryfinder.h index d021df3f2c..b1e5008f54 100644 --- a/src/corelib/tools/qtextboundaryfinder.h +++ b/src/corelib/tools/qtextboundaryfinder.h @@ -74,7 +74,7 @@ public: Q_DECLARE_FLAGS( BoundaryReasons, BoundaryReason ) QTextBoundaryFinder(BoundaryType type, const QString &string); - QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer = Q_NULLPTR, int bufferSize = 0); + QTextBoundaryFinder(BoundaryType type, const QChar *chars, int length, unsigned char *buffer = nullptr, int bufferSize = 0); inline bool isValid() const { return d; } diff --git a/src/corelib/tools/qtimeline.h b/src/corelib/tools/qtimeline.h index 4cba49e185..d9982bdb58 100644 --- a/src/corelib/tools/qtimeline.h +++ b/src/corelib/tools/qtimeline.h @@ -76,7 +76,7 @@ public: CosineCurve }; - explicit QTimeLine(int duration = 1000, QObject *parent = Q_NULLPTR); + explicit QTimeLine(int duration = 1000, QObject *parent = nullptr); virtual ~QTimeLine(); State state() const; diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h index 3836bc2119..1bfb4aab39 100644 --- a/src/corelib/tools/qversionnumber.h +++ b/src/corelib/tools/qversionnumber.h @@ -281,7 +281,7 @@ public: Q_REQUIRED_RESULT Q_CORE_EXPORT QString toString() const; #if QT_STRINGVIEW_LEVEL < 2 - Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = Q_NULLPTR); + Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(const QString &string, int *suffixIndex = nullptr); #endif Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QLatin1String string, int *suffixIndex = nullptr); Q_REQUIRED_RESULT Q_CORE_EXPORT static Q_DECL_PURE_FUNCTION QVersionNumber fromString(QStringView string, int *suffixIndex = nullptr); diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h index bf6ddefcdd..2350d12dd6 100644 --- a/src/corelib/xml/qxmlstream.h +++ b/src/corelib/xml/qxmlstream.h @@ -120,7 +120,7 @@ public: reserved(other.reserved), m_isDefault(other.m_isDefault) { - other.reserved = Q_NULLPTR; + other.reserved = nullptr; } QXmlStreamAttribute &operator=(QXmlStreamAttribute &&other) Q_DECL_NOTHROW // = default; { -- cgit v1.2.3