aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsapi/qjsvalue.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 10:41:54 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 07:13:18 +0000
commit499ec43937e926e4f2fa57a9baa455fcb3862262 (patch)
tree206c90d47387f8322b68f5e3db613189397e1af3 /src/qml/jsapi/qjsvalue.cpp
parent53d1e9ed21d25e65a2f13606af479838f5f21fe7 (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/qml/jsapi/qjsvalue.cpp')
-rw-r--r--src/qml/jsapi/qjsvalue.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index c4090ac482..b97468ab7b 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -662,7 +662,7 @@ QVariant QJSValue::toVariant() const
return QVariant(val->asDouble());
}
if (val->isNull())
- return QVariant(QMetaType::Nullptr, 0);
+ return QVariant(QMetaType::Nullptr, nullptr);
Q_ASSERT(val->isUndefined());
return QVariant();
}
@@ -831,7 +831,7 @@ QJSEngine* QJSValue::engine() const
QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (engine)
return engine->jsEngine();
- return 0;
+ return nullptr;
}
#endif // QT_DEPRECATED
@@ -884,7 +884,7 @@ void QJSValue::setPrototype(const QJSValue& prototype)
if (!val)
return;
if (val->isNull()) {
- o->setPrototype(0);
+ o->setPrototype(nullptr);
return;
}
@@ -1308,11 +1308,11 @@ QObject *QJSValue::toQObject() const
{
QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (!engine)
- return 0;
+ return nullptr;
QV4::Scope scope(engine);
QV4::Scoped<QV4::QObjectWrapper> wrapper(scope, QJSValuePrivate::getValue(this));
if (!wrapper)
- return 0;
+ return nullptr;
return wrapper->object();
}
@@ -1329,11 +1329,11 @@ const QMetaObject *QJSValue::toQMetaObject() const
{
QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this);
if (!engine)
- return 0;
+ return nullptr;
QV4::Scope scope(engine);
QV4::Scoped<QV4::QMetaObjectWrapper> wrapper(scope, QJSValuePrivate::getValue(this));
if (!wrapper)
- return 0;
+ return nullptr;
return wrapper->metaObject();
}
@@ -1389,7 +1389,7 @@ bool QJSValue::isRegExp() const
bool QJSValue::isQObject() const
{
QV4::Value *val = QJSValuePrivate::getValue(this);
- return val && val->as<QV4::QObjectWrapper>() != 0;
+ return val && val->as<QV4::QObjectWrapper>() != nullptr;
}
/*!
@@ -1403,7 +1403,7 @@ bool QJSValue::isQObject() const
bool QJSValue::isQMetaObject() const
{
QV4::Value *val = QJSValuePrivate::getValue(this);
- return val && val->as<QV4::QMetaObjectWrapper>() != 0;
+ return val && val->as<QV4::QMetaObjectWrapper>() != nullptr;
}
QT_END_NAMESPACE