From ece0c0a5e7e0b18beb58ccd868bde54c7be64f78 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 22 Nov 2019 14:46:58 +0100 Subject: Tidy nullptr usage Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/plugins/platforms/offscreen/main.cpp | 2 +- src/plugins/platforms/offscreen/qoffscreencommon.cpp | 10 +++++----- src/plugins/platforms/offscreen/qoffscreenintegration.cpp | 2 +- .../platforms/offscreen/qoffscreenintegration_x11.cpp | 12 ++++++------ src/plugins/platforms/offscreen/qoffscreenwindow.cpp | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/plugins/platforms/offscreen') diff --git a/src/plugins/platforms/offscreen/main.cpp b/src/plugins/platforms/offscreen/main.cpp index 207db60f3a..f364d9f004 100644 --- a/src/plugins/platforms/offscreen/main.cpp +++ b/src/plugins/platforms/offscreen/main.cpp @@ -57,7 +57,7 @@ QPlatformIntegration *QOffscreenIntegrationPlugin::create(const QString& system, if (!system.compare(QLatin1String("offscreen"), Qt::CaseInsensitive)) return QOffscreenIntegration::createOffscreenIntegration(); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp index eae25012c1..de75a3e012 100644 --- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp +++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE -QPlatformWindow *QOffscreenScreen::windowContainingCursor = 0; +QPlatformWindow *QOffscreenScreen::windowContainingCursor = nullptr; class QOffscreenCursor : public QPlatformCursor { @@ -60,7 +60,7 @@ public: { m_pos = pos; const QWindowList wl = QGuiApplication::topLevelWindows(); - QWindow *containing = 0; + QWindow *containing = nullptr; for (QWindow *w : wl) { if (w->type() != Qt::Desktop && w->isExposed() && w->geometry().contains(pos)) { containing = w; @@ -72,7 +72,7 @@ public: if (containing) local -= containing->position(); - QWindow *previous = QOffscreenScreen::windowContainingCursor ? QOffscreenScreen::windowContainingCursor->window() : 0; + QWindow *previous = QOffscreenScreen::windowContainingCursor ? QOffscreenScreen::windowContainingCursor->window() : nullptr; if (containing != previous) QWindowSystemInterface::handleEnterLeaveEvent(containing, previous, local, pos); @@ -80,7 +80,7 @@ public: QWindowSystemInterface::handleMouseEvent(containing, local, pos, QGuiApplication::mouseButtons(), Qt::NoButton, QEvent::MouseMove, QGuiApplication::keyboardModifiers(), Qt::MouseEventSynthesizedByQt); - QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : 0; + QOffscreenScreen::windowContainingCursor = containing ? containing->handle() : nullptr; } #ifndef QT_NO_CURSOR void changeCursor(QCursor *windowCursor, QWindow *window) override @@ -106,7 +106,7 @@ QPixmap QOffscreenScreen::grabWindow(WId id, int x, int y, int width, int height QOffscreenWindow *window = QOffscreenWindow::windowForWinId(id); if (!window || window->window()->type() == Qt::Desktop) { const QWindowList wl = QGuiApplication::topLevelWindows(); - QWindow *containing = 0; + QWindow *containing = nullptr; for (QWindow *w : wl) { if (w->type() != Qt::Desktop && w->isExposed() && w->geometry().contains(rect)) { containing = w; diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp index 869e9228cd..3a4494fc2e 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration.cpp @@ -79,7 +79,7 @@ template class QOffscreenEventDispatcher : public BaseEventDispatcher { public: - explicit QOffscreenEventDispatcher(QObject *parent = 0) + explicit QOffscreenEventDispatcher(QObject *parent = nullptr) : BaseEventDispatcher(parent) { } diff --git a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp index 92fc8aa57a..84991d751f 100644 --- a/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenintegration_x11.cpp @@ -206,7 +206,7 @@ QOffscreenX11GLXContext::QOffscreenX11GLXContext(QOffscreenX11Info *x11, QOpenGL if (d->format.renderableType() != QSurfaceFormat::OpenGL) return; - d->shareContext = 0; + d->shareContext = nullptr; if (context->shareHandle()) d->shareContext = static_cast(context->shareHandle())->d->context; @@ -216,9 +216,9 @@ QOffscreenX11GLXContext::QOffscreenX11GLXContext(QOffscreenX11Info *x11, QOpenGL if (config) { d->context = glXCreateNewContext(x11->display(), config, GLX_RGBA_TYPE, d->shareContext, true); if (!d->context && d->shareContext) { - d->shareContext = 0; + d->shareContext = nullptr; // re-try without a shared glx context - d->context = glXCreateNewContext(x11->display(), config, GLX_RGBA_TYPE, 0, true); + d->context = glXCreateNewContext(x11->display(), config, GLX_RGBA_TYPE, nullptr, true); } // Get the basic surface format details @@ -234,8 +234,8 @@ QOffscreenX11GLXContext::QOffscreenX11GLXContext(QOffscreenX11Info *x11, QOpenGL d->context = glXCreateContext(x11->display(), visualInfo, d->shareContext, true); if (!d->context && d->shareContext) { // re-try without a shared glx context - d->shareContext = 0; - d->context = glXCreateContext(x11->display(), visualInfo, 0, true); + d->shareContext = nullptr; + d->context = glXCreateContext(x11->display(), visualInfo, nullptr, true); } d->window = createDummyWindow(x11, visualInfo); @@ -269,7 +269,7 @@ bool QOffscreenX11GLXContext::makeCurrent(QPlatformSurface *surface) void QOffscreenX11GLXContext::doneCurrent() { - glXMakeCurrent(d->x11->display(), 0, 0); + glXMakeCurrent(d->x11->display(), 0, nullptr); } void QOffscreenX11GLXContext::swapBuffers(QPlatformSurface *) diff --git a/src/plugins/platforms/offscreen/qoffscreenwindow.cpp b/src/plugins/platforms/offscreen/qoffscreenwindow.cpp index 832e94034d..53880c877e 100644 --- a/src/plugins/platforms/offscreen/qoffscreenwindow.cpp +++ b/src/plugins/platforms/offscreen/qoffscreenwindow.cpp @@ -69,7 +69,7 @@ QOffscreenWindow::QOffscreenWindow(QWindow *window) QOffscreenWindow::~QOffscreenWindow() { if (QOffscreenScreen::windowContainingCursor == this) - QOffscreenScreen::windowContainingCursor = 0; + QOffscreenScreen::windowContainingCursor = nullptr; m_windowForWinIdHash.remove(m_winId); } -- cgit v1.2.3