diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-21 10:41:54 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-02-26 07:13:18 +0000 |
commit | 499ec43937e926e4f2fa57a9baa455fcb3862262 (patch) | |
tree | 206c90d47387f8322b68f5e3db613189397e1af3 /src/quick/items/context2d/qquickcontext2d.cpp | |
parent | 53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff) |
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where
we are assigning or testing a pointer rather than a numeric zero.
Also, replaced cases where 0 was passed as Qt::KeyboardModifiers
with Qt::NoModifier (clang-tidy replaced them with nullptr, which
waas wrong, so it was just as well to make the tests more readable
rather than to revert those lines).
Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/items/context2d/qquickcontext2d.cpp')
-rw-r--r-- | src/quick/items/context2d/qquickcontext2d.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 434765aaa1..af8048f2e4 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -641,7 +641,7 @@ public: o->defineDefaultProperty(QStringLiteral("createLinearGradient"), method_createLinearGradient, 0); o->defineDefaultProperty(QStringLiteral("strokeRect"), method_strokeRect, 0); o->defineDefaultProperty(QStringLiteral("closePath"), method_closePath, 0); - o->defineAccessorProperty(QStringLiteral("canvas"), QQuickJSContext2DPrototype::method_get_canvas, 0); + o->defineAccessorProperty(QStringLiteral("canvas"), QQuickJSContext2DPrototype::method_get_canvas, nullptr); return o->d(); } @@ -943,9 +943,9 @@ void QV4::Heap::QQuickJSContext2DImageData::init() QV4::Scope scope(internalClass->engine); QV4::ScopedObject o(scope, this); - o->defineAccessorProperty(QStringLiteral("width"), ::QQuickJSContext2DImageData::method_get_width, 0); - o->defineAccessorProperty(QStringLiteral("height"), ::QQuickJSContext2DImageData::method_get_height, 0); - o->defineAccessorProperty(QStringLiteral("data"), ::QQuickJSContext2DImageData::method_get_data, 0); + o->defineAccessorProperty(QStringLiteral("width"), ::QQuickJSContext2DImageData::method_get_width, nullptr); + o->defineAccessorProperty(QStringLiteral("height"), ::QQuickJSContext2DImageData::method_get_height, nullptr); + o->defineAccessorProperty(QStringLiteral("data"), ::QQuickJSContext2DImageData::method_get_data, nullptr); } DEFINE_OBJECT_VTABLE(QQuickJSContext2DImageData); @@ -4051,10 +4051,10 @@ QMutex QQuickContext2D::mutex; QQuickContext2D::QQuickContext2D(QObject *parent) : QQuickCanvasContext(parent) , m_buffer(new QQuickContext2DCommandBuffer) - , m_v4engine(0) - , m_surface(0) - , m_glContext(0) - , m_thread(0) + , m_v4engine(nullptr) + , m_surface(nullptr) + , m_glContext(nullptr) + , m_thread(nullptr) , m_grabbed(false) { } @@ -4062,7 +4062,7 @@ QQuickContext2D::QQuickContext2D(QObject *parent) QQuickContext2D::~QQuickContext2D() { mutex.lock(); - m_texture->setItem(0); + m_texture->setItem(nullptr); delete m_buffer; if (m_renderTarget == QQuickCanvasItem::FramebufferObject) { @@ -4242,7 +4242,7 @@ QImage QQuickContext2D::toImage(const QRectF& bounds) } else { #if QT_CONFIG(opengl) QQuickWindow *window = m_canvas->window(); - QOpenGLContext *ctx = window ? window->openglContext() : 0; + QOpenGLContext *ctx = window ? window->openglContext() : nullptr; if (ctx && ctx->isValid()) { if (ctx == QOpenGLContext::currentContext()) { flush(); @@ -4310,7 +4310,7 @@ QQuickContext2DEngineData::QQuickContext2DEngineData(QV4::ExecutionEngine *v4) gradientProto = proto; proto = scope.engine->newObject(); - proto->defineAccessorProperty(scope.engine->id_length(), QQuickJSContext2DPixelData::proto_get_length, 0); + proto->defineAccessorProperty(scope.engine->id_length(), QQuickJSContext2DPixelData::proto_get_length, nullptr); pixelArrayProto = proto; } @@ -4394,7 +4394,7 @@ void QQuickContext2D::setV4Engine(QV4::ExecutionEngine *engine) if (m_v4engine != engine) { m_v4engine = engine; - if (m_v4engine == 0) + if (m_v4engine == nullptr) return; QQuickContext2DEngineData *ed = engineData(engine); |