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/gui/kernel/qcursor.h | 2 +- src/gui/kernel/qevent.h | 6 +++--- src/gui/kernel/qgenericplugin.h | 2 +- src/gui/kernel/qguiapplication.cpp | 20 ++++++++++---------- src/gui/kernel/qguiapplication_p.h | 2 +- src/gui/kernel/qoffscreensurface.h | 2 +- src/gui/kernel/qopenglcontext.h | 2 +- src/gui/kernel/qopenglcontext_p.h | 4 ++-- src/gui/kernel/qopenglwindow.cpp | 2 +- src/gui/kernel/qopenglwindow.h | 4 ++-- src/gui/kernel/qpalette.h | 2 +- src/gui/kernel/qplatformgraphicsbuffer.cpp | 4 ++-- src/gui/kernel/qplatformgraphicsbufferhelper.h | 2 +- src/gui/kernel/qplatformnativeinterface.cpp | 4 ++-- src/gui/kernel/qplatformwindow.cpp | 2 +- src/gui/kernel/qrasterwindow.h | 2 +- src/gui/kernel/qsimpledrag.cpp | 2 +- src/gui/kernel/qwindow.h | 6 +++--- src/gui/kernel/qwindowsysteminterface.h | 2 +- src/gui/kernel/qwindowsysteminterface_p.h | 2 +- 20 files changed, 37 insertions(+), 37 deletions(-) (limited to 'src/gui/kernel') diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index ccce3d84ef..d62ee7a053 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -87,7 +87,7 @@ public: ~QCursor(); QCursor &operator=(const QCursor &cursor); #ifdef Q_COMPILER_RVALUE_REFS - QCursor(QCursor &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Q_NULLPTR; } + QCursor(QCursor &&other) Q_DECL_NOTHROW : d(other.d) { other.d = nullptr; } inline QCursor &operator=(QCursor &&other) Q_DECL_NOTHROW { swap(other); return *this; } #endif diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index b8f86acd75..c4afde8afd 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -717,7 +717,7 @@ class Q_GUI_EXPORT QActionEvent : public QEvent { QAction *act, *bef; public: - QActionEvent(int type, QAction *action, QAction *before = Q_NULLPTR); + QActionEvent(int type, QAction *action, QAction *before = nullptr); ~QActionEvent(); inline QAction *action() const { return act; } @@ -845,7 +845,7 @@ public: TouchPoint(const TouchPoint &other); #ifdef Q_COMPILER_RVALUE_REFS TouchPoint(TouchPoint &&other) Q_DECL_NOEXCEPT - : d(Q_NULLPTR) + : d(nullptr) { qSwap(d, other.d); } TouchPoint &operator=(TouchPoint &&other) Q_DECL_NOEXCEPT { qSwap(d, other.d); return *this; } @@ -933,7 +933,7 @@ public: #endif explicit QTouchEvent(QEvent::Type eventType, - QTouchDevice *device = Q_NULLPTR, + QTouchDevice *device = nullptr, Qt::KeyboardModifiers modifiers = Qt::NoModifier, Qt::TouchPointStates touchPointStates = Qt::TouchPointStates(), const QList &touchPoints = QList()); diff --git a/src/gui/kernel/qgenericplugin.h b/src/gui/kernel/qgenericplugin.h index e8aa2e6f32..69b4f29854 100644 --- a/src/gui/kernel/qgenericplugin.h +++ b/src/gui/kernel/qgenericplugin.h @@ -52,7 +52,7 @@ class Q_GUI_EXPORT QGenericPlugin : public QObject { Q_OBJECT public: - explicit QGenericPlugin(QObject *parent = Q_NULLPTR); + explicit QGenericPlugin(QObject *parent = nullptr); ~QGenericPlugin(); virtual QObject* create(const QString& name, const QString &spec) = 0; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a29ddbe44e..88d04f978e 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -190,7 +190,7 @@ QWindow *QGuiApplicationPrivate::focus_window = 0; static QBasicMutex applicationFontMutex; QFont *QGuiApplicationPrivate::app_font = 0; -QStyleHints *QGuiApplicationPrivate::styleHints = Q_NULLPTR; +QStyleHints *QGuiApplicationPrivate::styleHints = nullptr; bool QGuiApplicationPrivate::obey_desktop_settings = true; QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0; @@ -748,7 +748,7 @@ QString QGuiApplication::desktopFileName() */ QWindow *QGuiApplication::modalWindow() { - CHECK_QAPP_INSTANCE(Q_NULLPTR) + CHECK_QAPP_INSTANCE(nullptr) if (QGuiApplicationPrivate::self->modalWindowList.isEmpty()) return 0; return QGuiApplicationPrivate::self->modalWindowList.first(); @@ -1053,7 +1053,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) const QList screens = QGuiApplication::screens(); if (!screens.isEmpty()) { const QList primaryScreens = screens.first()->virtualSiblings(); - QScreen *windowScreen = Q_NULLPTR; + QScreen *windowScreen = nullptr; // Find the window on the primary virtual desktop first for (QScreen *screen : primaryScreens) { @@ -1081,7 +1081,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos) return windowScreen->handle()->topLevelAt(devicePosition); } } - return Q_NULLPTR; + return nullptr; } /*! @@ -1526,7 +1526,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate() cleanupThreadData(); delete QGuiApplicationPrivate::styleHints; - QGuiApplicationPrivate::styleHints = Q_NULLPTR; + QGuiApplicationPrivate::styleHints = nullptr; delete inputMethod; qt_cleanupFontDatabase(); @@ -1649,10 +1649,10 @@ QFunctionPointer QGuiApplication::platformFunction(const QByteArray &function) QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration(); if (!pi) { qWarning("QGuiApplication::platformFunction(): Must construct a QGuiApplication before accessing a platform function"); - return Q_NULLPTR; + return nullptr; } - return pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) : Q_NULLPTR; + return pi->nativeInterface() ? pi->nativeInterface()->platformFunction(function) : nullptr; } /*! @@ -2348,7 +2348,7 @@ void QGuiApplicationPrivate::processTabletEvent(QWindowSystemInterfacePrivate::T localValid = false; } if (type == QEvent::TabletRelease) - pointData.target = Q_NULLPTR; + pointData.target = nullptr; if (!window) return; } @@ -3505,7 +3505,7 @@ Qt::LayoutDirection QGuiApplication::layoutDirection() #ifndef QT_NO_CURSOR QCursor *QGuiApplication::overrideCursor() { - CHECK_QAPP_INSTANCE(Q_NULLPTR) + CHECK_QAPP_INSTANCE(nullptr) return qGuiApp->d_func()->cursor_list.isEmpty() ? 0 : &qGuiApp->d_func()->cursor_list.first(); } @@ -3705,7 +3705,7 @@ bool QGuiApplication::desktopSettingsAware() */ QInputMethod *QGuiApplication::inputMethod() { - CHECK_QAPP_INSTANCE(Q_NULLPTR) + CHECK_QAPP_INSTANCE(nullptr) if (!qGuiApp->d_func()->inputMethod) qGuiApp->d_func()->inputMethod = new QInputMethod(); return qGuiApp->d_func()->inputMethod; diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index ee5c5f8cde..b7b847785c 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -213,7 +213,7 @@ public: static bool highDpiScalingUpdated; struct TabletPointData { - TabletPointData(qint64 devId = 0) : deviceId(devId), state(Qt::NoButton), target(Q_NULLPTR) {} + TabletPointData(qint64 devId = 0) : deviceId(devId), state(Qt::NoButton), target(nullptr) {} qint64 deviceId; Qt::MouseButtons state; QWindow *target; diff --git a/src/gui/kernel/qoffscreensurface.h b/src/gui/kernel/qoffscreensurface.h index c3f4656850..9d4839cb25 100644 --- a/src/gui/kernel/qoffscreensurface.h +++ b/src/gui/kernel/qoffscreensurface.h @@ -59,7 +59,7 @@ class Q_GUI_EXPORT QOffscreenSurface : public QObject, public QSurface public: // ### Qt 6: merge overloads explicit QOffscreenSurface(QScreen *screen, QObject *parent); - explicit QOffscreenSurface(QScreen *screen = Q_NULLPTR); + explicit QOffscreenSurface(QScreen *screen = nullptr); virtual ~QOffscreenSurface(); SurfaceType surfaceType() const override; diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 07153db84e..9cfaa52f17 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -151,7 +151,7 @@ class Q_GUI_EXPORT QOpenGLContext : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QOpenGLContext) public: - explicit QOpenGLContext(QObject *parent = Q_NULLPTR); + explicit QOpenGLContext(QObject *parent = nullptr); ~QOpenGLContext(); void setFormat(const QSurfaceFormat &format); diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index eeb1a83283..c5239af69e 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -213,7 +213,7 @@ public: , workaround_missingPrecisionQualifiers(false) , active_engine(0) , qgl_current_fbo_invalid(false) - , qgl_current_fbo(Q_NULLPTR) + , qgl_current_fbo(nullptr) , defaultFboRedirect(0) { requestedFormat = QSurfaceFormat::defaultFormat(); @@ -266,7 +266,7 @@ public: static QOpenGLContextPrivate *get(QOpenGLContext *context) { - return context ? context->d_func() : Q_NULLPTR; + return context ? context->d_func() : nullptr; } #if !defined(QT_NO_DEBUG) diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp index f82430005b..cf3d712421 100644 --- a/src/gui/kernel/qopenglwindow.cpp +++ b/src/gui/kernel/qopenglwindow.cpp @@ -344,7 +344,7 @@ void QOpenGLWindowPaintDevice::ensureActiveTarget() \sa QOpenGLWindow::UpdateBehavior */ QOpenGLWindow::QOpenGLWindow(QOpenGLWindow::UpdateBehavior updateBehavior, QWindow *parent) - : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(Q_NULLPTR, updateBehavior)), parent) + : QPaintDeviceWindow(*(new QOpenGLWindowPrivate(nullptr, updateBehavior)), parent) { setSurfaceType(QSurface::OpenGLSurface); } diff --git a/src/gui/kernel/qopenglwindow.h b/src/gui/kernel/qopenglwindow.h index 85b380249b..7b3bf004a3 100644 --- a/src/gui/kernel/qopenglwindow.h +++ b/src/gui/kernel/qopenglwindow.h @@ -64,8 +64,8 @@ public: PartialUpdateBlend }; - explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = Q_NULLPTR); - explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = Q_NULLPTR); + explicit QOpenGLWindow(UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr); + explicit QOpenGLWindow(QOpenGLContext *shareContext, UpdateBehavior updateBehavior = NoPartialUpdate, QWindow *parent = nullptr); ~QOpenGLWindow(); UpdateBehavior updateBehavior() const; diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index d04fb1f0c5..71f3d0c3b8 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -70,7 +70,7 @@ public: #ifdef Q_COMPILER_RVALUE_REFS QPalette(QPalette &&other) Q_DECL_NOTHROW : d(other.d), data(other.data) - { other.d = Q_NULLPTR; } + { other.d = nullptr; } inline QPalette &operator=(QPalette &&other) Q_DECL_NOEXCEPT { for_faster_swapping_dont_use = other.for_faster_swapping_dont_use; diff --git a/src/gui/kernel/qplatformgraphicsbuffer.cpp b/src/gui/kernel/qplatformgraphicsbuffer.cpp index d42231e958..cc01efd6db 100644 --- a/src/gui/kernel/qplatformgraphicsbuffer.cpp +++ b/src/gui/kernel/qplatformgraphicsbuffer.cpp @@ -217,7 +217,7 @@ void QPlatformGraphicsBuffer::unlock() the memory returned when not having a SWWriteAccess. */ const uchar *QPlatformGraphicsBuffer::data() const -{ return Q_NULLPTR; } +{ return nullptr; } /*! Accessor for the bytes of the buffer. This function needs to be called on a @@ -226,7 +226,7 @@ const uchar *QPlatformGraphicsBuffer::data() const */ uchar *QPlatformGraphicsBuffer::data() { - return Q_NULLPTR; + return nullptr; } /*! diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.h b/src/gui/kernel/qplatformgraphicsbufferhelper.h index 5b7daff65a..6307f54a3e 100644 --- a/src/gui/kernel/qplatformgraphicsbufferhelper.h +++ b/src/gui/kernel/qplatformgraphicsbufferhelper.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE namespace QPlatformGraphicsBufferHelper { bool lockAndBindToTexture(QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB, bool *premultipliedB, const QRect &rect = QRect()); - bool bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB = Q_NULLPTR, bool *premultipliedB = Q_NULLPTR, const QRect &rect = QRect()); + bool bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer, bool *swizzleRandB = nullptr, bool *premultipliedB = nullptr, const QRect &rect = QRect()); } QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface.cpp b/src/gui/kernel/qplatformnativeinterface.cpp index 6614d45b12..b24541d3ec 100644 --- a/src/gui/kernel/qplatformnativeinterface.cpp +++ b/src/gui/kernel/qplatformnativeinterface.cpp @@ -92,7 +92,7 @@ void *QPlatformNativeInterface::nativeResourceForCursor(const QByteArray &resour { Q_UNUSED(resource); Q_UNUSED(cursor); - return Q_NULLPTR; + return nullptr; } #endif // !QT_NO_CURSOR @@ -129,7 +129,7 @@ QPlatformNativeInterface::NativeResourceForBackingStoreFunction QPlatformNativeI QFunctionPointer QPlatformNativeInterface::platformFunction(const QByteArray &function) const { Q_UNUSED(function); - return Q_NULLPTR; + return nullptr; } /*! diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp index ae39411729..2284290d6c 100644 --- a/src/gui/kernel/qplatformwindow.cpp +++ b/src/gui/kernel/qplatformwindow.cpp @@ -104,7 +104,7 @@ QPlatformWindow *QPlatformWindow::parent() const QPlatformScreen *QPlatformWindow::screen() const { QScreen *scr = window()->screen(); - return scr ? scr->handle() : Q_NULLPTR; + return scr ? scr->handle() : nullptr; } /*! diff --git a/src/gui/kernel/qrasterwindow.h b/src/gui/kernel/qrasterwindow.h index 6dee03c3ad..9fe01c076b 100644 --- a/src/gui/kernel/qrasterwindow.h +++ b/src/gui/kernel/qrasterwindow.h @@ -53,7 +53,7 @@ class Q_GUI_EXPORT QRasterWindow : public QPaintDeviceWindow Q_DECLARE_PRIVATE(QRasterWindow) public: - explicit QRasterWindow(QWindow *parent = Q_NULLPTR); + explicit QRasterWindow(QWindow *parent = nullptr); ~QRasterWindow(); protected: diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 481971f21a..1fba649354 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -97,7 +97,7 @@ QBasicDrag::QBasicDrag() : m_restoreCursor(false), m_eventLoop(0), m_executed_drop_action(Qt::IgnoreAction), m_can_drop(false), m_drag(0), m_drag_icon_window(0), m_useCompositing(true), - m_screen(Q_NULLPTR) + m_screen(nullptr) { } diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index be8f10529d..cbb0c6a51c 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -141,7 +141,7 @@ public: }; Q_ENUM(AncestorMode) - explicit QWindow(QScreen *screen = Q_NULLPTR); + explicit QWindow(QScreen *screen = nullptr); explicit QWindow(QWindow *parent); virtual ~QWindow(); @@ -380,12 +380,12 @@ private: #ifndef Q_QDOC template <> inline QWindow *qobject_cast(QObject *o) { - if (!o || !o->isWindowType()) return Q_NULLPTR; + if (!o || !o->isWindowType()) return nullptr; return static_cast(o); } template <> inline const QWindow *qobject_cast(const QObject *o) { - if (!o || !o->isWindowType()) return Q_NULLPTR; + if (!o || !o->isWindowType()) return nullptr; return static_cast(o); } #endif // !Q_QDOC diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 7ea7b072f0..566abe37a9 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -166,7 +166,7 @@ public: template static void handleExposeEvent(QWindow *window, const QRegion ®ion); - static void handleCloseEvent(QWindow *window, bool *accepted = Q_NULLPTR); + static void handleCloseEvent(QWindow *window, bool *accepted = nullptr); template static void handleEnterEvent(QWindow *window, const QPointF &local = QPointF(), const QPointF& global = QPointF()); diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index ef993501f8..060aaa4db7 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -512,7 +512,7 @@ public: static QList fromNativeTouchPoints(const QList &points, - const QWindow *window, quint8 deviceId, QEvent::Type *type = Q_NULLPTR); + const QWindow *window, quint8 deviceId, QEvent::Type *type = nullptr); static QList toNativeTouchPoints(const QList& pointList, const QWindow *window); -- cgit v1.2.3