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/qquickdrag.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/qquickdrag.cpp')
-rw-r--r-- | src/quick/items/qquickdrag.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index 6dc005a03c..d377b1dad4 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -67,8 +67,8 @@ public: return static_cast<QQuickDragAttachedPrivate *>(QObjectPrivate::get(attached)); } QQuickDragAttachedPrivate() - : attachedItem(0) - , mimeData(0) + : attachedItem(nullptr) + , mimeData(nullptr) , proposedAction(Qt::MoveAction) , supportedActions(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction) , active(false) @@ -231,7 +231,7 @@ void QQuickDragAttachedPrivate::deliverLeaveEvent() if (window) { QDragLeaveEvent event; deliverEvent(window, &event); - window = 0; + window = nullptr; } } @@ -686,7 +686,7 @@ int QQuickDragAttached::drop() return acceptedAction; d->active = false; - QObject *target = 0; + QObject *target = nullptr; if (d->window) { QPoint scenePos = d->attachedItem->mapToScene(d->hotSpot).toPoint(); @@ -732,7 +732,7 @@ void QQuickDragAttached::cancel() d->deliverLeaveEvent(); if (d->target) { - d->target = 0; + d->target = nullptr; emit targetChanged(); } @@ -783,7 +783,7 @@ Qt::DropAction QQuickDragAttachedPrivate::startDrag(Qt::DropActions supportedAct deliverLeaveEvent(); if (target) { - target = 0; + target = nullptr; emit q->targetChanged(); } @@ -836,7 +836,7 @@ void QQuickDragAttached::startDrag(QQmlV4Function *args) } QQuickDrag::QQuickDrag(QObject *parent) -: QObject(parent), _target(0), _axis(XAndYAxis), _xmin(-FLT_MAX), +: QObject(parent), _target(nullptr), _axis(XAndYAxis), _xmin(-FLT_MAX), _xmax(FLT_MAX), _ymin(-FLT_MAX), _ymax(FLT_MAX), _active(false), _filterChildren(false), _smoothed(true), _threshold(QGuiApplication::styleHints()->startDragDistance()) { @@ -861,9 +861,9 @@ void QQuickDrag::setTarget(QQuickItem *t) void QQuickDrag::resetTarget() { - if (_target == 0) + if (_target == nullptr) return; - _target = 0; + _target = nullptr; emit targetChanged(); } |