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/kernel/qobject.h | 46 ++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'src/corelib/kernel/qobject.h') 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; } -- cgit v1.2.3