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/qquickmultipointtoucharea.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/qquickmultipointtoucharea.cpp')
-rw-r--r-- | src/quick/items/qquickmultipointtoucharea.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index 514d0f5d37..dc168073e4 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -541,7 +541,7 @@ void QQuickMultiPointTouchArea::touchEvent(QTouchEvent *event) case QEvent::TouchEnd: { //if e.g. a parent Flickable has the mouse grab, don't process the touch events QQuickWindow *c = window(); - QQuickItem *grabber = c ? c->mouseGrabberItem() : 0; + QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr; if (grabber && grabber != this && grabber->keepMouseGrab() && grabber->isEnabled()) { QQuickItem *item = this; while ((item = item->parentItem())) { @@ -719,7 +719,7 @@ void QQuickMultiPointTouchArea::clearTouchLists() void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) { - QQuickTouchPoint *dtp = 0; + QQuickTouchPoint *dtp = nullptr; for (QQuickTouchPoint* tp : qAsConst(_touchPrototypes)) { if (!tp->inUse()) { tp->setInUse(true); @@ -728,7 +728,7 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) } } - if (dtp == 0) + if (dtp == nullptr) dtp = new QQuickTouchPoint(false); dtp->setPointId(p->id()); updateTouchPoint(dtp,p); @@ -739,7 +739,7 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e) { - QQuickTouchPoint *dtp = 0; + QQuickTouchPoint *dtp = nullptr; for (QQuickTouchPoint *tp : qAsConst(_touchPrototypes)) if (!tp->inUse()) { tp->setInUse(true); @@ -747,7 +747,7 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e) break; } - if (dtp == 0) + if (dtp == nullptr) dtp = new QQuickTouchPoint(false); updateTouchPoint(dtp, e); dtp->setPressed(true); @@ -920,7 +920,7 @@ bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event) QPointF localPos = mapFromScene(event->windowPos()); QQuickWindow *c = window(); - QQuickItem *grabber = c ? c->mouseGrabberItem() : 0; + QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr; bool stealThisEvent = _stealMouse; if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) { QMouseEvent mouseEvent(event->type(), localPos, event->windowPos(), event->screenPos(), @@ -944,7 +944,7 @@ bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event) default: break; } - grabber = c ? c->mouseGrabberItem() : 0; + grabber = c ? c->mouseGrabberItem() : nullptr; if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) grabMouse(); @@ -991,7 +991,7 @@ bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *receiver, QEve bool QQuickMultiPointTouchArea::shouldFilter(QEvent *event) { QQuickWindow *c = window(); - QQuickItem *grabber = c ? c->mouseGrabberItem() : 0; + QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr; bool disabledItem = grabber && !grabber->isEnabled(); bool stealThisEvent = _stealMouse; bool containsPoint = false; @@ -1032,7 +1032,7 @@ QSGNode *QQuickMultiPointTouchArea::updatePaintNode(QSGNode *oldNode, UpdatePain Q_UNUSED(data); if (!qmlVisualTouchDebugging()) - return 0; + return nullptr; QSGInternalRectangleNode *rectangle = static_cast<QSGInternalRectangleNode *>(oldNode); if (!rectangle) rectangle = QQuickItemPrivate::get(this)->sceneGraphContext()->createInternalRectangleNode(); |