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/qquickview.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/qquickview.cpp')
-rw-r--r-- | src/quick/items/qquickview.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index ff9789ad57..1ac6c768e8 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -76,7 +76,7 @@ void QQuickViewPrivate::init(QQmlEngine* e) } QQuickViewPrivate::QQuickViewPrivate() - : root(0), component(0), resizeMode(QQuickView::SizeViewToRootObject), initialSize(0,0) + : root(nullptr), component(nullptr), resizeMode(QQuickView::SizeViewToRootObject), initialSize(0,0) { } @@ -94,11 +94,11 @@ void QQuickViewPrivate::execute() if (root) { delete root; - root = 0; + root = nullptr; } if (component) { delete component; - component = 0; + component = nullptr; } if (!source.isEmpty()) { QML_MEMORY_SCOPE_URL(engine.data()->baseUrl().resolved(source)); @@ -216,7 +216,7 @@ QQuickView::~QQuickView() // be a child of the QQuickViewPrivate, and will be destroyed by its dtor Q_D(QQuickView); delete d->root; - d->root = 0; + d->root = nullptr; } /*! @@ -260,7 +260,7 @@ void QQuickView::setContent(const QUrl& url, QQmlComponent *component, QObject* if (d->component && d->component->isError()) { const QList<QQmlError> errorList = d->component->errors(); for (const QQmlError &error : errorList) { - QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning() << error; } emit statusChanged(status()); @@ -289,7 +289,7 @@ QUrl QQuickView::source() const QQmlEngine* QQuickView::engine() const { Q_D(const QQuickView); - return d->engine ? const_cast<QQmlEngine *>(d->engine.data()) : 0; + return d->engine ? const_cast<QQmlEngine *>(d->engine.data()) : nullptr; } /*! @@ -302,7 +302,7 @@ QQmlEngine* QQuickView::engine() const QQmlContext* QQuickView::rootContext() const { Q_D(const QQuickView); - return d->engine ? d->engine.data()->rootContext() : 0; + return d->engine ? d->engine.data()->rootContext() : nullptr; } /*! @@ -471,7 +471,7 @@ void QQuickView::continueExecute() if (d->component->isError()) { const QList<QQmlError> errorList = d->component->errors(); for (const QQmlError &error : errorList) { - QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning() << error; } emit statusChanged(status()); @@ -483,7 +483,7 @@ void QQuickView::continueExecute() if (d->component->isError()) { const QList<QQmlError> errorList = d->component->errors(); for (const QQmlError &error : errorList) { - QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning() << error; } emit statusChanged(status()); @@ -517,7 +517,7 @@ void QQuickViewPrivate::setRootObject(QObject *obj) << "Ensure your QML code is written for QtQuick 2, and uses a root that is or" << endl << "inherits from QtQuick's Item (not a Timer, QtObject, etc)." << endl; delete obj; - root = 0; + root = nullptr; } if (root) { initialSize = rootObjectSize(); |