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 /tests/auto | |
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 'tests/auto')
129 files changed, 3281 insertions, 3281 deletions
diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp index 476ad2e955..bb7e50dbbd 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp @@ -848,7 +848,7 @@ void tst_QParallelAnimationGroupJob::addAndRemoveDuration() QCOMPARE(group.duration(), 250); group.removeAnimation(test); // remove the last one (with duration = 250) - QCOMPARE(test->group(), static_cast<QAnimationGroupJob*>(0)); + QCOMPARE(test->group(), static_cast<QAnimationGroupJob*>(nullptr)); QCOMPARE(group.duration(), 0); delete test; } diff --git a/tests/auto/qml/bindingdependencyapi/tst_bindingdependencyapi.cpp b/tests/auto/qml/bindingdependencyapi/tst_bindingdependencyapi.cpp index 6f24f85f6d..82c997a5b8 100644 --- a/tests/auto/qml/bindingdependencyapi/tst_bindingdependencyapi.cpp +++ b/tests/auto/qml/bindingdependencyapi/tst_bindingdependencyapi.cpp @@ -131,7 +131,7 @@ void tst_bindingdependencyapi::testSingleDep() c.setData(code, QUrl()); QObject *rect = c.create(); QTest::qWait(10); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QObject *text = rect->findChildren<QQuickText *>().front(); QObject *referencedObject = rect->objectName() == referencedObjectName ? rect : rect->findChild<QObject *>(referencedObjectName); @@ -213,7 +213,7 @@ void tst_bindingdependencyapi::testManyDeps() qWarning() << c.errorString(); } QTest::qWait(100); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QObject *text = rect->findChildren<QQuickText *>().front(); QObject *configObj = rect->findChild<QObject *>("config"); @@ -290,7 +290,7 @@ void tst_bindingdependencyapi::testConditionalDependencies() c.setData(code, QUrl()); QObject *rect = c.create(); QTest::qWait(10); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QObject *text = rect->findChildren<QQuickText *>().front(); QObject *referencedObject = rect->objectName() == referencedObjectName ? rect : rect->findChild<QObject *>(referencedObjectName); @@ -336,7 +336,7 @@ void tst_bindingdependencyapi::testBindingLoop() qWarning() << c.errorString(); } QTest::qWait(100); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QObject *text = rect->findChildren<QQuickText *>().front(); auto data = QQmlData::get(text); diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp index cadc2a7cc4..21ca921304 100644 --- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp @@ -60,7 +60,7 @@ private slots: void tst_QPacketProtocol::init() { m_server = new QTcpServer(this); - m_serverConn = 0; + m_serverConn = nullptr; QVERIFY(m_server->listen(QHostAddress("127.0.0.1"))); m_client = new QTcpSocket(this); diff --git a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp index 04bc5c3c1a..452520cf11 100644 --- a/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp +++ b/tests/auto/qml/debugger/qqmldebugclient/tst_qqmldebugclient.cpp @@ -72,11 +72,11 @@ void tst_QQmlDebugClient::initTestCase() m_service = new QQmlDebugTestService("tst_QQmlDebugClient::handshake()"); foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) - QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)nullptr); foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) - QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)nullptr); foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) - QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)nullptr); const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT); QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData()); @@ -126,7 +126,7 @@ void tst_QQmlDebugClient::state() QQmlDebugClient client2("tst_QQmlDebugClient::state()", m_conn); QCOMPARE(client2.state(), QQmlDebugClient::NotConnected); - QQmlDebugClient client3("tst_QQmlDebugClient::state3()", 0); + QQmlDebugClient client3("tst_QQmlDebugClient::state3()", nullptr); QCOMPARE(client3.state(), QQmlDebugClient::NotConnected); } diff --git a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp index 4b28857fc0..9f0501241d 100644 --- a/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp +++ b/tests/auto/qml/debugger/qqmldebuglocal/tst_qqmldebuglocal.cpp @@ -64,7 +64,7 @@ private slots: void tst_QQmlDebugLocal::initTestCase() { - fileName = QString::fromLatin1("tst_QQmlDebugLocal%1").arg(std::time(0)); + fileName = QString::fromLatin1("tst_QQmlDebugLocal%1").arg(std::time(nullptr)); QQmlDebugConnector::setPluginKey("QQmlDebugServer"); QTest::ignoreMessage(QtWarningMsg, "QML debugger: Cannot set plugin key after loading the plugin."); @@ -119,7 +119,7 @@ void tst_QQmlDebugLocal::state() QQmlDebugClient client2("tst_QQmlDebugLocal::state()", m_conn); QCOMPARE(client2.state(), QQmlDebugClient::NotConnected); - QQmlDebugClient client3("tst_QQmlDebugLocal::state3()", 0); + QQmlDebugClient client3("tst_QQmlDebugLocal::state3()", nullptr); QCOMPARE(client3.state(), QQmlDebugClient::NotConnected); } diff --git a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp index 4e103e9a65..1daf6b581e 100644 --- a/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp +++ b/tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp @@ -80,11 +80,11 @@ void tst_QQmlDebugService::initTestCase() m_service = new QQmlDebugTestService("tst_QQmlDebugService", 2); foreach (const QString &service, QQmlDebuggingEnabler::debuggerServices()) - QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)nullptr); foreach (const QString &service, QQmlDebuggingEnabler::inspectorServices()) - QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)nullptr); foreach (const QString &service, QQmlDebuggingEnabler::profilerServices()) - QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)0); + QCOMPARE(QQmlDebugConnector::instance()->service(service), (QQmlDebugService *)nullptr); const QString waitingMsg = QString("QML Debugger: Waiting for connection on port %1...").arg(PORT); QTest::ignoreMessage(QtDebugMsg, waitingMsg.toLatin1().constData()); @@ -209,7 +209,7 @@ void tst_QQmlDebugService::checkSupportForDataStreamVersion() void tst_QQmlDebugService::idForObject() { - QCOMPARE(QQmlDebugService::idForObject(0), -1); + QCOMPARE(QQmlDebugService::idForObject(nullptr), -1); QObject *objA = new QObject; @@ -231,15 +231,15 @@ void tst_QQmlDebugService::idForObject() void tst_QQmlDebugService::objectForId() { - QCOMPARE(QQmlDebugService::objectForId(-1), static_cast<QObject*>(0)); - QCOMPARE(QQmlDebugService::objectForId(1), static_cast<QObject*>(0)); + QCOMPARE(QQmlDebugService::objectForId(-1), static_cast<QObject*>(nullptr)); + QCOMPARE(QQmlDebugService::objectForId(1), static_cast<QObject*>(nullptr)); QObject *obj = new QObject; int id = QQmlDebugService::idForObject(obj); QCOMPARE(QQmlDebugService::objectForId(id), obj); delete obj; - QCOMPARE(QQmlDebugService::objectForId(id), static_cast<QObject*>(0)); + QCOMPARE(QQmlDebugService::objectForId(id), static_cast<QObject*>(nullptr)); } void tst_QQmlDebugService::checkSupportForOldDataStreamVersion() diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp index 8993ce7cf4..d01d9a6791 100644 --- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp @@ -77,7 +77,7 @@ class CustomTypes : public QObject Q_OBJECT Q_PROPERTY(QModelIndex modelIndex READ modelIndex) public: - CustomTypes(QObject *parent = 0) : QObject(parent) {} + CustomTypes(QObject *parent = nullptr) : QObject(parent) {} QModelIndex modelIndex() { return QModelIndex(); } }; @@ -86,7 +86,7 @@ class tst_QQmlEngineDebugService : public QObject { Q_OBJECT public: - tst_QQmlEngineDebugService() : m_conn(0), m_dbg(0), m_engine(0), m_rootItem(0) {} + tst_QQmlEngineDebugService() : m_conn(nullptr), m_dbg(nullptr), m_engine(nullptr), m_rootItem(nullptr) {} private: QmlDebugObjectReference findRootObject(int context = 0, @@ -445,7 +445,7 @@ void tst_QQmlEngineDebugService::watch_property() bool success; - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); unconnected->addWatch(prop, &success); QVERIFY(!success); delete unconnected; @@ -489,7 +489,7 @@ void tst_QQmlEngineDebugService::watch_object() bool success; - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); unconnected->addWatch(obj, &success); QVERIFY(!success); delete unconnected; @@ -555,7 +555,7 @@ void tst_QQmlEngineDebugService::watch_expression() bool success; - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); unconnected->addWatch(obj, expr, &success); QVERIFY(!success); delete unconnected; @@ -630,7 +630,7 @@ void tst_QQmlEngineDebugService::queryAvailableEngines() { bool success; - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); unconnected->queryAvailableEngines(&success); QVERIFY(!success); delete unconnected; @@ -658,7 +658,7 @@ void tst_QQmlEngineDebugService::queryRootContexts() QVERIFY(m_dbg->engines().count()); int engineId = m_dbg->engines()[0].debugId; - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); unconnected->queryRootContexts(engineId, &success); QVERIFY(!success); delete unconnected; @@ -689,7 +689,7 @@ void tst_QQmlEngineDebugService::queryObject() QmlDebugObjectReference rootObject = findRootObject(); QVERIFY(!rootObject.className.isEmpty()); - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); recursive ? unconnected->queryObjectRecursive(rootObject, &success) : unconnected->queryObject(rootObject, &success); QVERIFY(!success); delete unconnected; @@ -761,7 +761,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() int lineNumber = rootObject.source.lineNumber; int columnNumber = rootObject.source.columnNumber; - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); recursive ? unconnected->queryObjectsForLocationRecursive(fileName, lineNumber, columnNumber, &success) : unconnected->queryObjectsForLocation(fileName, lineNumber, @@ -898,7 +898,7 @@ void tst_QQmlEngineDebugService::queryObjectWithNonStreamableTypes() QmlDebugObjectReference rootObject = findRootObject(4, true); QVERIFY(!rootObject.className.isEmpty()); - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); unconnected->queryObject(rootObject, &success); QVERIFY(!success); delete unconnected; @@ -924,7 +924,7 @@ void tst_QQmlEngineDebugService::queryExpressionResult() bool success; - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); unconnected->queryExpressionResult(objectId, expr, &success); QVERIFY(!success); delete unconnected; @@ -972,7 +972,7 @@ void tst_QQmlEngineDebugService::queryExpressionResultBC() bool success; - QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(0); + QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); unconnected->queryExpressionResultBC(objectId, expr, &success); QVERIFY(!success); delete unconnected; diff --git a/tests/auto/qml/debugger/qqmlnativeconnector/tst_qqmlnativeconnector.cpp b/tests/auto/qml/debugger/qqmlnativeconnector/tst_qqmlnativeconnector.cpp index 33d3c6369f..6283a93881 100644 --- a/tests/auto/qml/debugger/qqmlnativeconnector/tst_qqmlnativeconnector.cpp +++ b/tests/auto/qml/debugger/qqmlnativeconnector/tst_qqmlnativeconnector.cpp @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) argv2[i] = argv[i]; argv2[argc] = strdup("-qmljsdebugger=native,services:NativeQmlDebugger"); ++argc; - argv2[argc] = 0; + argv2[argc] = nullptr; Application app(argc, argv2); return QTest::qExec(&app, argc, argv); } diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index db28d3202d..cd8e4216f3 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -344,7 +344,7 @@ bool tst_QQmlProfilerService::verify(tst_QQmlProfilerService::MessageListType ty int expectedPosition, const QQmlProfilerEventType &expected, quint32 checks, const QVector<qint64> &expectedNumbers) { - const QVector<QQmlProfilerEvent> *target = 0; + const QVector<QQmlProfilerEvent> *target = nullptr; switch (type) { case MessageListQML: target = &(m_client->qmlMessages); break; case MessageListJavaScript: target = &(m_client->javascriptMessages); break; diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp index b569ad6b3c..5dd62da15a 100644 --- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp @@ -166,7 +166,7 @@ public: , m_thrownValue(-1) , collector(engine) , m_resumeSpeed(QV4Debugger::FullThrottle) - , m_debugger(0) + , m_debugger(nullptr) { } @@ -355,10 +355,10 @@ void tst_qv4debugger::cleanup() m_javaScriptThread->wait(); delete m_engine; delete m_javaScriptThread; - m_engine = 0; - m_v4 = 0; + m_engine = nullptr; + m_v4 = nullptr; delete m_debuggerAgent; - m_debuggerAgent = 0; + m_debuggerAgent = nullptr; } void tst_qv4debugger::breakAnywhere() diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 519c57efb2..b34aaea61c 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -615,10 +615,10 @@ void tst_QJSEngine::newQObject() QObject temp; { - QJSValue qobject = eng.newQObject(0); + QJSValue qobject = eng.newQObject(nullptr); QCOMPARE(qobject.isNull(), true); QCOMPARE(qobject.isObject(), false); - QCOMPARE(qobject.toQObject(), (QObject *)0); + QCOMPARE(qobject.toQObject(), (QObject *)nullptr); } { QJSValue qobject = eng.newQObject(&temp); @@ -639,7 +639,7 @@ void tst_QJSEngine::newQObject_ownership() QJSEngine eng; { QPointer<QObject> ptr = new QObject(); - QVERIFY(ptr != 0); + QVERIFY(ptr != nullptr); { QJSValue v = eng.newQObject(ptr); } @@ -650,7 +650,7 @@ void tst_QJSEngine::newQObject_ownership() } { QPointer<QObject> ptr = new QObject(this); - QVERIFY(ptr != 0); + QVERIFY(ptr != nullptr); { QJSValue v = eng.newQObject(ptr); } @@ -665,11 +665,11 @@ void tst_QJSEngine::newQObject_ownership() QJSValue v = eng.newQObject(child); QCOMPARE(v.toQObject(), child); delete parent; - QCOMPARE(v.toQObject(), (QObject *)0); + QCOMPARE(v.toQObject(), (QObject *)nullptr); } { QPointer<QObject> ptr = new QObject(); - QVERIFY(ptr != 0); + QVERIFY(ptr != nullptr); { QJSValue v = eng.newQObject(ptr); } @@ -682,18 +682,18 @@ void tst_QJSEngine::newQObject_ownership() { QObject *parent = new QObject(); QPointer<QObject> child = new QObject(parent); - QVERIFY(child != 0); + QVERIFY(child != nullptr); { QJSValue v = eng.newQObject(child); } eng.collectGarbage(); // has parent, so it should be like QtOwnership - QVERIFY(child != 0); + QVERIFY(child != nullptr); delete parent; } { QPointer<QObject> ptr = new QObject(); - QVERIFY(ptr != 0); + QVERIFY(ptr != nullptr); { QQmlEngine::setObjectOwnership(ptr.data(), QQmlEngine::CppOwnership); QJSValue v = eng.newQObject(ptr); @@ -1377,7 +1377,7 @@ void tst_QJSEngine::valueConversion_basic() QCOMPARE(eng.fromScriptValue<QChar>(eng.toScriptValue(c)), c); } - QVERIFY(eng.toScriptValue(static_cast<void *>(0)).isNull()); + QVERIFY(eng.toScriptValue(static_cast<void *>(nullptr)).isNull()); } void tst_QJSEngine::valueConversion_QVariant() @@ -1463,7 +1463,7 @@ void tst_QJSEngine::valueConversion_QVariant() QCOMPARE(qjsvalue_cast<QVariant>(QJSValue(123)), QVariant(123)); - QVERIFY(eng.toScriptValue(QVariant(QMetaType::VoidStar, 0)).isNull()); + QVERIFY(eng.toScriptValue(QVariant(QMetaType::VoidStar, nullptr)).isNull()); QVERIFY(eng.toScriptValue(QVariant::fromValue(nullptr)).isNull()); { @@ -1574,7 +1574,7 @@ class Klazz : public QWidget, Q_INTERFACES(QGraphicsItem) Q_OBJECT public: - Klazz(QWidget *parent = 0) : QWidget(parent) { } + Klazz(QWidget *parent = nullptr) : QWidget(parent) { } virtual QRectF boundingRect() const { return QRectF(); } virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) { } }; @@ -1603,7 +1603,7 @@ void tst_QJSEngine::collectGarbage() a = eng.newObject(); a = eng.newObject(); QPointer<QObject> ptr = new QObject(); - QVERIFY(ptr != 0); + QVERIFY(ptr != nullptr); (void)eng.newQObject(ptr); eng.collectGarbage(); if (ptr) @@ -3372,7 +3372,7 @@ void tst_QJSEngine::dynamicProperties() QQmlEngine qmlEngine; QQmlComponent component(&qmlEngine); component.setData("import QtQml 2.0; QtObject { property QtObject subObject: QtObject {} }", QUrl()); - QObject *root = component.create(0); + QObject *root = component.create(nullptr); QVERIFY(root); QVERIFY(qmlContext(root)); diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp index db99c44261..6587408ae4 100644 --- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp +++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp @@ -30,7 +30,7 @@ #include <QtWidgets/QPushButton> tst_QJSValue::tst_QJSValue() - : engine(0) + : engine(nullptr) { } @@ -45,7 +45,7 @@ void tst_QJSValue::ctor_invalid() { QJSValue v; QVERIFY(v.isUndefined()); - QCOMPARE(v.engine(), (QJSEngine *)0); + QCOMPARE(v.engine(), (QJSEngine *)nullptr); } } @@ -111,7 +111,7 @@ void tst_QJSValue::ctor_int() QCOMPARE(v.isNumber(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toNumber(), 1.0); - QCOMPARE(v.engine(), (QJSEngine *)0); + QCOMPARE(v.engine(), (QJSEngine *)nullptr); } } @@ -141,7 +141,7 @@ void tst_QJSValue::ctor_uint() QCOMPARE(v.isNumber(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toNumber(), 1.0); - QCOMPARE(v.engine(), (QJSEngine *)0); + QCOMPARE(v.engine(), (QJSEngine *)nullptr); } } @@ -171,7 +171,7 @@ void tst_QJSValue::ctor_float() QCOMPARE(v.isNumber(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toNumber(), 1.0); - QCOMPARE(v.engine(), (QJSEngine *)0); + QCOMPARE(v.engine(), (QJSEngine *)nullptr); } } @@ -196,7 +196,7 @@ void tst_QJSValue::ctor_string() QCOMPARE(v.isString(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toString(), QLatin1String("ciao")); - QCOMPARE(v.engine(), (QJSEngine *)0); + QCOMPARE(v.engine(), (QJSEngine *)nullptr); } { QJSValue v("ciao"); @@ -204,7 +204,7 @@ void tst_QJSValue::ctor_string() QCOMPARE(v.isString(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toString(), QLatin1String("ciao")); - QCOMPARE(v.engine(), (QJSEngine *)0); + QCOMPARE(v.engine(), (QJSEngine *)nullptr); } } @@ -246,7 +246,7 @@ void tst_QJSValue::ctor_undefined() QJSValue v(QJSValue::UndefinedValue); QVERIFY(v.isUndefined()); QCOMPARE(v.isObject(), false); - QCOMPARE(v.engine(), (QJSEngine *)0); + QCOMPARE(v.engine(), (QJSEngine *)nullptr); } void tst_QJSValue::ctor_null() @@ -255,7 +255,7 @@ void tst_QJSValue::ctor_null() QVERIFY(!v.isUndefined()); QCOMPARE(v.isNull(), true); QCOMPARE(v.isObject(), false); - QCOMPARE(v.engine(), (QJSEngine *)0); + QCOMPARE(v.engine(), (QJSEngine *)nullptr); } void tst_QJSValue::ctor_bool() @@ -266,7 +266,7 @@ void tst_QJSValue::ctor_bool() QCOMPARE(v.isBool(), true); QCOMPARE(v.isObject(), false); QCOMPARE(v.toBool(), false); - QCOMPARE(v.engine(), (QJSEngine *)0); + QCOMPARE(v.engine(), (QJSEngine *)nullptr); } void tst_QJSValue::ctor_copyAndAssign() @@ -274,12 +274,12 @@ void tst_QJSValue::ctor_copyAndAssign() QJSValue v(1.0); QJSValue v2(v); QCOMPARE(v2.strictlyEquals(v), true); - QCOMPARE(v2.engine(), (QJSEngine *)0); + QCOMPARE(v2.engine(), (QJSEngine *)nullptr); QJSValue v3(v); QCOMPARE(v3.strictlyEquals(v), true); QCOMPARE(v3.strictlyEquals(v2), true); - QCOMPARE(v3.engine(), (QJSEngine *)0); + QCOMPARE(v3.engine(), (QJSEngine *)nullptr); QJSValue v4(2.0); QCOMPARE(v4.strictlyEquals(v), false); @@ -1107,16 +1107,16 @@ void tst_QJSValue::toQObject_nonQObject_data() QTest::newRow("array") << engine->newArray(); QTest::newRow("date") << engine->evaluate("new Date(124)"); QTest::newRow("variant(12345)") << engine->toScriptValue(QVariant(12345)); - QTest::newRow("variant((QObject*)0)") << engine->toScriptValue(qVariantFromValue((QObject*)0)); - QTest::newRow("newQObject(0)") << engine->newQObject(0); + QTest::newRow("variant((QObject*)0)") << engine->toScriptValue(qVariantFromValue((QObject*)nullptr)); + QTest::newRow("newQObject(0)") << engine->newQObject(nullptr); } void tst_QJSValue::toQObject_nonQObject() { QFETCH(QJSValue, value); - QCOMPARE(value.toQObject(), (QObject *)0); - QCOMPARE(qjsvalue_cast<QObject*>(value), (QObject *)0); + QCOMPARE(value.toQObject(), (QObject *)nullptr); + QCOMPARE(qjsvalue_cast<QObject*>(value), (QObject *)nullptr); } // unfortunately, this is necessary in order to do qscriptvalue_cast<QPushButton*>(...) @@ -1130,7 +1130,7 @@ void tst_QJSValue::toQObject() QJSValue qobject = eng.newQObject(&temp); QCOMPARE(qobject.toQObject(), (QObject *)&temp); QCOMPARE(qjsvalue_cast<QObject*>(qobject), (QObject *)&temp); - QCOMPARE(qjsvalue_cast<QWidget*>(qobject), (QWidget *)0); + QCOMPARE(qjsvalue_cast<QWidget*>(qobject), (QWidget *)nullptr); QWidget widget; QJSValue qwidget = eng.newQObject(&widget); @@ -1594,7 +1594,7 @@ void tst_QJSValue::getSetProperty() QCOMPARE(object.property("baz").toNumber(), num.toNumber()); QJSValue strstr = QJSValue("bar"); - QCOMPARE(strstr.engine(), (QJSEngine *)0); + QCOMPARE(strstr.engine(), (QJSEngine *)nullptr); object.setProperty("foo", strstr); QCOMPARE(object.property("foo").toString(), strstr.toString()); QCOMPARE(strstr.engine(), &eng); // the value has been bound to the engine @@ -2095,7 +2095,7 @@ void tst_QJSValue::equals() QJSValue qobj1 = eng.newQObject(&temp); QJSValue qobj2 = eng.newQObject(&temp); - QJSValue qobj3 = eng.newQObject(0); + QJSValue qobj3 = eng.newQObject(nullptr); // FIXME: No ScriptOwnership: QJSValue qobj4 = eng.newQObject(new QObject(), QScriptEngine::ScriptOwnership); QJSValue qobj4 = eng.newQObject(new QObject()); @@ -2281,7 +2281,7 @@ void tst_QJSValue::castToPointer() QColor c(123, 210, 231); QJSValue v = eng.toScriptValue(c); QColor *cp = qjsvalue_cast<QColor*>(v); - QVERIFY(cp != 0); + QVERIFY(cp != nullptr); QCOMPARE(*cp, c); QBrush *bp = qjsvalue_cast<QBrush*>(v); diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp index 4b485d2ce8..34cf21024d 100644 --- a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp +++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp @@ -65,10 +65,10 @@ void tst_qqmlbinding::binding() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("test-binding.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQmlBind *binding3 = qobject_cast<QQmlBind*>(rect->findChild<QQmlBind*>("binding3")); - QVERIFY(binding3 != 0); + QVERIFY(binding3 != nullptr); QCOMPARE(rect->color(), QColor("yellow")); QCOMPARE(rect->property("text").toString(), QString("Hello")); @@ -80,7 +80,7 @@ void tst_qqmlbinding::binding() QCOMPARE(binding3->when(), true); QQmlBind *binding = qobject_cast<QQmlBind*>(rect->findChild<QQmlBind*>("binding1")); - QVERIFY(binding != 0); + QVERIFY(binding != nullptr); QCOMPARE(binding->object(), qobject_cast<QObject*>(rect)); QCOMPARE(binding->property(), QLatin1String("text")); QCOMPARE(binding->value().toString(), QLatin1String("Hello")); @@ -94,7 +94,7 @@ void tst_qqmlbinding::whenAfterValue() QQmlComponent c(&engine, testFileUrl("test-binding2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(), QColor("yellow")); QCOMPARE(rect->property("text").toString(), QString("Hello")); @@ -109,10 +109,10 @@ void tst_qqmlbinding::restoreBinding() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("restoreBinding.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *myItem = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("myItem")); - QVERIFY(myItem != 0); + QVERIFY(myItem != nullptr); myItem->setY(25); QCOMPARE(myItem->x(), qreal(100-25)); @@ -139,10 +139,10 @@ void tst_qqmlbinding::restoreBindingWithLoop() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("restoreBindingWithLoop.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *myItem = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("myItem")); - QVERIFY(myItem != 0); + QVERIFY(myItem != nullptr); myItem->setY(25); QCOMPARE(myItem->x(), qreal(25 + 100)); @@ -175,10 +175,10 @@ void tst_qqmlbinding::restoreBindingWithoutCrash() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("restoreBindingWithoutCrash.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *myItem = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("myItem")); - QVERIFY(myItem != 0); + QVERIFY(myItem != nullptr); myItem->setY(25); QCOMPARE(myItem->x(), qreal(100-25)); @@ -215,9 +215,9 @@ void tst_qqmlbinding::deletedObject() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("deletedObject.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); - QGuiApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QGuiApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); //don't crash rect->setProperty("activateBinding", true); @@ -289,7 +289,7 @@ void tst_qqmlbinding::delayed() QQmlComponent c(&engine, testFileUrl("delayed.qml")); QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); // update on creation QCOMPARE(item->property("changeCount").toInt(), 1); diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index 105469fbcf..6a0dc28ca4 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -89,7 +89,7 @@ public slots: static void gc(QQmlEngine &engine) { engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } @@ -157,7 +157,7 @@ void tst_qqmlcomponent::qmlIncubateObject() { QQmlComponent component(&engine, testFileUrl("incubateObject.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), false); @@ -236,8 +236,8 @@ void tst_qqmlcomponent::qmlCreateObjectAutoParent() QCOMPARE(window_item->parent(), windowParent); QCOMPARE(window_window->parent(), windowParent); - QCOMPARE(qobject_cast<QQuickItem *>(qtobject_item)->parentItem(), (QQuickItem *)0); - QCOMPARE(qobject_cast<QQuickWindow *>(qtobject_window)->transientParent(), (QQuickWindow *)0); + QCOMPARE(qobject_cast<QQuickItem *>(qtobject_item)->parentItem(), (QQuickItem *)nullptr); + QCOMPARE(qobject_cast<QQuickWindow *>(qtobject_window)->transientParent(), (QQuickWindow *)nullptr); QCOMPARE(qobject_cast<QQuickItem *>(item_item)->parentItem(), itemParent); QCOMPARE(qobject_cast<QQuickWindow *>(item_window)->transientParent(), itemParent->window()); QCOMPARE(qobject_cast<QQuickItem *>(window_item)->parentItem(), windowParent->contentItem()); @@ -250,7 +250,7 @@ void tst_qqmlcomponent::qmlCreateObjectWithProperties() QQmlComponent component(&engine, testFileUrl("createObjectWithScript.qml")); QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *testObject1 = object->property("declarativerectangle").value<QObject*>(); QVERIFY(testObject1); @@ -301,7 +301,7 @@ void tst_qqmlcomponent::qmlCreateParentReference() QQmlComponent component(&engine, testFileUrl("createParentReference.qml")); QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(QMetaObject::invokeMethod(object, "createChild")); delete object; @@ -327,7 +327,7 @@ void tst_qqmlcomponent::async() QCOMPARE(watcher.error, 0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -348,7 +348,7 @@ void tst_qqmlcomponent::asyncHierarchy() QCOMPARE(watcher.error, 0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); // ensure that the parent-child relationship hierarchy is correct // (use QQuickItem* for all children rather than types which are not publicly exported) @@ -413,7 +413,7 @@ void tst_qqmlcomponent::componentUrlCanonicalization() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); } @@ -423,7 +423,7 @@ void tst_qqmlcomponent::componentUrlCanonicalization() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.2.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); } @@ -432,7 +432,7 @@ void tst_qqmlcomponent::componentUrlCanonicalization() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.3.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); } @@ -441,7 +441,7 @@ void tst_qqmlcomponent::componentUrlCanonicalization() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("componentUrlCanonicalization.4.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); } @@ -461,7 +461,7 @@ void tst_qqmlcomponent::onDestructionLookup() QQmlComponent component(&engine, testFileUrl("onDestructionLookup.qml")); QScopedPointer<QObject> object(component.create()); gc(engine); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); } @@ -477,7 +477,7 @@ void tst_qqmlcomponent::onDestructionCount() QTest::ignoreMessage(QtWarningMsg, warning.data()); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } // Warning should not be emitted any further @@ -487,7 +487,7 @@ void tst_qqmlcomponent::onDestructionCount() { QQmlTestMessageHandler messageHandler; - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); warnings = messageHandler.messages(); } @@ -505,7 +505,7 @@ void tst_qqmlcomponent::recursion() QTest::ignoreMessage(QtWarningMsg, QLatin1String("QQmlComponent: Component creation is recursing - aborting").data()); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Sub-object creation does not succeed QCOMPARE(object->property("success").toBool(), false); @@ -520,7 +520,7 @@ void tst_qqmlcomponent::recursionContinuation() QTest::ignoreMessage(QtWarningMsg, QLatin1String("QQmlComponent: Component creation is recursing - aborting").data()); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Eventual sub-object creation succeeds QVERIFY(object->property("success").toBool()); @@ -538,7 +538,7 @@ public: int value() const { return m_value; } void setValue(int v) { scopeObject.clear(); - callingContextData.setContextData(0); + callingContextData.setContextData(nullptr); m_value = v; QJSEngine *jsEngine = qjsEngine(this); diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index 22e9724c61..8ef00f8080 100644 --- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -70,7 +70,7 @@ void tst_qqmlconnections::defaultValues() QQmlComponent c(&engine, testFileUrl("test-connection3.qml")); QQmlConnections *item = qobject_cast<QQmlConnections*>(c.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QVERIFY(!item->target()); delete item; @@ -82,9 +82,9 @@ void tst_qqmlconnections::properties() QQmlComponent c(&engine, testFileUrl("test-connection2.qml")); QQmlConnections *item = qobject_cast<QQmlConnections*>(c.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->target(), item); delete item; @@ -96,7 +96,7 @@ void tst_qqmlconnections::connection() QQmlComponent c(&engine, testFileUrl("test-connection.qml")); QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->property("tested").toBool(), false); QCOMPARE(item->width(), 50.); @@ -113,7 +113,7 @@ void tst_qqmlconnections::trimming() QQmlComponent c(&engine, testFileUrl("trimming.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("tested").toString(), QString("")); int index = object->metaObject()->indexOfSignal("testMe(int,QString)"); @@ -133,7 +133,7 @@ void tst_qqmlconnections::targetChanged() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("connection-targetchange.qml")); QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QQmlConnections *connections = item->findChild<QQmlConnections*>("connections"); QVERIFY(connections); @@ -178,7 +178,7 @@ void tst_qqmlconnections::unknownSignals() QQmlEngine engine; QQmlComponent c(&engine, url); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // check that connection is created (they are all runtime errors) QQmlConnections *connections = object->findChild<QQmlConnections*>("connections"); @@ -222,7 +222,7 @@ class TestObject : public QObject Q_PROPERTY(bool ran READ ran WRITE setRan) public: - TestObject(QObject *parent = 0) : QObject(parent), m_ran(false) {} + TestObject(QObject *parent = nullptr) : QObject(parent), m_ran(false) {} ~TestObject() {} bool ran() const { return m_ran; } @@ -244,7 +244,7 @@ void tst_qqmlconnections::rewriteErrors() QQmlComponent c(&engine, testFileUrl("rewriteError-unnamed.qml")); QTest::ignoreMessage(QtWarningMsg, (c.url().toString() + ":5:35: QML Connections: Signal uses unnamed parameter followed by named parameter.").toLatin1()); TestObject *obj = qobject_cast<TestObject*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); obj->unnamedArgumentSignal(1, .5, "hello"); QCOMPARE(obj->ran(), false); @@ -256,7 +256,7 @@ void tst_qqmlconnections::rewriteErrors() QQmlComponent c(&engine, testFileUrl("rewriteError-global.qml")); QTest::ignoreMessage(QtWarningMsg, (c.url().toString() + ":5:35: QML Connections: Signal parameter \"parseInt\" hides global variable.").toLatin1()); TestObject *obj = qobject_cast<TestObject*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); obj->signalWithGlobalName(10); QCOMPARE(obj->ran(), false); @@ -272,7 +272,7 @@ Q_OBJECT Q_PROPERTY(int intProp READ intProp WRITE setIntProp NOTIFY intPropChanged) public: - MyTestSingletonType(QObject *parent = 0) : QObject(parent), m_intProp(0), m_changeCount(0) {} + MyTestSingletonType(QObject *parent = nullptr) : QObject(parent), m_intProp(0), m_changeCount(0) {} ~MyTestSingletonType() {} Q_INVOKABLE int otherMethod(int val) { return val + 4; } @@ -307,7 +307,7 @@ void tst_qqmlconnections::singletonTypeTarget() qmlRegisterSingletonType<MyTestSingletonType>("MyTestSingletonType", 1, 0, "Api", module_api_factory); QQmlComponent component(&engine, testFileUrl("singletontype-target.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("moduleIntPropChangedCount").toInt(), 0); QCOMPARE(object->property("moduleOtherSignalCount").toInt(), 0); @@ -333,7 +333,7 @@ void tst_qqmlconnections::enableDisable_QTBUG_36350() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("test-connection.qml")); QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QQmlConnections *connections = item->findChild<QQmlConnections*>("connections"); QVERIFY(connections); @@ -361,7 +361,7 @@ void tst_qqmlconnections::disabledAtStart() QQmlComponent c(&engine, testFileUrl("disabled-at-start.qml")); QObject * const object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("tested").toBool(), false); const int index = object->metaObject()->indexOfSignal("testMe()"); @@ -379,7 +379,7 @@ void tst_qqmlconnections::clearImplicitTarget() QQmlComponent c(&engine, testFileUrl("test-connection-implicit.qml")); QQuickItem *item = qobject_cast<QQuickItem*>(c.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); // normal case: fire Connections item->setWidth(100.); @@ -389,7 +389,7 @@ void tst_qqmlconnections::clearImplicitTarget() // clear the implicit target QQmlConnections *connections = item->findChild<QQmlConnections*>(); QVERIFY(connections); - connections->setTarget(0); + connections->setTarget(nullptr); // target cleared: no longer fire Connections item->setWidth(150.); diff --git a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp index f832143935..0d915f98f8 100644 --- a/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp +++ b/tests/auto/qml/qqmlconsole/tst_qqmlconsole.cpp @@ -84,7 +84,7 @@ void tst_qqmlconsole::logging() QQmlComponent component(&engine, testUrl); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -102,7 +102,7 @@ void tst_qqmlconsole::categorized_logging() QQmlComponent component(&engine, testUrl); QObject *object = component.create(); - QVERIFY2(object != 0, component.errorString().toUtf8()); + QVERIFY2(object != nullptr, component.errorString().toUtf8()); QVERIFY(messageHandler.messages().contains("qt.test: console.info")); QVERIFY(messageHandler.messages().contains("qt.test: console.warn")); @@ -135,7 +135,7 @@ void tst_qqmlconsole::tracing() QQmlComponent component(&engine, testUrl); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -149,7 +149,7 @@ void tst_qqmlconsole::profiling() QQmlComponent component(&engine, testUrl); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -170,7 +170,7 @@ void tst_qqmlconsole::testAssert() QQmlComponent component(&engine, testUrl); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -191,7 +191,7 @@ void tst_qqmlconsole::exception() QQmlComponent component(&engine, testUrl); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } diff --git a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp index 783b5cb786..5999bc42e9 100644 --- a/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp +++ b/tests/auto/qml/qqmlcontext/tst_qqmlcontext.cpp @@ -116,7 +116,7 @@ void tst_qqmlcontext::resolvedUrl() QQmlContext ctxt2(ctxt); QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl("http://www.qt-project.org/main2.qml")); - delete ctxt; ctxt = 0; + delete ctxt; ctxt = nullptr; QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl()); } @@ -144,7 +144,7 @@ void tst_qqmlcontext::engineMethod() QCOMPARE(ctxt3.engine(), engine); QCOMPARE(ctxt4.engine(), engine); - delete engine; engine = 0; + delete engine; engine = nullptr; QCOMPARE(ctxt.engine(), engine); QCOMPARE(ctxt2.engine(), engine); @@ -156,7 +156,7 @@ void tst_qqmlcontext::parentContext() { QQmlEngine *engine = new QQmlEngine; - QCOMPARE(engine->rootContext()->parentContext(), (QQmlContext *)0); + QCOMPARE(engine->rootContext()->parentContext(), (QQmlContext *)nullptr); QQmlContext *ctxt = new QQmlContext(engine); QQmlContext *ctxt2 = new QQmlContext(ctxt); @@ -174,23 +174,23 @@ void tst_qqmlcontext::parentContext() QCOMPARE(ctxt6->parentContext(), engine->rootContext()); QCOMPARE(ctxt7->parentContext(), engine->rootContext()); - delete ctxt2; ctxt2 = 0; + delete ctxt2; ctxt2 = nullptr; QCOMPARE(ctxt->parentContext(), engine->rootContext()); - QCOMPARE(ctxt3->parentContext(), (QQmlContext *)0); - QCOMPARE(ctxt4->parentContext(), (QQmlContext *)0); + QCOMPARE(ctxt3->parentContext(), (QQmlContext *)nullptr); + QCOMPARE(ctxt4->parentContext(), (QQmlContext *)nullptr); QCOMPARE(ctxt5->parentContext(), ctxt); QCOMPARE(ctxt6->parentContext(), engine->rootContext()); QCOMPARE(ctxt7->parentContext(), engine->rootContext()); - delete engine; engine = 0; + delete engine; engine = nullptr; - QCOMPARE(ctxt->parentContext(), (QQmlContext *)0); - QCOMPARE(ctxt3->parentContext(), (QQmlContext *)0); - QCOMPARE(ctxt4->parentContext(), (QQmlContext *)0); - QCOMPARE(ctxt5->parentContext(), (QQmlContext *)0); - QCOMPARE(ctxt6->parentContext(), (QQmlContext *)0); - QCOMPARE(ctxt7->parentContext(), (QQmlContext *)0); + QCOMPARE(ctxt->parentContext(), (QQmlContext *)nullptr); + QCOMPARE(ctxt3->parentContext(), (QQmlContext *)nullptr); + QCOMPARE(ctxt4->parentContext(), (QQmlContext *)nullptr); + QCOMPARE(ctxt5->parentContext(), (QQmlContext *)nullptr); + QCOMPARE(ctxt6->parentContext(), (QQmlContext *)nullptr); + QCOMPARE(ctxt7->parentContext(), (QQmlContext *)nullptr); delete ctxt7; delete ctxt6; @@ -453,12 +453,12 @@ void tst_qqmlcontext::destruction() QObject obj; QQmlEngine::setContextForObject(&obj, ctxt); - QQmlExpression expr(ctxt, 0, "a"); + QQmlExpression expr(ctxt, nullptr, "a"); QCOMPARE(ctxt, QQmlEngine::contextForObject(&obj)); QCOMPARE(ctxt, expr.context()); - delete ctxt; ctxt = 0; + delete ctxt; ctxt = nullptr; QCOMPARE(ctxt, QQmlEngine::contextForObject(&obj)); QCOMPARE(ctxt, expr.context()); @@ -507,7 +507,7 @@ void tst_qqmlcontext::readOnlyContexts() QCOMPARE(context->contextProperty("hello"), QVariant()); QTest::ignoreMessage(QtWarningMsg, "QQmlContext: Cannot set context object for internal context."); - context->setContextObject(0); + context->setContextObject(nullptr); QCOMPARE(context->contextObject(), obj); delete obj; @@ -535,7 +535,7 @@ void tst_qqmlcontext::nameForObject() component.setData("import QtQuick 2.0; QtObject { id: root; property QtObject o: QtObject { id: nested } }", QUrl()); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(qmlContext(o)->nameForObject(o), QString("root")); QCOMPARE(qmlContext(o)->nameForObject(qvariant_cast<QObject*>(o->property("o"))), QString("nested")); @@ -548,12 +548,12 @@ class DeleteCommand : public QObject { Q_OBJECT public: - DeleteCommand() : object(0) {} + DeleteCommand() : object(nullptr) {} QObject *object; public slots: - void doCommand() { if (object) delete object; object = 0; } + void doCommand() { if (object) delete object; object = nullptr; } }; // Calling refresh expressions would crash if an expression or context was deleted during @@ -686,7 +686,7 @@ void tst_qqmlcontext::skipExpressionRefresh_qtbug_53431() { QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("qtbug_53431.qml")); - QScopedPointer<QObject> object(component.create(0)); + QScopedPointer<QObject> object(component.create(nullptr)); QVERIFY(!object.isNull()); QCOMPARE(object->property("value").toInt(), 1); object->setProperty("value", 10); @@ -713,7 +713,7 @@ void tst_qqmlcontext::evalAfterInvalidate() QQmlComponent component(&engine, testFileUrl("evalAfterInvalidate.qml")); QScopedPointer<QObject> o(component.create()); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } diff --git a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp index 63b5de044e..99cabb4b09 100644 --- a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp +++ b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp @@ -102,7 +102,7 @@ void tst_qqmlcpputils::fastCast() } { - QObject *nullObj = 0; + QObject *nullObj = nullptr; QObject *obj = qmlobject_cast<QObject *>(nullObj); QCOMPARE(obj, nullObj); // shouldn't crash/assert. } diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index 80da5d7e52..89887fe6c3 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -56,7 +56,7 @@ class AbstractExtensionObject : public QObject Q_PROPERTY(int abstractProperty READ abstractProperty WRITE setAbstractProperty NOTIFY abstractPropertyChanged) public: - AbstractExtensionObject(QObject *parent = 0) : QObject(parent), m_abstractProperty(-1) {} + AbstractExtensionObject(QObject *parent = nullptr) : QObject(parent), m_abstractProperty(-1) {} void setAbstractProperty(int abstractProperty) { m_abstractProperty = abstractProperty; emit abstractPropertyChanged(); } int abstractProperty() const { return m_abstractProperty; } @@ -75,7 +75,7 @@ class ImplementedExtensionObject : public AbstractExtensionObject Q_OBJECT Q_PROPERTY(int implementedProperty READ implementedProperty WRITE setImplementedProperty NOTIFY implementedPropertyChanged) public: - ImplementedExtensionObject(QObject *parent = 0) : AbstractExtensionObject(parent), m_implementedProperty(883) {} + ImplementedExtensionObject(QObject *parent = nullptr) : AbstractExtensionObject(parent), m_implementedProperty(883) {} void shouldBeImplemented() {} void setImplementedProperty(int implementedProperty) { m_implementedProperty = implementedProperty; emit implementedPropertyChanged(); } @@ -340,7 +340,7 @@ public: } }; -static MyInheritedQmlObject *theSingletonObject = 0; +static MyInheritedQmlObject *theSingletonObject = nullptr; static QObject *inheritedQmlObject_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */) { @@ -382,7 +382,7 @@ private: static int a = 0; static int *ptr = &a; *ptr = 1; - ptr = 0; + ptr = nullptr; } }; @@ -401,13 +401,13 @@ static QObject *create_singletonWithEnum(QQmlEngine *, QJSEngine *) } QObjectContainer::QObjectContainer() - : widgetParent(0) + : widgetParent(nullptr) , gcOnAppend(false) {} QQmlListProperty<QObject> QObjectContainer::data() { - return QQmlListProperty<QObject>(this, 0, children_append, children_count, children_at, children_clear); + return QQmlListProperty<QObject>(this, nullptr, children_append, children_count, children_at, children_clear); } void QObjectContainer::children_append(QQmlListProperty<QObject> *prop, QObject *o) @@ -419,7 +419,7 @@ void QObjectContainer::children_append(QQmlListProperty<QObject> *prop, QObject if (that->gcOnAppend) { QQmlEngine *engine = qmlEngine(that); engine->collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } } @@ -448,7 +448,7 @@ void QObjectContainer::childDestroyed(QObject *child) { void FloatingQObject::classBegin() { - setParent(0); + setParent(nullptr); } void FloatingQObject::componentComplete() diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index ecd7bea1c4..5ff959515e 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -373,7 +373,7 @@ private: static void gc(QQmlEngine &engine) { engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } @@ -392,7 +392,7 @@ void tst_qqmlecmascript::assignBasicTypes() { QQmlComponent component(&engine, testFileUrl("assignBasicTypes.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); QCOMPARE(object->relatedEnumProperty(), MyEnumContainer::RelatedValue); @@ -421,7 +421,7 @@ void tst_qqmlecmascript::assignBasicTypes() { QQmlComponent component(&engine, testFileUrl("assignBasicTypes.2.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); QCOMPARE(object->relatedEnumProperty(), MyEnumContainer::RelatedValue); @@ -471,7 +471,7 @@ void tst_qqmlecmascript::assignDate() QQmlComponent component(&engine, source); QScopedPointer<QObject> obj(component.create()); MyTypeObject *object = qobject_cast<MyTypeObject *>(obj.data()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QDate expectedDate(2009, 5, 12); QDateTime expectedDateTime; @@ -542,7 +542,7 @@ void tst_qqmlecmascript::exportDate() QQmlComponent component(&e, source); QScopedPointer<QObject> obj(component.create()); MyTypeObject *object = qobject_cast<MyTypeObject *>(obj.data()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->boolProperty(), true); } @@ -551,8 +551,8 @@ void tst_qqmlecmascript::idShortcutInvalidates() { QQmlComponent component(&engine, testFileUrl("idShortcutInvalidates.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->objectProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->objectProperty() != nullptr); delete object->objectProperty(); QVERIFY(!object->objectProperty()); delete object; @@ -561,8 +561,8 @@ void tst_qqmlecmascript::idShortcutInvalidates() { QQmlComponent component(&engine, testFileUrl("idShortcutInvalidates.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->objectProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->objectProperty() != nullptr); delete object->objectProperty(); QVERIFY(!object->objectProperty()); delete object; @@ -574,14 +574,14 @@ void tst_qqmlecmascript::boolPropertiesEvaluateAsBool() { QQmlComponent component(&engine, testFileUrl("boolPropertiesEvaluateAsBool.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->stringProperty(), QLatin1String("pass")); delete object; } { QQmlComponent component(&engine, testFileUrl("boolPropertiesEvaluateAsBool.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->stringProperty(), QLatin1String("pass")); delete object; } @@ -592,7 +592,7 @@ void tst_qqmlecmascript::signalAssignment() { QQmlComponent component(&engine, testFileUrl("signalAssignment.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->string(), QString()); emit object->basicSignal(); QCOMPARE(object->string(), QString("pass")); @@ -602,7 +602,7 @@ void tst_qqmlecmascript::signalAssignment() { QQmlComponent component(&engine, testFileUrl("signalAssignment.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->string(), QString()); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25 3 2")); @@ -629,7 +629,7 @@ void tst_qqmlecmascript::signalArguments() { QQmlComponent component(&engine, testFileUrl("signalArguments.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->string(), QString()); emit object->basicSignal(); QCOMPARE(object->string(), QString("pass")); @@ -640,7 +640,7 @@ void tst_qqmlecmascript::signalArguments() { QQmlComponent component(&engine, testFileUrl("signalArguments.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->string(), QString()); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); QCOMPARE(object->string(), QString("pass 19 Hello world! 10.25 3 2")); @@ -654,7 +654,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->methodCalled(), false); QCOMPARE(object->methodIntCalled(), false); emit object->basicSignal(); @@ -666,7 +666,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->methodCalled(), false); QCOMPARE(object->methodIntCalled(), false); emit object->basicSignal(); @@ -678,7 +678,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 19); delete object; } @@ -686,7 +686,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.4.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 19); QCOMPARE(object->property("test2").toInt(), 17); QCOMPARE(object->property("test3").toInt(), 16); @@ -696,7 +696,7 @@ void tst_qqmlecmascript::methods() { QQmlComponent component(&engine, testFileUrl("methods.5.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 9); delete object; } @@ -708,7 +708,7 @@ void tst_qqmlecmascript::bindingLoop() QString warning = component.url().toString() + ":9:9: QML MyQmlObject: Binding loop detected for property \"stringProperty\""; QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -894,7 +894,7 @@ void tst_qqmlecmascript::objectPropertiesTriggerReeval() expr.changed = false; QCOMPARE(expr.evaluate(), QVariant("Cat")); - object1.setObjectProperty(0); + object1.setObjectProperty(nullptr); QCOMPARE(expr.changed, true); expr.changed = false; QCOMPARE(expr.evaluate(), QVariant()); @@ -928,16 +928,16 @@ void tst_qqmlecmascript::deferredProperties() QQmlComponent component(&engine, testFileUrl("deferredProperties.qml")); MyDeferredObject *object = qobject_cast<MyDeferredObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 0); QVERIFY(!object->objectProperty()); - QVERIFY(object->objectProperty2() != 0); + QVERIFY(object->objectProperty2() != nullptr); qmlExecuteDeferred(object); QCOMPARE(object->value(), 10); - QVERIFY(object->objectProperty() != 0); + QVERIFY(object->objectProperty() != nullptr); MyQmlObject *qmlObject = qobject_cast<MyQmlObject *>(object->objectProperty()); - QVERIFY(qmlObject != 0); + QVERIFY(qmlObject != nullptr); QCOMPARE(qmlObject->value(), 10); object->setValue(19); QCOMPARE(qmlObject->value(), 19); @@ -951,7 +951,7 @@ void tst_qqmlecmascript::deferredPropertiesErrors() QQmlComponent component(&engine, testFileUrl("deferredPropertiesErrors.qml")); MyDeferredObject *object = qobject_cast<MyDeferredObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 0); QVERIFY(!object->objectProperty()); QVERIFY(!object->objectProperty2()); @@ -971,25 +971,25 @@ void tst_qqmlecmascript::deferredPropertiesInComponents() QObject *object = component.create(); if (!object) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").value<int>(), 10); MyDeferredObject *defObjectA = qobject_cast<MyDeferredObject *>(object->property("deferredInside").value<QObject*>()); - QVERIFY(defObjectA != 0); + QVERIFY(defObjectA != nullptr); QVERIFY(!defObjectA->objectProperty()); qmlExecuteDeferred(defObjectA); - QVERIFY(defObjectA->objectProperty() != 0); + QVERIFY(defObjectA->objectProperty() != nullptr); QCOMPARE(defObjectA->objectProperty()->property("value").value<int>(), 10); MyDeferredObject *defObjectB = qobject_cast<MyDeferredObject *>(object->property("deferredOutside").value<QObject*>()); - QVERIFY(defObjectB != 0); + QVERIFY(defObjectB != nullptr); QVERIFY(!defObjectB->objectProperty()); qmlExecuteDeferred(defObjectB); - QVERIFY(defObjectB->objectProperty() != 0); + QVERIFY(defObjectB->objectProperty() != nullptr); QCOMPARE(defObjectB->objectProperty()->property("value").value<int>(), 10); delete object; @@ -1004,7 +1004,7 @@ void tst_qqmlecmascript::deferredPropertiesInDestruction() QObject *object = component.create(); if (!object) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; //QTBUG-33112 was that this used to cause a crash } @@ -1013,7 +1013,7 @@ void tst_qqmlecmascript::extensionObjects() QQmlComponent component(&engine, testFileUrl("extensionObjects.qml")); MyExtendedObject *object = qobject_cast<MyExtendedObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->baseProperty(), 13); QCOMPARE(object->coreProperty(), 9); object->setProperty("extendedProperty", QVariant(11)); @@ -1038,8 +1038,8 @@ void tst_qqmlecmascript::overrideExtensionProperties() QQmlComponent component(&engine, testFileUrl("extensionObjectsPropertyOverride.qml")); OverrideDefaultPropertyObject *object = qobject_cast<OverrideDefaultPropertyObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->secondProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->secondProperty() != nullptr); QVERIFY(!object->firstProperty()); delete object; @@ -1050,7 +1050,7 @@ void tst_qqmlecmascript::attachedProperties() { QQmlComponent component(&engine, testFileUrl("attachedProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 19); QCOMPARE(object->property("b").toInt(), 19); QCOMPARE(object->property("c").toInt(), 19); @@ -1061,7 +1061,7 @@ void tst_qqmlecmascript::attachedProperties() { QQmlComponent component(&engine, testFileUrl("attachedProperty.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 26); QCOMPARE(object->property("b").toInt(), 26); QCOMPARE(object->property("c").toInt(), 26); @@ -1073,13 +1073,13 @@ void tst_qqmlecmascript::attachedProperties() { QQmlComponent component(&engine, testFileUrl("writeAttachedProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "writeValue2"); MyQmlAttachedObject *attached = qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object)); - QVERIFY(attached != 0); + QVERIFY(attached != nullptr); QCOMPARE(attached->value2(), 9); delete object; @@ -1092,7 +1092,7 @@ void tst_qqmlecmascript::enums() { QQmlComponent component(&engine, testFileUrl("enums.1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("enumProperty").toInt(), (int)MyQmlObject::EnumValue2); QCOMPARE(object->property("relatedEnumProperty").toInt(), (int)MyEnumContainer::RelatedValue); @@ -1135,7 +1135,7 @@ void tst_qqmlecmascript::enums() QQmlComponent component(&engine, testFileUrl("enums.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 0); QCOMPARE(object->property("b").toInt(), 0); QCOMPARE(object->property("c").toInt(), 0); @@ -1162,7 +1162,7 @@ void tst_qqmlecmascript::enums() { QQmlComponent component(&engine, testFileUrl("enums.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // check the values are what we expect QCOMPARE(object->property("a").toInt(), 4); @@ -1196,7 +1196,7 @@ void tst_qqmlecmascript::valueTypeFunctions() { QQmlComponent component(&engine, testFileUrl("valueTypeFunctions.qml")); MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->rectProperty(), QRect(0,0,100,100)); QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5)); @@ -1213,7 +1213,7 @@ void tst_qqmlecmascript::constantsOverrideBindings() { QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c2").toInt(), 0); object->setProperty("c1", QVariant(9)); @@ -1232,7 +1232,7 @@ void tst_qqmlecmascript::constantsOverrideBindings() { QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c1").toInt(), 0); QCOMPARE(object->property("c2").toInt(), 10); @@ -1268,7 +1268,7 @@ void tst_qqmlecmascript::constantsOverrideBindings() { QQmlComponent component(&engine, testFileUrl("constantsOverrideBindings.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c1").toInt(), 0); QCOMPARE(object->property("c3").toInt(), 10); @@ -1289,7 +1289,7 @@ void tst_qqmlecmascript::outerBindingOverridesInnerBinding() QQmlComponent component(&engine, testFileUrl("outerBindingOverridesInnerBinding.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c1").toInt(), 0); QCOMPARE(object->property("c2").toInt(), 0); @@ -1321,7 +1321,7 @@ void tst_qqmlecmascript::nonExistentAttachedObject() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -1331,7 +1331,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toInt(), 1); QCOMPARE(object->property("test2").toInt(), 2); @@ -1350,7 +1350,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toInt(), 19); QCOMPARE(object->property("test2").toInt(), 19); @@ -1365,7 +1365,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QEXPECT_FAIL("", "Properties resolvable at compile time come before the global object, which is not 100% compatible with older QML versions", Continue); @@ -1379,7 +1379,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); QCOMPARE(object->property("test2").toString(), QString()); @@ -1395,7 +1395,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.5.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -1406,7 +1406,7 @@ void tst_qqmlecmascript::scope() { QQmlComponent component(&engine, testFileUrl("scope.6.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -1420,7 +1420,7 @@ void tst_qqmlecmascript::importScope() { QQmlComponent component(&engine, testFileUrl("importScope.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toInt(), 240); @@ -1435,7 +1435,7 @@ void tst_qqmlecmascript::signalParameterTypes() { QQmlComponent component(&engine, testFileUrl("signalParameterTypes.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); emit object->basicSignal(); @@ -1462,7 +1462,7 @@ void tst_qqmlecmascript::objectsCompareAsEqual() { QQmlComponent component(&engine, testFileUrl("objectsCompareAsEqual.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -1482,7 +1482,7 @@ void tst_qqmlecmascript::aliasPropertyAndBinding() { QQmlComponent component(&engine, testFileUrl("aliasPropertyAndBinding.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("c2").toInt(), 3); QCOMPARE(object->property("c3").toInt(), 3); @@ -1501,12 +1501,12 @@ and that the aliased property is reset correctly if possible. */ void tst_qqmlecmascript::aliasPropertyReset() { - QObject *object = 0; + QObject *object = nullptr; // test that a manual write (of undefined) to a resettable aliased property succeeds QQmlComponent c1(&engine, testFileUrl("aliasreset/aliasPropertyReset.1.qml")); object = c1.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0); QCOMPARE(object->property("aliasIsUndefined"), QVariant(false)); QMetaObject::invokeMethod(object, "resetAliased"); @@ -1517,7 +1517,7 @@ void tst_qqmlecmascript::aliasPropertyReset() // test that a manual write (of undefined) to a resettable alias property succeeds QQmlComponent c2(&engine, testFileUrl("aliasreset/aliasPropertyReset.2.qml")); object = c2.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0); QCOMPARE(object->property("loaderSourceComponentIsUndefined"), QVariant(false)); QMetaObject::invokeMethod(object, "resetAlias"); @@ -1528,7 +1528,7 @@ void tst_qqmlecmascript::aliasPropertyReset() // test that an alias to a bound property works correctly QQmlComponent c3(&engine, testFileUrl("aliasreset/aliasPropertyReset.3.qml")); object = c3.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0); QCOMPARE(object->property("loaderOneSourceComponentIsUndefined"), QVariant(false)); QCOMPARE(object->property("loaderTwoSourceComponentIsUndefined"), QVariant(false)); @@ -1542,10 +1542,10 @@ void tst_qqmlecmascript::aliasPropertyReset() // whose aliased property's object has been deleted, does not crash. QQmlComponent c4(&engine, testFileUrl("aliasreset/aliasPropertyReset.4.qml")); object = c4.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() != 0); QObject *loader = object->findChild<QObject*>("loader"); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); delete loader; QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0); // deletion should have caused value unset. QMetaObject::invokeMethod(object, "resetAlias"); // shouldn't crash. @@ -1557,7 +1557,7 @@ void tst_qqmlecmascript::aliasPropertyReset() // test that binding an alias property to an undefined value works correctly QQmlComponent c5(&engine, testFileUrl("aliasreset/aliasPropertyReset.5.qml")); object = c5.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("sourceComponentAlias").value<QQmlComponent*>() == 0); // bound to undefined value. delete object; @@ -1566,7 +1566,7 @@ void tst_qqmlecmascript::aliasPropertyReset() QString warning1 = url.toString() + QLatin1String(":15: Error: Cannot assign [undefined] to int"); QQmlComponent e1(&engine, url); object = e1.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("intAlias").value<int>(), 12); QCOMPARE(object->property("aliasedIntIsUndefined"), QVariant(false)); QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData()); @@ -1638,7 +1638,7 @@ void tst_qqmlecmascript::componentCreation() QQmlComponent component(&engine, testUrl); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, method.toUtf8()); QQmlComponent *created = object->componentProperty(); @@ -1650,7 +1650,7 @@ void tst_qqmlecmascript::componentCreation() if (createdParent == QLatin1String("obj")) { expectedParent = object; } else if ((createdParent == QLatin1String("null")) || createdParent.isEmpty()) { - expectedParent = 0; + expectedParent = nullptr; } QCOMPARE(created->parent(), expectedParent); } @@ -1677,7 +1677,7 @@ void tst_qqmlecmascript::dynamicCreation() QQmlComponent component(&engine, testFileUrl("dynamicCreation.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, method.toUtf8()); QObject *created = object->objectProperty(); @@ -1695,8 +1695,8 @@ void tst_qqmlecmascript::dynamicDestruction() { QQmlComponent component(&engine, testFileUrl("dynamicDeletion.qml")); QPointer<MyQmlObject> object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - QPointer<QObject> createdQmlObject = 0; + QVERIFY(object != nullptr); + QPointer<QObject> createdQmlObject = nullptr; QMetaObject::invokeMethod(object, "create"); createdQmlObject = object->objectProperty(); @@ -1706,13 +1706,13 @@ void tst_qqmlecmascript::dynamicDestruction() QMetaObject::invokeMethod(object, "killOther"); QVERIFY(createdQmlObject); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(createdQmlObject); for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up if (createdQmlObject) { QTest::qWait(100); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } } @@ -1721,7 +1721,7 @@ void tst_qqmlecmascript::dynamicDestruction() QQmlEngine::setObjectOwnership(object, QQmlEngine::JavaScriptOwnership); QMetaObject::invokeMethod(object, "killMe"); QVERIFY(object); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(!object); } @@ -1729,7 +1729,7 @@ void tst_qqmlecmascript::dynamicDestruction() { QQmlComponent component(&engine, testFileUrl("dynamicDeletion.2.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!qvariant_cast<QObject*>(o->property("objectProperty"))); @@ -1739,7 +1739,7 @@ void tst_qqmlecmascript::dynamicDestruction() QMetaObject::invokeMethod(o, "destroy"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(!qvariant_cast<QObject*>(o->property("objectProperty"))); @@ -1749,10 +1749,10 @@ void tst_qqmlecmascript::dynamicDestruction() { // QTBUG-23451 - QPointer<QObject> createdQmlObject = 0; + QPointer<QObject> createdQmlObject = nullptr; QQmlComponent component(&engine, testFileUrl("dynamicDeletion.3.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!qvariant_cast<QObject*>(o->property("objectProperty"))); QMetaObject::invokeMethod(o, "create"); createdQmlObject = qvariant_cast<QObject*>(o->property("objectProperty")); @@ -1761,7 +1761,7 @@ void tst_qqmlecmascript::dynamicDestruction() QCOMPARE(qvariant_cast<bool>(o->property("test")), false); for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up QTest::qWait(100); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } QVERIFY(!qvariant_cast<QObject*>(o->property("objectProperty"))); @@ -1777,7 +1777,7 @@ void tst_qqmlecmascript::objectToString() { QQmlComponent component(&engine, testFileUrl("qmlToString.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "testToString"); QVERIFY(object->stringProperty().startsWith("MyQmlObject_QML_")); QVERIFY(object->stringProperty().endsWith(", \"objName\")")); @@ -1797,7 +1797,7 @@ void tst_qqmlecmascript::objectHasOwnProperty() QQmlComponent component(&engine, url); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // test QObjects in QML QMetaObject::invokeMethod(object, "testHasOwnPropertySuccess"); @@ -1807,7 +1807,7 @@ void tst_qqmlecmascript::objectHasOwnProperty() // now test other types in QML QObject *child = object->findChild<QObject*>("typeObj"); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QMetaObject::invokeMethod(child, "testHasOwnPropertySuccess"); QCOMPARE(child->property("valueTypeHasOwnProperty").toBool(), true); QCOMPARE(child->property("valueTypeHasOwnProperty2").toBool(), true); @@ -1844,7 +1844,7 @@ void tst_qqmlecmascript::selfDeletingBinding() { QQmlComponent component(&engine, testFileUrl("selfDeletingBinding.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->setProperty("triggerDelete", true); delete object; } @@ -1852,7 +1852,7 @@ void tst_qqmlecmascript::selfDeletingBinding() { QQmlComponent component(&engine, testFileUrl("selfDeletingBinding.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->setProperty("triggerDelete", true); delete object; } @@ -1869,7 +1869,7 @@ void tst_qqmlecmascript::extendedObjectPropertyLookup() { QQmlComponent component(&engine, testFileUrl("extendedObjectPropertyLookup.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -1880,7 +1880,7 @@ void tst_qqmlecmascript::extendedObjectPropertyLookup2() { QQmlComponent component(&engine, testFileUrl("extendedObjectPropertyLookup2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant returnValue; QVERIFY(QMetaObject::invokeMethod(object, "getValue", Q_RETURN_ARG(QVariant, returnValue))); @@ -1908,7 +1908,7 @@ void tst_qqmlecmascript::extendedObjectPropertyLookup3() QQmlComponent component(&engine, testFileUrl("extendedObjectPropertyLookup3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant returnValue; QVERIFY(QMetaObject::invokeMethod(object, "getAbstractProperty", Q_RETURN_ARG(QVariant, returnValue))); @@ -1943,7 +1943,7 @@ void tst_qqmlecmascript::scriptErrors() QTest::ignoreMessage(QtWarningMsg, warning5.toLatin1().constData()); QTest::ignoreMessage(QtWarningMsg, warning6.toLatin1().constData()); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, warning4.toLatin1().constData()); emit object->basicSignal(); @@ -1970,14 +1970,14 @@ void tst_qqmlecmascript::functionErrors() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; // test that if an exception occurs while invoking js function from cpp, it is reported as expected. QQmlComponent componentTwo(&engine, testFileUrl("scarceResourceFunctionFail.var.qml")); url = componentTwo.url().toString(); object = componentTwo.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *resource = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); warning = url + QLatin1String(":16: TypeError: Property 'scarceResource' of object ScarceResourceObject(0x%1) is not a function"); @@ -1997,7 +1997,7 @@ void tst_qqmlecmascript::propertyAssignmentErrors() QString url = component.url().toString(); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -2013,7 +2013,7 @@ void tst_qqmlecmascript::signalTriggeredBindings() { QQmlComponent component(&engine, testFileUrl("signalTriggeredBindings.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("base").toReal(), 50.); QCOMPARE(object->property("test1").toReal(), 50.); @@ -2041,7 +2041,7 @@ void tst_qqmlecmascript::listProperties() { QQmlComponent component(&engine, testFileUrl("listProperties.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toInt(), 21); QCOMPARE(object->property("test2").toInt(), 2); @@ -2060,7 +2060,7 @@ void tst_qqmlecmascript::exceptionClearsOnReeval() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); @@ -2083,7 +2083,7 @@ void tst_qqmlecmascript::exceptionSlotProducesWarning() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2096,7 +2096,7 @@ void tst_qqmlecmascript::exceptionBindingProducesWarning() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2105,7 +2105,7 @@ void tst_qqmlecmascript::compileInvalidBinding() // QTBUG-23387: ensure that invalid bindings don't cause a crash. QQmlComponent component(&engine, testFileUrl("v8bindingException.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2118,7 +2118,7 @@ void tst_qqmlecmascript::transientErrors() QQmlTestMessageHandler messageHandler; QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); @@ -2132,7 +2132,7 @@ void tst_qqmlecmascript::transientErrors() QQmlTestMessageHandler messageHandler; QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); @@ -2145,7 +2145,7 @@ void tst_qqmlecmascript::shutdownErrors() { QQmlComponent component(&engine, testFileUrl("shutdownErrors.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlTestMessageHandler messageHandler; @@ -2168,7 +2168,7 @@ void tst_qqmlecmascript::jsObject() { QQmlComponent component(&engine, testFileUrl("jsObject.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 92); @@ -2180,7 +2180,7 @@ void tst_qqmlecmascript::undefinedResetsProperty() { QQmlComponent component(&engine, testFileUrl("undefinedResetsProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("resettableProperty").toInt(), 92); @@ -2197,7 +2197,7 @@ void tst_qqmlecmascript::undefinedResetsProperty() { QQmlComponent component(&engine, testFileUrl("undefinedResetsProperty.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("resettableProperty").toInt(), 19); @@ -2214,7 +2214,7 @@ void tst_qqmlecmascript::qtbug_22464() { QQmlComponent component(&engine, testFileUrl("qtbug_22464.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -2226,7 +2226,7 @@ void tst_qqmlecmascript::qtbug_21580() QQmlComponent component(&engine, testFileUrl("qtbug_21580.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -2239,7 +2239,7 @@ void tst_qqmlecmascript::singleV8BindingDestroyedDuringEvaluation() QQmlComponent component(&engine, testFileUrl("singleV8BindingDestroyedDuringEvaluation.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2248,7 +2248,7 @@ void tst_qqmlecmascript::bug1() { QQmlComponent component(&engine, testFileUrl("bug.1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 14); @@ -2270,7 +2270,7 @@ void tst_qqmlecmascript::bug2() component.setData("import Qt.test 1.0;\nQPlainTextEdit { width: 100 }", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -2281,7 +2281,7 @@ void tst_qqmlecmascript::dynamicCreationCrash() { QQmlComponent component(&engine, testFileUrl("dynamicCreation.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready"); QMetaObject::invokeMethod(object, "dontCrash"); @@ -2302,9 +2302,9 @@ void tst_qqmlecmascript::dynamicCreationOwnership() QQmlEngine dcoEngine; QQmlComponent component(&dcoEngine, testFileUrl("dynamicCreationOwnership.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MyDynamicCreationDestructionObject *mdcdo = object->findChild<MyDynamicCreationDestructionObject*>("mdcdo"); - QVERIFY(mdcdo != 0); + QVERIFY(mdcdo != nullptr); mdcdo->setDtorCount(&dtorCount); for (int i = 1; i < 105; ++i, ++expectedDtorCount) { @@ -2315,14 +2315,14 @@ void tst_qqmlecmascript::dynamicCreationOwnership() QMetaObject::invokeMethod(object, "performGc"); } if (i % 10 == 0) { - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } } delete object; } - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QCOMPARE(dtorCount, expectedDtorCount); } @@ -2333,7 +2333,7 @@ void tst_qqmlecmascript::regExpBug() { QQmlComponent component(&engine, testFileUrl("regExp.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->regExp().pattern(), QLatin1String("[a-zA-z]")); delete object; } @@ -2731,28 +2731,28 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); + QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(\"Hello world\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); + QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); + QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); QCOMPARE(o->actuals().count(), 1); - QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)0)); + QCOMPARE(o->actuals().at(0), qVariantFromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(object)", QV4::Primitive::undefinedValue())); @@ -3099,7 +3099,7 @@ void tst_qqmlecmascript::listToVariant() context.setContextObject(&container); QObject *object = component.create(&context); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant v = object->property("test"); QCOMPARE(v.userType(), qMetaTypeId<QQmlListReference>()); @@ -3166,11 +3166,11 @@ void tst_qqmlecmascript::attachedPropertyScope() QQmlComponent component(&engine, testFileUrl("attachedPropertyScope.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MyQmlAttachedObject *attached = qobject_cast<MyQmlAttachedObject *>(qmlAttachedPropertiesObject<MyQmlObject>(object)); - QVERIFY(attached != 0); + QVERIFY(attached != nullptr); QCOMPARE(object->property("value2").toInt(), 0); @@ -3187,7 +3187,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3200,7 +3200,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3213,7 +3213,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.3.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3226,7 +3226,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->methodCalled(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3239,7 +3239,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.5.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->methodCalled(), false); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3252,7 +3252,7 @@ void tst_qqmlecmascript::scriptConnect() QQmlComponent component(&engine, testFileUrl("scriptConnect.6.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3268,7 +3268,7 @@ void tst_qqmlecmascript::scriptDisconnect() QQmlComponent component(&engine, testFileUrl("scriptDisconnect.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3287,7 +3287,7 @@ void tst_qqmlecmascript::scriptDisconnect() QQmlComponent component(&engine, testFileUrl("scriptDisconnect.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3306,7 +3306,7 @@ void tst_qqmlecmascript::scriptDisconnect() QQmlComponent component(&engine, testFileUrl("scriptDisconnect.3.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3324,7 +3324,7 @@ void tst_qqmlecmascript::scriptDisconnect() QQmlComponent component(&engine, testFileUrl("scriptDisconnect.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 0); emit object->argumentSignal(19, "Hello world!", 10.25, MyQmlObject::EnumValue4, Qt::RightButton); @@ -3361,13 +3361,13 @@ void tst_qqmlecmascript::ownership() { QQmlComponent component(&engine, testFileUrl("ownership.qml")); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); QObject *object = component.create(context); engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(own.object.isNull()); @@ -3380,16 +3380,16 @@ void tst_qqmlecmascript::ownership() { QQmlComponent component(&engine, testFileUrl("ownership.qml")); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); QObject *object = component.create(context); engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); delete object; } @@ -3401,7 +3401,7 @@ class CppOwnershipReturnValue : public QObject { Q_OBJECT public: - CppOwnershipReturnValue() : value(0) {} + CppOwnershipReturnValue() : value(nullptr) {} ~CppOwnershipReturnValue() { delete value; } Q_INVOKABLE QObject *create() { @@ -3436,16 +3436,16 @@ void tst_qqmlecmascript::cppOwnershipReturnValue() QObject *object = component.create(); - QVERIFY(object != 0); - QVERIFY(source.value != 0); + QVERIFY(object != nullptr); + QVERIFY(source.value != nullptr); delete object; } - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QVERIFY(source.value != 0); + QVERIFY(source.value != nullptr); } // QTBUG-15697 @@ -3464,14 +3464,14 @@ void tst_qqmlecmascript::ownershipCustomReturnValue() QObject *object = component.create(); - QVERIFY(object != 0); - QVERIFY(source.value != 0); + QVERIFY(object != nullptr); + QVERIFY(source.value != nullptr); delete object; } engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(source.value.isNull()); @@ -3483,7 +3483,7 @@ class OwnershipChangingObject : public QObject { Q_OBJECT public: - OwnershipChangingObject(): object(0) { } + OwnershipChangingObject(): object(nullptr) { } QPointer<QObject> object; @@ -3504,10 +3504,10 @@ void tst_qqmlecmascript::ownershipRootObject() engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); delete context; delete object; @@ -3534,10 +3534,10 @@ void tst_qqmlecmascript::ownershipConsistency() engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); - QVERIFY(own.object != 0); + QVERIFY(own.object != nullptr); delete context; delete object; @@ -3553,7 +3553,7 @@ void tst_qqmlecmascript::ownershipQmlIncubated() QMetaObject::invokeMethod(object, "deleteIncubatedItem"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(!object->property("incubatedItem").value<QObject*>()); @@ -3605,7 +3605,7 @@ void tst_qqmlecmascript::strictlyEquals() QQmlComponent component(&engine, testFileUrl("strictlyEquals.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -3624,7 +3624,7 @@ void tst_qqmlecmascript::compiled() QQmlComponent component(&engine, testFileUrl("compiled.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toReal(), qreal(15.7)); QCOMPARE(object->property("test2").toReal(), qreal(-6.7)); @@ -3664,7 +3664,7 @@ void tst_qqmlecmascript::numberAssignment() QQmlComponent component(&engine, testFileUrl("numberAssignment.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1"), QVariant((qreal)6.7)); QCOMPARE(object->property("test2"), QVariant((qreal)6.7)); @@ -3690,7 +3690,7 @@ void tst_qqmlecmascript::propertySplicing() QQmlComponent component(&engine, testFileUrl("propertySplicing.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -3703,7 +3703,7 @@ void tst_qqmlecmascript::signalWithUnknownTypes() QQmlComponent component(&engine, testFileUrl("signalWithUnknownTypes.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MyQmlObject::MyType type; type.value = 0x8971123; @@ -3755,7 +3755,7 @@ void tst_qqmlecmascript::signalWithJSValueInVariant() QQmlComponent component(&engine, testFileUrl("signalWithJSValueInVariant.qml")); QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QJSValue value = engine.evaluate(expression); QVERIFY(!value.isError()); @@ -3779,7 +3779,7 @@ void tst_qqmlecmascript::signalWithJSValueInVariant_twoEngines() QQmlComponent component(&engine, testFileUrl("signalWithJSValueInVariant.qml")); QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QJSEngine engine2; QJSValue value = engine2.evaluate(expression); @@ -3809,7 +3809,7 @@ void tst_qqmlecmascript::signalWithQJSValue() QQmlComponent component(&engine, testFileUrl("signalWithQJSValue.qml")); QScopedPointer<MyQmlObject> object(qobject_cast<MyQmlObject *>(component.create())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QJSValue value = engine.evaluate(expression); QVERIFY(!value.isError()); @@ -3975,7 +3975,7 @@ void tst_qqmlecmascript::singletonType() if (!errorMessage.isEmpty()) { QVERIFY(!object); } else { - QVERIFY(object != 0); + QVERIFY(object != nullptr); for (int i = 0; i < readProperties.size(); ++i) QCOMPARE(object->property(readProperties.at(i).toLatin1().constData()), readExpectedValues.at(i)); for (int i = 0; i < writeProperties.size(); ++i) @@ -4010,7 +4010,7 @@ void tst_qqmlecmascript::singletonTypeCaching() QQmlEngine cleanEngine; QQmlComponent component(&cleanEngine, testfile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QList<QVariant> firstValues; QMetaObject::invokeMethod(object, "modifyValues"); for (int i = 0; i < readProperties.size(); ++i) @@ -4019,7 +4019,7 @@ void tst_qqmlecmascript::singletonTypeCaching() QQmlComponent component2(&cleanEngine, testfile); QObject *object2 = component2.create(); - QVERIFY(object2 != 0); + QVERIFY(object2 != nullptr); for (int i = 0; i < readProperties.size(); ++i) QCOMPARE(object2->property(readProperties.at(i).toLatin1().constData()), firstValues.at(i)); // cached, shouldn't have changed. delete object2; @@ -4055,18 +4055,18 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) { QQmlContextData *scriptContext, *newContext; qml = scripts->getIndexed(i); - scriptContext = qml ? qml->getContext() : 0; + scriptContext = qml ? qml->getContext() : nullptr; qml = QV4::Encode::undefined(); { QV4::Scope scope(v4); - QV4::ScopedContext temporaryScope(scope, QV4::QmlContext::create(scope.engine->rootContext(), scriptContext, 0)); + QV4::ScopedContext temporaryScope(scope, QV4::QmlContext::create(scope.engine->rootContext(), scriptContext, nullptr)); Q_UNUSED(temporaryScope) } ctxt->engine->collectGarbage(); qml = scripts->getIndexed(i); - newContext = qml ? qml->getContext() : 0; + newContext = qml ? qml->getContext() : nullptr; QCOMPARE(scriptContext, newContext); } } @@ -4341,7 +4341,7 @@ void tst_qqmlecmascript::importScripts() if (!errorMessage.isEmpty()) { QVERIFY(!object); } else { - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlContextData *ctxt = QQmlContextData::get(engine.rootContext()); tst_qqmlecmascript::verifyContextLifetime(ctxt); @@ -4377,9 +4377,9 @@ void tst_qqmlecmascript::scarceResources_other() origPixmap.fill(Qt::blue); QString srp_name, expectedWarning; QV4::ExecutionEngine *v4 = engine.handle(); - ScarceResourceObject *eo = 0; - QObject *srsc = 0; - QObject *object = 0; + ScarceResourceObject *eo = nullptr; + QObject *srsc = nullptr; + QObject *object = nullptr; /* property var semantics */ @@ -4408,7 +4408,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that scarce resources are handled properly from js functions in qml files QQmlComponent varComponentEleven(&engine, testFileUrl("scarceResourceFunction.var.qml")); object = varComponentEleven.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. @@ -4427,7 +4427,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that if an exception occurs while invoking js function from cpp, that the resources are released. QQmlComponent varComponentTwelve(&engine, testFileUrl("scarceResourceFunctionFail.var.qml")); object = varComponentTwelve.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. @@ -4445,7 +4445,7 @@ void tst_qqmlecmascript::scarceResources_other() // that the scarce resource is removed from the engine's list of scarce resources to clean up. QQmlComponent varComponentThirteen(&engine, testFileUrl("scarceResourceObjectGc.var.qml")); object = varComponentThirteen.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("varProperty").isValid()); // not assigned yet QMetaObject::invokeMethod(object, "assignVarProperty"); QVERIFY(v4->scarceResources.isEmpty()); // the scarce resource is a VME property. @@ -4459,7 +4459,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that scarce resources are handled properly in signal invocation QQmlComponent variantComponentTen(&engine, testFileUrl("scarceResourceSignal.variant.qml")); object = variantComponentTen.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); srsc = object->findChild<QObject*>("srsc"); QVERIFY(srsc); QVERIFY(!srsc->property("scarceResourceCopy").isValid()); // hasn't been instantiated yet. @@ -4482,7 +4482,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that scarce resources are handled properly from js functions in qml files QQmlComponent variantComponentEleven(&engine, testFileUrl("scarceResourceFunction.variant.qml")); object = variantComponentEleven.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. @@ -4501,7 +4501,7 @@ void tst_qqmlecmascript::scarceResources_other() // test that if an exception occurs while invoking js function from cpp, that the resources are released. QQmlComponent variantComponentTwelve(&engine, testFileUrl("scarceResourceFunctionFail.variant.qml")); object = variantComponentTwelve.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->property("scarceResourceCopy").isValid()); // not yet assigned, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. @@ -4748,12 +4748,12 @@ void tst_qqmlecmascript::scarceResources() QFETCH(QStringList, expectedErrors); QV4::ExecutionEngine *v4 = engine.handle(); - ScarceResourceObject *eo = 0; - QObject *object = 0; + ScarceResourceObject *eo = nullptr; + QObject *object = nullptr; QQmlComponent c(&engine, qmlFile); object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); for (int i = 0; i < propertyNames.size(); ++i) { QString prop = propertyNames.at(i); bool validity = expectedValidity.at(i).toBool(); @@ -4781,7 +4781,7 @@ void tst_qqmlecmascript::propertyChangeSlots() // ensure that allowable property names are allowed and onPropertyNameChanged slots are generated correctly. QQmlComponent component(&engine, testFileUrl("changeslots/propertyChangeSlots.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; // ensure that invalid property names fail properly. @@ -4847,7 +4847,7 @@ void tst_qqmlecmascript::propertyVar() QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -4886,7 +4886,7 @@ void tst_qqmlecmascript::propertyQJSValue() QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -4896,14 +4896,14 @@ void tst_qqmlecmascript::propertyQJSValue() // Tests that we can write QVariant values to var properties from C++ void tst_qqmlecmascript::propertyVarCpp() { - QObject *object = 0; + QObject *object = nullptr; // ensure that writing to and reading from a var property from cpp works as required. // Literal values stored in var properties can be read and written as QVariants // of a specific type, whereas object values are read as QVariantMaps. QQmlComponent component(&engine, testFileUrl("propertyVarCpp.qml")); object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // assign int to property var that currently has int assigned QVERIFY(object->setProperty("varProperty", QVariant::fromValue(10))); QCOMPARE(object->property("varBound"), QVariant(15)); @@ -4926,7 +4926,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); QMetaObject::invokeMethod(object, "runTest"); QCOMPARE(object->property("test").toBool(), true); @@ -4936,7 +4936,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), false); QMetaObject::invokeMethod(object, "runTest"); QCOMPARE(object->property("test").toBool(), true); @@ -4946,7 +4946,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test2").toBool(), false); QCOMPARE(object->property("test2").toBool(), false); @@ -4970,7 +4970,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.4.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -4989,7 +4989,7 @@ void tst_qqmlecmascript::propertyVarOwnership() { QQmlComponent component(&engine, testFileUrl("propertyVarOwnership.5.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "createComponent"); engine.collectGarbage(); QMetaObject::invokeMethod(object, "runTest"); @@ -5005,20 +5005,20 @@ void tst_qqmlecmascript::propertyVarImplicitOwnership() // has implicit ownership of the constructed QObject. QQmlComponent component(&engine, testFileUrl("propertyVarImplicitOwnership.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rootObject = object->property("vp").value<QObject*>(); - QVERIFY(rootObject != 0); + QVERIFY(rootObject != nullptr); QObject *childObject = rootObject->findChild<QObject*>("text"); - QVERIFY(childObject != 0); + QVERIFY(childObject != nullptr); QCOMPARE(rootObject->property("rectCanary").toInt(), 5); QCOMPARE(childObject->property("textCanary").toInt(), 10); QMetaObject::invokeMethod(childObject, "constructQObject"); // creates a reference to a constructed QObject. QPointer<QObject> qobjectGuard(childObject->property("vp").value<QObject*>()); // get the pointer prior to processing deleteLater events. QVERIFY(!qobjectGuard.isNull()); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QVERIFY(!qobjectGuard.isNull()); QMetaObject::invokeMethod(object, "deassignCircular"); @@ -5032,9 +5032,9 @@ void tst_qqmlecmascript::propertyVarReparent() // ensure that nothing breaks if we re-parent objects QQmlComponent component(&engine, testFileUrl("propertyVar.reparent.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignVarProp"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); @@ -5074,9 +5074,9 @@ void tst_qqmlecmascript::propertyVarReparentNullContext() // this test ensures that no crash occurs in that situation. QQmlComponent component(&engine, testFileUrl("propertyVar.reparent.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignVarProp"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rect = object->property("vp").value<QObject*>(); QObject *text = rect->findChild<QObject*>("textOne"); @@ -5110,7 +5110,7 @@ void tst_qqmlecmascript::propertyVarCircular() // enforce behaviour regarding circular references - ensure qdvmemo deletion. QQmlComponent component(&engine, testFileUrl("propertyVar.circular.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc { QCOMPARE(object->property("canaryInt"), QVariant(5)); @@ -5118,7 +5118,7 @@ void tst_qqmlecmascript::propertyVarCircular() QVERIFY(canaryResourceVariant.isValid()); } - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QCOMPARE(object->property("canaryInt"), QVariant(5)); QVariant canaryResourceVariant = object->property("canaryResource"); @@ -5142,14 +5142,14 @@ void tst_qqmlecmascript::propertyVarCircular2() // where the child has a var property referencing its parent. QQmlComponent component(&engine, testFileUrl("propertyVar.circular.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rootObject = object->property("vp").value<QObject*>(); - QVERIFY(rootObject != 0); + QVERIFY(rootObject != nullptr); QObject *childObject = rootObject->findChild<QObject*>("text"); - QVERIFY(childObject != 0); + QVERIFY(childObject != nullptr); QPointer<QObject> rootObjectTracker(rootObject); QVERIFY(!rootObjectTracker.isNull()); QPointer<QObject> childObjectTracker(childObject); @@ -5170,9 +5170,9 @@ void tst_qqmlecmascript::propertyVarInheritance() // The particular component under test here has a chain of references. QQmlComponent component(&engine, testFileUrl("propertyVar.inherit.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); // cause assignment and gc - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); // we want to be able to track when the varProperties array of the last metaobject is disposed QObject *cco5 = object->property("varProperty").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>()->property("vp").value<QObject*>(); @@ -5215,14 +5215,14 @@ void tst_qqmlecmascript::propertyVarInheritance2() // only link between rootObject and childObject is that rootObject is the parent of childObject. QQmlComponent component(&engine, testFileUrl("propertyVar.circular.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "assignCircular"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // process deleteLater() events from QV8QObjectWrapper. QCoreApplication::processEvents(); QObject *rootObject = object->property("vp").value<QObject*>(); - QVERIFY(rootObject != 0); + QVERIFY(rootObject != nullptr); QObject *childObject = rootObject->findChild<QObject*>("text"); - QVERIFY(childObject != 0); + QVERIFY(childObject != nullptr); QCOMPARE(rootObject->property("rectCanary").toInt(), 5); QCOMPARE(childObject->property("textCanary").toInt(), 10); QV4::WeakValue childObjectVarArrayValueHandle; @@ -5249,7 +5249,7 @@ void tst_qqmlecmascript::elementAssign() QQmlComponent component(&engine, testFileUrl("elementAssign.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -5262,7 +5262,7 @@ void tst_qqmlecmascript::objectPassThroughSignals() QQmlComponent component(&engine, testFileUrl("objectsPassThroughSignals.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -5275,7 +5275,7 @@ void tst_qqmlecmascript::objectConversion() QQmlComponent component(&engine, testFileUrl("objectConversion.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant retn; QMetaObject::invokeMethod(object, "circularObject", Q_RETURN_ARG(QVariant, retn)); QCOMPARE(retn.value<QJSValue>().property("test").toInt(), int(100)); @@ -5290,7 +5290,7 @@ void tst_qqmlecmascript::booleanConversion() QQmlComponent component(&engine, testFileUrl("booleanConversion.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test_true1").toBool(), true); QCOMPARE(object->property("test_true2").toBool(), true); @@ -5313,7 +5313,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.object.1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); CircularReferenceObject *cro = object->findChild<CircularReferenceObject*>("cro"); cro->setDtorCount(&dtorCount); QMetaObject::invokeMethod(object, "createReference"); @@ -5321,7 +5321,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QCOMPARE(dtorCount, 0); // second has JS ownership, kept alive by first's reference delete object; hrmEngine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QCOMPARE(dtorCount, 3); } @@ -5332,7 +5332,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.object.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); CircularReferenceObject *cro = object->findChild<CircularReferenceObject*>("cro"); cro->setDtorCount(&dtorCount); QMetaObject::invokeMethod(object, "circularReference"); @@ -5340,7 +5340,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QCOMPARE(dtorCount, 2); // both should be cleaned up, since circular references shouldn't keep alive. delete object; hrmEngine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QCOMPARE(dtorCount, 3); } @@ -5350,7 +5350,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.dynprop.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "createReference"); gc(hrmEngine); QMetaObject::invokeMethod(object, "ensureReference"); @@ -5367,7 +5367,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.dynprop.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "createReference"); gc(hrmEngine); QMetaObject::invokeMethod(object, "ensureReference"); @@ -5384,7 +5384,7 @@ void tst_qqmlecmascript::handleReferenceManagement() QQmlEngine hrmEngine; QQmlComponent component(&hrmEngine, testFileUrl("handleReferenceManagement.dynprop.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "createReference"); gc(hrmEngine); QMetaObject::invokeMethod(object, "ensureReference"); @@ -5401,7 +5401,7 @@ void tst_qqmlecmascript::stringArg() { QQmlComponent component(&engine, testFileUrl("stringArg.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "success"); QVERIFY(object->property("returnValue").toBool()); @@ -5418,7 +5418,7 @@ void tst_qqmlecmascript::readonlyDeclaration() QQmlComponent component(&engine, testFileUrl("readonlyDeclaration.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -5436,9 +5436,9 @@ void tst_qqmlecmascript::sequenceConversionRead() QUrl qmlFile = testFileUrl("sequenceConversion.read.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco"); - QVERIFY(seq != 0); + QVERIFY(seq != nullptr); QMetaObject::invokeMethod(object, "readSequences"); QList<int> intList; intList << 1 << 2 << 3 << 4; @@ -5487,9 +5487,9 @@ void tst_qqmlecmascript::sequenceConversionRead() QUrl qmlFile = testFileUrl("sequenceConversion.read.error.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco"); - QVERIFY(seq != 0); + QVERIFY(seq != nullptr); // we haven't registered QList<NonRegisteredType> as a sequence type. QString warningOne = QLatin1String("QMetaProperty::read: Unable to handle unregistered datatype 'QList<NonRegisteredType>' for property 'MySequenceConversionObject::typeListProperty'"); @@ -5516,9 +5516,9 @@ void tst_qqmlecmascript::sequenceConversionWrite() QUrl qmlFile = testFileUrl("sequenceConversion.write.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco"); - QVERIFY(seq != 0); + QVERIFY(seq != nullptr); QMetaObject::invokeMethod(object, "writeSequences"); QCOMPARE(object->property("success").toBool(), true); @@ -5539,9 +5539,9 @@ void tst_qqmlecmascript::sequenceConversionWrite() QUrl qmlFile = testFileUrl("sequenceConversion.write.error.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *seq = object->findChild<MySequenceConversionObject*>("msco"); - QVERIFY(seq != 0); + QVERIFY(seq != nullptr); // we haven't registered QList<QPoint> as a sequence type, so writing shouldn't work. QString warningOne = qmlFile.toString() + QLatin1String(":16: Error: Cannot assign QJSValue to QList<QPoint>"); @@ -5562,7 +5562,7 @@ void tst_qqmlecmascript::sequenceConversionArray() QUrl qmlFile = testFileUrl("sequenceConversion.array.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "indexedAccess"); QVERIFY(object->property("success").toBool()); QMetaObject::invokeMethod(object, "arrayOperations"); @@ -5582,7 +5582,7 @@ void tst_qqmlecmascript::sequenceConversionIndexes() QUrl qmlFile = testFileUrl("sequenceConversion.indexes.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString w1 = qmlFile.toString() + QLatin1String(":34: Index out of range during length set"); QString w2 = qmlFile.toString() + QLatin1String(":41: Index out of range during indexed set"); QString w3 = qmlFile.toString() + QLatin1String(":48: Index out of range during indexed get"); @@ -5603,7 +5603,7 @@ void tst_qqmlecmascript::sequenceConversionThreads() QUrl qmlFile = testFileUrl("sequenceConversion.threads.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "testIntSequence"); QTRY_VERIFY(object->property("finished").toBool()); @@ -5642,7 +5642,7 @@ void tst_qqmlecmascript::sequenceConversionBindings() QUrl qmlFile = testFileUrl("sequenceConversion.bindings.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QList<int> intList; intList << 1 << 2 << 3 << 12 << 7; QCOMPARE(object->property("boundSequence").value<QList<int> >(), intList); QCOMPARE(object->property("boundElement").toInt(), intList.at(3)); @@ -5657,7 +5657,7 @@ void tst_qqmlecmascript::sequenceConversionBindings() QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } } @@ -5667,7 +5667,7 @@ void tst_qqmlecmascript::sequenceConversionCopy() QUrl qmlFile = testFileUrl("sequenceConversion.copy.qml"); QQmlComponent component(&engine, qmlFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "testCopySequences"); QCOMPARE(object->property("success").toBool(), true); QMetaObject::invokeMethod(object, "readSequenceCopyElements"); @@ -5687,7 +5687,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.1.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1 << 2)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1 << 2.2 << 3)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false << true)); @@ -5701,7 +5701,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.2.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false)); @@ -5715,7 +5715,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.3.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false)); @@ -5727,7 +5727,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.4.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1 << 2)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1 << 2.2 << 3)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false << true)); @@ -5741,7 +5741,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.5.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1.1)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false)); @@ -5755,7 +5755,7 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.6.qml")); MySequenceConversionObject *object = qobject_cast<MySequenceConversionObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->intListProperty(), (QList<int>() << 1)); QCOMPARE(object->qrealListProperty(), (QList<qreal>() << 1)); QCOMPARE(object->boolListProperty(), (QList<bool>() << false)); @@ -5767,13 +5767,13 @@ void tst_qqmlecmascript::assignSequenceTypes() { QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.7.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *msco1 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco1")); MySequenceConversionObject *msco2 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco2")); MySequenceConversionObject *msco3 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco3")); MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4")); MySequenceConversionObject *msco5 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco5")); - QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0 && msco5 != 0); + QVERIFY(msco1 != nullptr && msco2 != nullptr && msco3 != nullptr && msco4 != nullptr && msco5 != nullptr); QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")))); QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")))); QCOMPARE(msco3->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")) << QUrl(testFileUrl("example2.html")))); @@ -5790,9 +5790,9 @@ void tst_qqmlecmascript::nullObjectBinding() QQmlComponent component(&engine, testFileUrl("nullObjectBinding.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QVERIFY(object->property("test") == QVariant::fromValue((QObject *)0)); + QVERIFY(object->property("test") == QVariant::fromValue((QObject *)nullptr)); delete object; } @@ -5847,7 +5847,7 @@ void tst_qqmlecmascript::deletedEngine() QQmlComponent component(engine, testFileUrl("deletedEngine.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 39); object->setProperty("b", QVariant(9)); @@ -5869,7 +5869,7 @@ void tst_qqmlecmascript::libraryScriptAssert() QQmlComponent component(&engine, testFileUrl("libraryScriptAssert.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -5879,7 +5879,7 @@ void tst_qqmlecmascript::variantsAssignedUndefined() QQmlComponent component(&engine, testFileUrl("variantsAssignedUndefined.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toInt(), 10); QCOMPARE(object->property("test2").toInt(), 11); @@ -5898,7 +5898,7 @@ void tst_qqmlecmascript::variants() QQmlComponent component(&engine, testFileUrl("variants.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("undefinedVariant").type(), QVariant::Invalid); QCOMPARE(int(object->property("nullVariant").type()), int(QMetaType::Nullptr)); @@ -5923,7 +5923,7 @@ void tst_qqmlecmascript::qtbug_9792() QQmlContext *context = new QQmlContext(engine.rootContext()); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create(context)); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtDebugMsg, "Hello world!"); object->basicSignal(); @@ -5945,10 +5945,10 @@ void tst_qqmlecmascript::qtcreatorbug_1289() QQmlComponent component(&engine, testFileUrl("qtcreatorbug_1289.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QObject *nested = qvariant_cast<QObject *>(o->property("object")); - QVERIFY(nested != 0); + QVERIFY(nested != nullptr); QVERIFY(qvariant_cast<QObject *>(nested->property("nestedObject")) == o); @@ -5995,9 +5995,9 @@ void tst_qqmlecmascript::canAssignNullToQObject() QQmlComponent component(&engine, testFileUrl("canAssignNullToQObject.1.qml")); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); - QVERIFY(o->objectProperty() != 0); + QVERIFY(o->objectProperty() != nullptr); o->setProperty("runTest", true); @@ -6010,7 +6010,7 @@ void tst_qqmlecmascript::canAssignNullToQObject() QQmlComponent component(&engine, testFileUrl("canAssignNullToQObject.2.qml")); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!o->objectProperty()); @@ -6033,7 +6033,7 @@ void tst_qqmlecmascript::functionAssignment_fromBinding() QTest::ignoreMessage(QtWarningMsg, w4.toLatin1().constData()); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!o->property("a").isValid()); @@ -6048,7 +6048,7 @@ void tst_qqmlecmascript::functionAssignment_fromJS() QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!o->property("a").isValid()); o->setProperty("aNumber", QVariant(5)); @@ -6080,7 +6080,7 @@ void tst_qqmlecmascript::functionAssignmentfromJS_invalid() QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); MyQmlObject *o = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(!o->property("a").isValid()); o->setProperty("assignFuncWithoutReturn", true); @@ -6107,7 +6107,7 @@ void tst_qqmlecmascript::functionAssignment_afterBinding() QTest::ignoreMessage(QtWarningMsg, w1.toLatin1().constData()); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("t1"), QVariant::fromValue<int>(4)); // should have bound QCOMPARE(o->property("t2"), QVariant::fromValue<int>(2)); // should not have changed @@ -6119,7 +6119,7 @@ void tst_qqmlecmascript::eval() QQmlComponent component(&engine, testFileUrl("eval.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); @@ -6135,7 +6135,7 @@ void tst_qqmlecmascript::function() QQmlComponent component(&engine, testFileUrl("function.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); @@ -6151,7 +6151,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, testFileUrl("include.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test0").toInt(), 99); QCOMPARE(o->property("test1").toBool(), true); @@ -6167,7 +6167,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, testFileUrl("include_shared.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test0").toInt(), 99); QCOMPARE(o->property("test1").toBool(), true); @@ -6183,7 +6183,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, testFileUrl("include_callback.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); @@ -6199,7 +6199,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, testFileUrl("include_pragma.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toInt(), 100); delete o; @@ -6213,7 +6213,7 @@ void tst_qqmlecmascript::include() QQmlComponent component(&engine, testFileUrl("include_remote_missing.qml")); QObject *o = component.beginCreate(engine.rootContext()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); o->setProperty("serverBaseUrl", server.baseUrl().toString()); component.completeCreate(); @@ -6230,7 +6230,7 @@ void tst_qqmlecmascript::include() { QQmlComponent component(&engine, QUrl("qrc:///data/include.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test0").toInt(), 99); QCOMPARE(o->property("test1").toBool(), true); @@ -6253,7 +6253,7 @@ void tst_qqmlecmascript::includeRemoteSuccess() QQmlComponent component(&engine, testFileUrl("include_remote.qml")); QObject *o = component.beginCreate(engine.rootContext()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); o->setProperty("serverBaseUrl", server.baseUrl().toString()); component.completeCreate(); @@ -6279,7 +6279,7 @@ void tst_qqmlecmascript::signalHandlers() { QQmlComponent component(&engine, testFileUrl("signalHandlers.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("count").toInt(), 0); QMetaObject::invokeMethod(o, "testSignalCall"); @@ -6340,7 +6340,7 @@ void tst_qqmlecmascript::qtbug_10696() { QQmlComponent component(&engine, testFileUrl("qtbug_10696.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; } @@ -6348,7 +6348,7 @@ void tst_qqmlecmascript::qtbug_11606() { QQmlComponent component(&engine, testFileUrl("qtbug_11606.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6357,7 +6357,7 @@ void tst_qqmlecmascript::qtbug_11600() { QQmlComponent component(&engine, testFileUrl("qtbug_11600.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6366,7 +6366,7 @@ void tst_qqmlecmascript::qtbug_21864() { QQmlComponent component(&engine, testFileUrl("qtbug_21864.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6377,7 +6377,7 @@ void tst_qqmlecmascript::rewriteMultiLineStrings() // QTBUG-23387 QQmlComponent component(&engine, testFileUrl("rewriteMultiLineStrings.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QTRY_COMPARE(o->property("test").toBool(), true); delete o; } @@ -6385,7 +6385,7 @@ void tst_qqmlecmascript::rewriteMultiLineStrings() { QQmlComponent component(&engine, testFileUrl("rewriteMultiLineStrings_crlf.1.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; } } @@ -6399,7 +6399,7 @@ void tst_qqmlecmascript::qobjectConnectionListExceptionHandling() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6409,7 +6409,7 @@ void tst_qqmlecmascript::nonscriptable() { QQmlComponent component(&engine, testFileUrl("nonscriptable.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("readOk").toBool(), true); QCOMPARE(o->property("writeOk").toBool(), true); delete o; @@ -6420,7 +6420,7 @@ void tst_qqmlecmascript::deleteLater() { QQmlComponent component(&engine, testFileUrl("deleteLater.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -6430,7 +6430,7 @@ void tst_qqmlecmascript::objectNameChangedSignal() { QQmlComponent component(&engine, testFileUrl("objectNameChangedSignal.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), false); o->setObjectName("obj"); QCOMPARE(o->property("test").toBool(), true); @@ -6451,7 +6451,7 @@ void tst_qqmlecmascript::in() { QQmlComponent component(&engine, testFileUrl("in.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); delete o; @@ -6462,7 +6462,7 @@ void tst_qqmlecmascript::typeOf() QQmlComponent component(&engine, testFileUrl("typeOf.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toString(), QLatin1String("undefined")); QCOMPARE(o->property("test2").toString(), QLatin1String("object")); @@ -6481,7 +6481,7 @@ void tst_qqmlecmascript::qtbug_24448() { QQmlComponent component(&engine, testFileUrl("qtbug_24448.qml")); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(o->property("test").toBool()); } @@ -6489,7 +6489,7 @@ void tst_qqmlecmascript::sharedAttachedObject() { QQmlComponent component(&engine, testFileUrl("sharedAttachedObject.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); delete o; @@ -6500,7 +6500,7 @@ void tst_qqmlecmascript::objectName() { QQmlComponent component(&engine, testFileUrl("objectName.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toString(), QString("hello")); QCOMPARE(o->property("test2").toString(), QString("ell")); @@ -6517,7 +6517,7 @@ void tst_qqmlecmascript::writeRemovesBinding() { QQmlComponent component(&engine, testFileUrl("writeRemovesBinding.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6529,7 +6529,7 @@ void tst_qqmlecmascript::aliasBindingsAssignCorrectly() { QQmlComponent component(&engine, testFileUrl("aliasBindingsAssignCorrectly.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6542,7 +6542,7 @@ void tst_qqmlecmascript::aliasBindingsOverrideTarget() { QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6552,7 +6552,7 @@ void tst_qqmlecmascript::aliasBindingsOverrideTarget() { QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.2.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6562,7 +6562,7 @@ void tst_qqmlecmascript::aliasBindingsOverrideTarget() { QQmlComponent component(&engine, testFileUrl("aliasBindingsOverrideTarget.3.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6576,7 +6576,7 @@ void tst_qqmlecmascript::aliasWritesOverrideBindings() { QQmlComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6586,7 +6586,7 @@ void tst_qqmlecmascript::aliasWritesOverrideBindings() { QQmlComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.2.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6596,7 +6596,7 @@ void tst_qqmlecmascript::aliasWritesOverrideBindings() { QQmlComponent component(&engine, testFileUrl("aliasWritesOverrideBindings.3.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -6611,7 +6611,7 @@ void tst_qqmlecmascript::aliasToCompositeElement() QQmlComponent component(&engine, testFileUrl("aliasToCompositeElement.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -6624,7 +6624,7 @@ void tst_qqmlecmascript::qtbug_20344() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -6643,7 +6643,7 @@ void tst_qqmlecmascript::revisionErrors() QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData()); QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData()); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } { @@ -6665,7 +6665,7 @@ void tst_qqmlecmascript::revisionErrors() QTest::ignoreMessage(QtWarningMsg, warning4.toLatin1().constData()); QTest::ignoreMessage(QtWarningMsg, warning5.toLatin1().constData()); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } { @@ -6681,7 +6681,7 @@ void tst_qqmlecmascript::revisionErrors() QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData()); QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData()); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } } @@ -6693,7 +6693,7 @@ void tst_qqmlecmascript::revision() QString url = component.url().toString(); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } { @@ -6701,7 +6701,7 @@ void tst_qqmlecmascript::revision() QString url = component.url().toString(); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } { @@ -6709,7 +6709,7 @@ void tst_qqmlecmascript::revision() QString url = component.url().toString(); MyRevisionedClass *object = qobject_cast<MyRevisionedClass *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } // Test that non-root classes can resolve revisioned methods @@ -6717,7 +6717,7 @@ void tst_qqmlecmascript::revision() QQmlComponent component(&engine, testFileUrl("metaobjectRevision4.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toReal(), 11.); delete object; } @@ -6726,7 +6726,7 @@ void tst_qqmlecmascript::revision() QQmlComponent component(&engine, testFileUrl("metaobjectRevision5.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toReal(), 11.); delete object; } @@ -6736,7 +6736,7 @@ void tst_qqmlecmascript::realToInt() { QQmlComponent component(&engine, testFileUrl("realToInt.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "test1"); QCOMPARE(object->value(), int(4)); @@ -6749,7 +6749,7 @@ void tst_qqmlecmascript::urlProperty() { QQmlComponent component(&engine, testFileUrl("urlProperty.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->setStringProperty("http://qt-project.org"); QCOMPARE(object->urlProperty(), QUrl("http://qt-project.org/index.html")); QCOMPARE(object->intProperty(), 123); @@ -6763,7 +6763,7 @@ void tst_qqmlecmascript::urlPropertyWithEncoding() { QQmlComponent component(&engine, testFileUrl("urlProperty.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->setStringProperty("http://qt-project.org"); const QUrl encoded = QUrl::fromEncoded("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); QCOMPARE(object->urlProperty(), encoded); @@ -6777,12 +6777,12 @@ void tst_qqmlecmascript::urlListPropertyWithEncoding() { QQmlComponent component(&engine, testFileUrl("urlListProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MySequenceConversionObject *msco1 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco1")); MySequenceConversionObject *msco2 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco2")); MySequenceConversionObject *msco3 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco3")); MySequenceConversionObject *msco4 = object->findChild<MySequenceConversionObject *>(QLatin1String("msco4")); - QVERIFY(msco1 != 0 && msco2 != 0 && msco3 != 0 && msco4 != 0); + QVERIFY(msco1 != nullptr && msco2 != nullptr && msco3 != nullptr && msco4 != nullptr); const QUrl encoded = QUrl::fromEncoded("http://qt-project.org/?get%3cDATA%3e", QUrl::TolerantMode); QCOMPARE(msco1->urlListProperty(), (QList<QUrl>() << encoded)); QCOMPARE(msco2->urlListProperty(), (QList<QUrl>() << encoded)); @@ -6796,7 +6796,7 @@ void tst_qqmlecmascript::dynamicString() { QQmlComponent component(&engine, testFileUrl("dynamicString.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("stringProperty").toString(), QString::fromLatin1("string:Hello World false:0 true:1 uint32:100 int32:-100 double:3.14159 date:2011-02-11 05::30:50!")); } @@ -6805,35 +6805,35 @@ void tst_qqmlecmascript::deleteLaterObjectMethodCall() { QQmlComponent component(&engine, testFileUrl("deleteLaterObjectMethodCall.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::automaticSemicolon() { QQmlComponent component(&engine, testFileUrl("automaticSemicolon.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::compatibilitySemicolon() { QQmlComponent component(&engine, testFileUrl("compatibilitySemicolon.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::incrDecrSemicolon1() { QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::incrDecrSemicolon2() { QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::incrDecrSemicolon_error1() @@ -6847,7 +6847,7 @@ void tst_qqmlecmascript::unaryExpression() { QQmlComponent component(&engine, testFileUrl("unaryExpression.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } // Makes sure that a binding isn't double re-evaluated when it depends on the same variable twice @@ -6855,9 +6855,9 @@ void tst_qqmlecmascript::doubleEvaluate() { QQmlComponent component(&engine, testFileUrl("doubleEvaluate.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); WriteCounter *wc = qobject_cast<WriteCounter *>(object); - QVERIFY(wc != 0); + QVERIFY(wc != nullptr); QCOMPARE(wc->count(), 1); wc->setProperty("x", 9); @@ -6875,7 +6875,7 @@ void tst_qqmlecmascript::nonNotifyable() QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString expected1 = QLatin1String("QQmlExpression: Expression ") + component.url().toString() + @@ -6907,7 +6907,7 @@ void tst_qqmlecmascript::forInLoop() { QQmlComponent component(&engine, testFileUrl("forInLoop.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaObject::invokeMethod(object, "listProperty"); @@ -6927,7 +6927,7 @@ void tst_qqmlecmascript::deleteWhileBindingRunning() { QQmlComponent component(&engine, testFileUrl("deleteWhileBindingRunning.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -6942,7 +6942,7 @@ void tst_qqmlecmascript::qtbug_22679() QSignalSpy warningsSpy(&engine, SIGNAL(warnings(QList<QQmlError>))); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(warningsSpy.count(), 0); delete o; } @@ -6979,7 +6979,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7002,7 +7002,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7025,7 +7025,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.3.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7052,7 +7052,7 @@ void tst_qqmlecmascript::switchStatement() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7076,7 +7076,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.5.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7099,7 +7099,7 @@ void tst_qqmlecmascript::switchStatement() { QQmlComponent component(&engine, testFileUrl("switchStatement.6.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // `object->value()' is the number of executed statements @@ -7126,7 +7126,7 @@ void tst_qqmlecmascript::withStatement() QUrl url = testFileUrl("withStatement.1.qml"); QQmlComponent component(&engine, url); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 123); } @@ -7137,7 +7137,7 @@ void tst_qqmlecmascript::tryStatement() { QQmlComponent component(&engine, testFileUrl("tryStatement.1.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 123); } @@ -7145,7 +7145,7 @@ void tst_qqmlecmascript::tryStatement() { QQmlComponent component(&engine, testFileUrl("tryStatement.2.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 321); } @@ -7153,7 +7153,7 @@ void tst_qqmlecmascript::tryStatement() { QQmlComponent component(&engine, testFileUrl("tryStatement.3.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 1); } @@ -7161,7 +7161,7 @@ void tst_qqmlecmascript::tryStatement() { QQmlComponent component(&engine, testFileUrl("tryStatement.4.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->value(), 1); } @@ -7199,7 +7199,7 @@ void tst_qqmlecmascript::invokableWithQObjectDerived() QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("result").value<bool>()); delete object; @@ -7211,7 +7211,7 @@ void tst_qqmlecmascript::realTypePrecision() // Properties and signal parameters of type real should have double precision. QQmlComponent component(&engine, testFileUrl("realTypePrecision.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toDouble(), 1234567890.); QCOMPARE(object->property("test2").toDouble(), 1234567890.); QCOMPARE(object->property("test3").toDouble(), 1234567890.); @@ -7225,7 +7225,7 @@ void tst_qqmlecmascript::registeredFlagMethod() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("registeredFlagMethod.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->buttons(), 0); emit object->basicSignal(); @@ -7240,7 +7240,7 @@ void tst_qqmlecmascript::replaceBinding() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("replaceBinding.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(obj->property("success").toBool()); delete obj; @@ -7252,7 +7252,7 @@ void tst_qqmlecmascript::deleteRootObjectInCreation() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("deleteRootObjectInCreation.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(obj->property("rootIndestructible").toBool()); QVERIFY(!obj->property("childDestructible").toBool()); QTest::qWait(1); @@ -7263,7 +7263,7 @@ void tst_qqmlecmascript::deleteRootObjectInCreation() { QQmlComponent c(&engine, testFileUrl("deleteRootObjectInCreation.2.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("testConditionsMet").toBool()); delete object; } @@ -7277,9 +7277,9 @@ void tst_qqmlecmascript::onDestruction() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("onDestruction.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); delete obj; - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); } { @@ -7290,8 +7290,8 @@ void tst_qqmlecmascript::onDestruction() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("onDestruction.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QVERIFY(obj != nullptr); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); } } @@ -7402,7 +7402,7 @@ struct EventProcessor : public QObject public: Q_INVOKABLE void process() { - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } }; @@ -7417,7 +7417,7 @@ void tst_qqmlecmascript::bindingSuppression() QQmlComponent c(&engine, testFileUrl("bindingSuppression.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); delete obj; QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); @@ -7430,7 +7430,7 @@ void tst_qqmlecmascript::signalEmitted() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("signalEmitted.2.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QTRY_VERIFY(obj->property("success").toBool()); delete obj; } @@ -7440,7 +7440,7 @@ void tst_qqmlecmascript::signalEmitted() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("signalEmitted.3.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); gc(engine); // should collect c1. QTRY_VERIFY(obj->property("success").toBool()); delete obj; @@ -7451,7 +7451,7 @@ void tst_qqmlecmascript::signalEmitted() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("signalEmitted.4.qml")); QObject *obj = c.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); gc(engine); // should collect c1. QMetaObject::invokeMethod(obj, "destroyC2"); QTRY_VERIFY(obj->property("success").toBool()); // handles events (incl. delete later). @@ -7484,12 +7484,12 @@ void tst_qqmlecmascript::qqmldataDestroyed() { QQmlComponent c(&engine, testFileUrl("qqmldataDestroyed.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // now gc causing the collection of the dynamically constructed object. engine.collectGarbage(); engine.collectGarbage(); // now process events to allow deletion (calling qqmldata::destroyed()) - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); // shouldn't crash. delete object; @@ -7500,7 +7500,7 @@ void tst_qqmlecmascript::qqmldataDestroyed() { QQmlComponent c(&engine, testFileUrl("qqmldataDestroyed.2.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("testConditionsMet").toBool()); // the gc() within the handler will have triggered the weak // qobject reference callback. If that incorrectly disposes @@ -7515,7 +7515,7 @@ void tst_qqmlecmascript::secondAlias() { QQmlComponent c(&engine, testFileUrl("secondAlias.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 200); delete object; } @@ -7525,7 +7525,7 @@ void tst_qqmlecmascript::varAlias() { QQmlComponent c(&engine, testFileUrl("varAlias.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 192); delete object; } @@ -7535,7 +7535,7 @@ void tst_qqmlecmascript::overrideDataAssert() { QQmlComponent c(&engine, testFileUrl("overrideDataAssert.qml")); QObject *object = c.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->metaObject(); delete object; } @@ -7560,7 +7560,7 @@ void tst_qqmlecmascript::fallbackBindings() QQmlComponent component(&engine, testFileUrl(source)); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } @@ -7569,7 +7569,7 @@ void tst_qqmlecmascript::propertyOverride() { QQmlComponent component(&engine, testFileUrl("propertyOverride.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } @@ -7605,9 +7605,9 @@ void tst_qqmlecmascript::sequenceSort() QQmlComponent component(&engine, testFileUrl("sequenceSort.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QMetaObject::invokeMethod(object, function.toLatin1().constData(), Q_RETURN_ARG(QVariant, q), Q_ARG(QVariant, useComparer)); @@ -7621,9 +7621,9 @@ void tst_qqmlecmascript::dateParse() QQmlComponent component(&engine, testFileUrl("date.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QMetaObject::invokeMethod(object, "test_is_invalid_jsDateTime", Q_RETURN_ARG(QVariant, q)); @@ -7641,9 +7641,9 @@ void tst_qqmlecmascript::utcDate() QQmlComponent component(&engine, testFileUrl("utcdate.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QVariant val = QString::fromLatin1("2014-07-16T23:30:31"); @@ -7656,9 +7656,9 @@ void tst_qqmlecmascript::negativeYear() QQmlComponent component(&engine, testFileUrl("negativeyear.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QMetaObject::invokeMethod(object, "check_negative_tostring", Q_RETURN_ARG(QVariant, q)); @@ -7721,7 +7721,7 @@ void tst_qqmlecmascript::updateCall() QString file("updateCall.qml"); QQmlComponent component(&engine, testFileUrl(file)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlecmascript::numberParsing() @@ -7731,7 +7731,7 @@ void tst_qqmlecmascript::numberParsing() file = file.arg(i); QQmlComponent component(&engine, testFileUrl(file)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } for (int i = 1; i < 3; ++i) { QString file("numberParsing_error.%1.qml"); @@ -7769,7 +7769,7 @@ void tst_qqmlecmascript::qtbug_32801() QQmlComponent component(&engine, testFileUrl("qtbug_32801.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); // do not crash when a QML signal is connected to a non-void slot connect(obj.data(), SIGNAL(testSignal(QString)), obj.data(), SLOT(slotWithReturnValue(QString))); @@ -7790,7 +7790,7 @@ void tst_qqmlecmascript::qtbug_33754() QQmlComponent component(&engine, testFileUrl("qtbug_33754.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); } void tst_qqmlecmascript::qtbug_34493() @@ -7801,7 +7801,7 @@ void tst_qqmlecmascript::qtbug_34493() if (component.errors().size()) qDebug() << component.errors(); QVERIFY(component.errors().isEmpty()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(QMetaObject::invokeMethod(obj.data(), "doIt")); QTRY_VERIFY(obj->property("prop").toString() == QLatin1String("Hello World!")); } @@ -7815,7 +7815,7 @@ void tst_qqmlecmascript::singletonFromQMLToCpp() if (component.errors().size()) qDebug() << component.errors(); QVERIFY(component.errors().isEmpty()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("qobjectTest"), QVariant(true)); QCOMPARE(obj->property("myQmlObjectTest"), QVariant(true)); @@ -7832,7 +7832,7 @@ void tst_qqmlecmascript::singletonFromQMLAndBackAndCompare() if (component.errors().size()) qDebug() << component.errors(); QVERIFY(component.errors().isEmpty()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("myInheritedQmlObjectTest1"), QVariant(true)); QCOMPARE(o->property("myInheritedQmlObjectTest2"), QVariant(true)); @@ -7875,9 +7875,9 @@ void tst_qqmlecmascript::miscTypeTest() QQmlComponent component(&engine, testFileUrl("misctypetest.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant q; QMetaObject::invokeMethod(object, "test_invalid_url_equal", Q_RETURN_ARG(QVariant, q)); @@ -7913,9 +7913,9 @@ void tst_qqmlecmascript::qtbug_34792() QQmlComponent component(&engine, testFileUrl("qtbug34792.qml")); QObject *object = component.create(); - if (object == 0) + if (object == nullptr) qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -8069,7 +8069,7 @@ class ObjectContainer : public QObject Q_PROPERTY(ContainedObject1 *object1 READ object1 WRITE setObject1) Q_PROPERTY(ContainedObject2 *object2 READ object2 WRITE setObject2) public: - explicit ObjectContainer(QObject *parent = 0) : + explicit ObjectContainer(QObject *parent = nullptr) : QObject(parent), mGetterCalled(false), mSetterCalled(false) @@ -8079,7 +8079,7 @@ public: ContainedObject1 *object1() { mGetterCalled = true; - return 0; + return nullptr; } void setObject1(ContainedObject1 *) @@ -8090,7 +8090,7 @@ public: ContainedObject2 *object2() { mGetterCalled = true; - return 0; + return nullptr; } void setObject2(ContainedObject2 *) @@ -8155,7 +8155,7 @@ void tst_qqmlecmascript::qtbug_46022() QQmlComponent component(&engine, testFileUrl("qtbug_46022.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("test1").toBool(), true); QCOMPARE(obj->property("test2").toBool(), true); } @@ -8176,7 +8176,7 @@ void tst_qqmlecmascript::qtbug_54589() QQmlComponent component(&engine, testFileUrl("qtbug_54589.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("result").toBool(), true); } @@ -8192,7 +8192,7 @@ void tst_qqmlecmascript::stringify_qtbug_50592() QQmlComponent component(&engine, testFileUrl("stringify_qtbug_50592.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png")); } @@ -8379,7 +8379,7 @@ void tst_qqmlecmascript::singleBlockLoops() QQmlComponent component(&engine, testFileUrl("qtbug_59012.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(!component.isError()); } diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index d6d7506c48..bf964a5744 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -107,7 +107,7 @@ void tst_qqmlengine::rootContext() class NetworkAccessManagerFactory : public QQmlNetworkAccessManagerFactory { public: - NetworkAccessManagerFactory() : manager(0) {} + NetworkAccessManagerFactory() : manager(nullptr) {} QNetworkAccessManager *create(QObject *parent) { manager = new QNetworkAccessManager(parent); @@ -123,7 +123,7 @@ void tst_qqmlengine::networkAccessManager() // Test QQmlEngine created manager QPointer<QNetworkAccessManager> manager = engine->networkAccessManager(); - QVERIFY(manager != 0); + QVERIFY(manager != nullptr); delete engine; // Test factory created manager @@ -155,10 +155,10 @@ class ImmediateManager : public QNetworkAccessManager { Q_OBJECT public: - ImmediateManager(QObject *parent = 0) : QNetworkAccessManager(parent) { + ImmediateManager(QObject *parent = nullptr) : QNetworkAccessManager(parent) { } - QNetworkReply *createRequest(Operation, const QNetworkRequest & , QIODevice * outgoingData = 0) { + QNetworkReply *createRequest(Operation, const QNetworkRequest & , QIODevice * outgoingData = nullptr) { Q_UNUSED(outgoingData); return new ImmediateReply; } @@ -212,17 +212,17 @@ void tst_qqmlengine::contextForObject() QQmlEngine *engine = new QQmlEngine; // Test null-object - QVERIFY(!QQmlEngine::contextForObject(0)); + QVERIFY(!QQmlEngine::contextForObject(nullptr)); // Test an object with no context QObject object; QVERIFY(!QQmlEngine::contextForObject(&object)); // Test setting null-object - QQmlEngine::setContextForObject(0, engine->rootContext()); + QQmlEngine::setContextForObject(nullptr, engine->rootContext()); // Test setting null-context - QQmlEngine::setContextForObject(&object, 0); + QQmlEngine::setContextForObject(&object, nullptr); // Test setting context QQmlEngine::setContextForObject(&object, engine->rootContext()); @@ -236,7 +236,7 @@ void tst_qqmlengine::contextForObject() QCOMPARE(QQmlEngine::contextForObject(&object), engine->rootContext()); // Delete context - delete engine; engine = 0; + delete engine; engine = nullptr; QVERIFY(!QQmlEngine::contextForObject(&object)); } @@ -313,7 +313,7 @@ void tst_qqmlengine::clearComponentCache() { QQmlComponent component(&engine, fileUrl); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("test").toInt(), 10); delete obj; } @@ -336,7 +336,7 @@ void tst_qqmlengine::clearComponentCache() { QQmlComponent component(&engine, fileUrl); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("test").toInt(), 10); delete obj; } @@ -348,7 +348,7 @@ void tst_qqmlengine::clearComponentCache() { QQmlComponent component(&engine, fileUrl); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("test").toInt(), 11); delete obj; } @@ -371,7 +371,7 @@ public: Q_INVOKABLE void trim() { // Wait for any pending deletions to occur - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); // There might be JS function objects around that hold a last ref to the compilation unit that's @@ -423,7 +423,7 @@ void tst_qqmlengine::trimComponentCache() QQmlComponent component(&engine, testFileUrl(file)); QVERIFY(component.isReady()); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } @@ -492,7 +492,7 @@ void tst_qqmlengine::repeatedCompilation() QQmlComponent component(&engine, testFileUrl("repeatedCompilation.qml")); QVERIFY(component.isReady()); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } } @@ -536,7 +536,7 @@ void tst_qqmlengine::outputWarningsToStandardError() QObject *o = c.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; QCOMPARE(messageHandler.messages().count(), 1); @@ -548,7 +548,7 @@ void tst_qqmlengine::outputWarningsToStandardError() o = c.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); @@ -557,9 +557,9 @@ void tst_qqmlengine::outputWarningsToStandardError() void tst_qqmlengine::objectOwnership() { { - QCOMPARE(QQmlEngine::objectOwnership(0), QQmlEngine::CppOwnership); - QQmlEngine::setObjectOwnership(0, QQmlEngine::JavaScriptOwnership); - QCOMPARE(QQmlEngine::objectOwnership(0), QQmlEngine::CppOwnership); + QCOMPARE(QQmlEngine::objectOwnership(nullptr), QQmlEngine::CppOwnership); + QQmlEngine::setObjectOwnership(nullptr, QQmlEngine::JavaScriptOwnership); + QCOMPARE(QQmlEngine::objectOwnership(nullptr), QQmlEngine::CppOwnership); } { @@ -579,7 +579,7 @@ void tst_qqmlengine::objectOwnership() c.setData("import QtQuick 2.0; QtObject { property QtObject object: QtObject {} }", QUrl()); QObject *o = c.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(QQmlEngine::objectOwnership(o), QQmlEngine::CppOwnership); @@ -599,7 +599,7 @@ void tst_qqmlengine::objectOwnership() c.setData("import QtQuick 2.0; Item { property int data: test.createAQObjectForOwnershipTest() ? 0 : 1 }", QUrl()); QVERIFY(c.isReady()); QObject *o = c.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); } QTRY_VERIFY(spy.count()); } @@ -614,8 +614,8 @@ void tst_qqmlengine::objectOwnership() c.setData("import QtQuick 2.0; QtObject { property var object: { var i = test; test ? 0 : 1 } }", QUrl()); QVERIFY(c.isReady()); QObject *o = c.create(); - QVERIFY(o != 0); - engine.rootContext()->setContextProperty("test", 0); + QVERIFY(o != nullptr); + engine.rootContext()->setContextProperty("test", nullptr); } QTRY_VERIFY(spy.count()); } @@ -634,8 +634,8 @@ void tst_qqmlengine::multipleEngines() engine1.rootContext()->setContextProperty("object", &o); engine2.rootContext()->setContextProperty("object", &o); - QQmlExpression expr1(engine1.rootContext(), 0, QString("object.objectName")); - QQmlExpression expr2(engine2.rootContext(), 0, QString("object.objectName")); + QQmlExpression expr1(engine1.rootContext(), nullptr, QString("object.objectName")); + QQmlExpression expr2(engine2.rootContext(), nullptr, QString("object.objectName")); QCOMPARE(expr1.evaluate().toString(), QString("TestName")); QCOMPARE(expr2.evaluate().toString(), QString("TestName")); @@ -645,13 +645,13 @@ void tst_qqmlengine::multipleEngines() { QQmlEngine engine1; engine1.rootContext()->setContextProperty("object", &o); - QQmlExpression expr1(engine1.rootContext(), 0, QString("object.objectName")); + QQmlExpression expr1(engine1.rootContext(), nullptr, QString("object.objectName")); QCOMPARE(expr1.evaluate().toString(), QString("TestName")); } { QQmlEngine engine1; engine1.rootContext()->setContextProperty("object", &o); - QQmlExpression expr1(engine1.rootContext(), 0, QString("object.objectName")); + QQmlExpression expr1(engine1.rootContext(), nullptr, QString("object.objectName")); QCOMPARE(expr1.evaluate().toString(), QString("TestName")); } } diff --git a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp index 7e9a1524b0..b9cede6d13 100644 --- a/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp +++ b/tests/auto/qml/qqmlenginecleanup/tst_qqmlenginecleanup.cpp @@ -129,7 +129,7 @@ static void cleanState(QQmlEngine **e) delete *e; qmlClearTypeRegistrations(); *e = new QQmlEngine; - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } @@ -139,7 +139,7 @@ void tst_qqmlenginecleanup::test_valueTypeProviderModule() // provider can be reinitialized after multiple calls to // qmlClearTypeRegistrations() without causing cycles in the // value type provider list. - QQmlEngine *e = 0; + QQmlEngine *e = nullptr; QUrl testFile1 = testFileUrl("testFile1.qml"); QUrl testFile2 = testFileUrl("testFile2.qml"); bool noCycles = false; @@ -149,7 +149,7 @@ void tst_qqmlenginecleanup::test_valueTypeProviderModule() c.loadUrl(i % 2 == 0 ? testFile1 : testFile2); // this will hang if cycles exist. } delete e; - e = 0; + e = nullptr; noCycles = true; QVERIFY(noCycles); diff --git a/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp b/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp index aa201f2644..e1ad1e8c5f 100644 --- a/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp +++ b/tests/auto/qml/qqmlexpression/tst_qqmlexpression.cpp @@ -52,7 +52,7 @@ class TestObject : public QObject Q_PROPERTY(QQmlScriptString scriptString READ scriptString WRITE setScriptString) Q_PROPERTY(QQmlScriptString scriptStringError READ scriptStringError WRITE setScriptStringError) public: - TestObject(QObject *parent = 0) : QObject(parent) {} + TestObject(QObject *parent = nullptr) : QObject(parent) {} QQmlScriptString scriptString() const { return m_scriptString; } void setScriptString(QQmlScriptString scriptString) { m_scriptString = scriptString; } @@ -74,7 +74,7 @@ void tst_qqmlexpression::scriptString() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("scriptString.qml")); TestObject *testObj = qobject_cast<TestObject*>(c.create()); - QVERIFY(testObj != 0); + QVERIFY(testObj != nullptr); QQmlScriptString script = testObj->scriptString(); QVERIFY(!script.isEmpty()); @@ -100,7 +100,7 @@ void tst_qqmlexpression::scriptString() void tst_qqmlexpression::syntaxError() { QQmlEngine engine; - QQmlExpression expression(engine.rootContext(), 0, "asd asd"); + QQmlExpression expression(engine.rootContext(), nullptr, "asd asd"); QVariant v = expression.evaluate(); QCOMPARE(v, QVariant()); } @@ -108,7 +108,7 @@ void tst_qqmlexpression::syntaxError() void tst_qqmlexpression::exception() { QQmlEngine engine; - QQmlExpression expression(engine.rootContext(), 0, "abc=123"); + QQmlExpression expression(engine.rootContext(), nullptr, "abc=123"); QVariant v = expression.evaluate(); QCOMPARE(v, QVariant()); QVERIFY(expression.hasError()); diff --git a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp index 2c62353630..2d618170d4 100644 --- a/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp +++ b/tests/auto/qml/qqmlfileselector/tst_qqmlfileselector.cpp @@ -58,7 +58,7 @@ void tst_qqmlfileselector::basicTest() QQmlComponent component(&engine, testFileUrl("basicTest.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toString(), QString("selected")); delete object; @@ -87,12 +87,12 @@ void tst_qqmlfileselector::applicationEngineTest() { QQmlApplicationEngine engine; QQmlFileSelector* selector = QQmlFileSelector::get(&engine); - QVERIFY(selector != 0); + QVERIFY(selector != nullptr); selector->setExtraSelectors(QStringList() << "basic"); QQmlComponent component(&engine, testFileUrl("basicTest.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toString(), QString("selected")); delete object; diff --git a/tests/auto/qml/qqmlincubator/testtypes.cpp b/tests/auto/qml/qqmlincubator/testtypes.cpp index 3fcd3ba299..06d5904bbd 100644 --- a/tests/auto/qml/qqmlincubator/testtypes.cpp +++ b/tests/auto/qml/qqmlincubator/testtypes.cpp @@ -28,7 +28,7 @@ #include "testtypes.h" #include <QtQml/qqml.h> -SelfRegisteringType *SelfRegisteringType::m_me = 0; +SelfRegisteringType *SelfRegisteringType::m_me = nullptr; SelfRegisteringType::SelfRegisteringType() : m_v(0) { @@ -42,13 +42,13 @@ SelfRegisteringType *SelfRegisteringType::me() void SelfRegisteringType::clearMe() { - m_me = 0; + m_me = nullptr; } -SelfRegisteringOuterType *SelfRegisteringOuterType::m_me = 0; +SelfRegisteringOuterType *SelfRegisteringOuterType::m_me = nullptr; bool SelfRegisteringOuterType::beenDeleted = false; SelfRegisteringOuterType::SelfRegisteringOuterType() -: m_v(0) +: m_v(nullptr) { m_me = this; beenDeleted = false; @@ -64,7 +64,7 @@ SelfRegisteringOuterType *SelfRegisteringOuterType::me() return m_me; } -CompletionRegisteringType *CompletionRegisteringType::m_me = 0; +CompletionRegisteringType *CompletionRegisteringType::m_me = nullptr; CompletionRegisteringType::CompletionRegisteringType() { } @@ -85,11 +85,11 @@ CompletionRegisteringType *CompletionRegisteringType::me() void CompletionRegisteringType::clearMe() { - m_me = 0; + m_me = nullptr; } -CallbackRegisteringType::callback CallbackRegisteringType::m_callback = 0; -void *CallbackRegisteringType::m_data = 0; +CallbackRegisteringType::callback CallbackRegisteringType::m_callback = nullptr; +void *CallbackRegisteringType::m_data = nullptr; CallbackRegisteringType::CallbackRegisteringType() : m_v(0) { @@ -97,8 +97,8 @@ CallbackRegisteringType::CallbackRegisteringType() void CallbackRegisteringType::clearCallback() { - m_callback = 0; - m_data = 0; + m_callback = nullptr; + m_data = nullptr; } void CallbackRegisteringType::registerCallback(callback c, void *d) @@ -107,8 +107,8 @@ void CallbackRegisteringType::registerCallback(callback c, void *d) m_data = d; } -CompletionCallbackType::callback CompletionCallbackType::m_callback = 0; -void *CompletionCallbackType::m_data = 0; +CompletionCallbackType::callback CompletionCallbackType::m_callback = nullptr; +void *CompletionCallbackType::m_data = nullptr; CompletionCallbackType::CompletionCallbackType() { } @@ -124,8 +124,8 @@ void CompletionCallbackType::componentComplete() void CompletionCallbackType::clearCallback() { - m_callback = 0; - m_data = 0; + m_callback = nullptr; + m_data = nullptr; } void CompletionCallbackType::registerCallback(callback c, void *d) diff --git a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp index 863b6aaa29..8f0e04e12e 100644 --- a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp +++ b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp @@ -145,15 +145,15 @@ void tst_qqmlincubator::objectDeleted() QCOMPARE(incubator.status(), QQmlIncubator::Loading); QVERIFY(!SelfRegisteringType::me()); - while (SelfRegisteringOuterType::me() == 0 && incubator.isLoading()) { + while (SelfRegisteringOuterType::me() == nullptr && incubator.isLoading()) { bool b = false; controller.incubateWhile(&b); } - QVERIFY(SelfRegisteringOuterType::me() != 0); + QVERIFY(SelfRegisteringOuterType::me() != nullptr); QVERIFY(incubator.isLoading()); - while (SelfRegisteringType::me() == 0 && incubator.isLoading()) { + while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) { bool b = false; controller.incubateWhile(&b); } @@ -201,13 +201,13 @@ void tst_qqmlincubator::clear() QQmlIncubator incubator; component.create(incubator); - while (SelfRegisteringType::me() == 0 && incubator.isLoading()) { + while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) { bool b = false; controller.incubateWhile(&b); } QVERIFY(incubator.isLoading()); - QVERIFY(SelfRegisteringType::me() != 0); + QVERIFY(SelfRegisteringType::me() != nullptr); QPointer<SelfRegisteringType> srt = SelfRegisteringType::me(); incubator.clear(); @@ -226,7 +226,7 @@ void tst_qqmlincubator::clear() } QVERIFY(incubator.isReady()); - QVERIFY(incubator.object() != 0); + QVERIFY(incubator.object() != nullptr); QPointer<QObject> obj = incubator.object(); incubator.clear(); @@ -299,7 +299,7 @@ void tst_qqmlincubator::forceCompletion() incubator.forceCompletion(); QVERIFY(incubator.isReady()); - QVERIFY(incubator.object() != 0); + QVERIFY(incubator.object() != nullptr); QCOMPARE(incubator.object()->property("testValue").toInt(), 3499); delete incubator.object(); @@ -314,18 +314,18 @@ void tst_qqmlincubator::forceCompletion() component.create(incubator); QVERIFY(incubator.isLoading()); - while (SelfRegisteringType::me() == 0 && incubator.isLoading()) { + while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) { bool b = false; controller.incubateWhile(&b); } - QVERIFY(SelfRegisteringType::me() != 0); + QVERIFY(SelfRegisteringType::me() != nullptr); QVERIFY(incubator.isLoading()); incubator.forceCompletion(); QVERIFY(incubator.isReady()); - QVERIFY(incubator.object() != 0); + QVERIFY(incubator.object() != nullptr); QCOMPARE(incubator.object()->property("testValue").toInt(), 3499); delete incubator.object(); @@ -341,13 +341,13 @@ void tst_qqmlincubator::forceCompletion() incubator.forceCompletion(); QVERIFY(incubator.isReady()); - QVERIFY(incubator.object() != 0); + QVERIFY(incubator.object() != nullptr); QCOMPARE(incubator.object()->property("testValue").toInt(), 3499); incubator.forceCompletion(); QVERIFY(incubator.isReady()); - QVERIFY(incubator.object() != 0); + QVERIFY(incubator.object() != nullptr); QCOMPARE(incubator.object()->property("testValue").toInt(), 3499); delete incubator.object(); @@ -410,19 +410,19 @@ void tst_qqmlincubator::clearDuringCompletion() QCOMPARE(incubator.status(), QQmlIncubator::Loading); QVERIFY(!CompletionRegisteringType::me()); - while (CompletionRegisteringType::me() == 0 && incubator.isLoading()) { + while (CompletionRegisteringType::me() == nullptr && incubator.isLoading()) { bool b = false; controller.incubateWhile(&b); } - QVERIFY(CompletionRegisteringType::me() != 0); - QVERIFY(SelfRegisteringType::me() != 0); + QVERIFY(CompletionRegisteringType::me() != nullptr); + QVERIFY(SelfRegisteringType::me() != nullptr); QVERIFY(incubator.isLoading()); QPointer<QObject> srt = SelfRegisteringType::me(); incubator.clear(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(incubator.isNull()); QVERIFY(srt.isNull()); @@ -436,7 +436,7 @@ void tst_qqmlincubator::objectDeletionAfterInit() struct MyIncubator : public QQmlIncubator { MyIncubator(QQmlIncubator::IncubationMode mode) - : QQmlIncubator(mode), obj(0) {} + : QQmlIncubator(mode), obj(nullptr) {} virtual void setInitialState(QObject *o) { obj = o; @@ -455,12 +455,12 @@ void tst_qqmlincubator::objectDeletionAfterInit() } QVERIFY(incubator.isLoading()); - QVERIFY(SelfRegisteringType::me() != 0); + QVERIFY(SelfRegisteringType::me() != nullptr); delete incubator.obj; incubator.clear(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(incubator.isNull()); } @@ -592,11 +592,11 @@ void tst_qqmlincubator::asynchronousIfNested() QVERIFY(component.isReady()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 10); QQmlIncubator incubator(QQmlIncubator::AsynchronousIfNested); - component.create(incubator, 0, qmlContext(object)); + component.create(incubator, nullptr, qmlContext(object)); QVERIFY(incubator.isReady()); QVERIFY(incubator.object()); @@ -618,16 +618,16 @@ void tst_qqmlincubator::asynchronousIfNested() QVERIFY(incubator.isLoading()); QVERIFY(!SelfRegisteringType::me()); - while (SelfRegisteringType::me() == 0 && incubator.isLoading()) { + while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) { bool b = false; controller.incubateWhile(&b); } - QVERIFY(SelfRegisteringType::me() != 0); + QVERIFY(SelfRegisteringType::me() != nullptr); QVERIFY(incubator.isLoading()); QQmlIncubator nested(QQmlIncubator::AsynchronousIfNested); - component.create(nested, 0, qmlContext(SelfRegisteringType::me())); + component.create(nested, nullptr, qmlContext(SelfRegisteringType::me())); QVERIFY(nested.isLoading()); while (nested.isLoading()) { @@ -669,7 +669,7 @@ void tst_qqmlincubator::asynchronousIfNested() if (!c.isReady()) return; QQmlIncubator incubator(QQmlIncubator::AsynchronousIfNested); - c.create(incubator, 0, qmlContext(o)); + c.create(incubator, nullptr, qmlContext(o)); if (!incubator.isReady()) return; @@ -738,12 +738,12 @@ void tst_qqmlincubator::chainedAsynchronousIfNested() QVERIFY(incubator.isLoading()); QVERIFY(!SelfRegisteringType::me()); - while (SelfRegisteringType::me() == 0 && incubator.isLoading()) { + while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) { bool b = false; controller.incubateWhile(&b); } - QVERIFY(SelfRegisteringType::me() != 0); + QVERIFY(SelfRegisteringType::me() != nullptr); QVERIFY(incubator.isLoading()); struct MyIncubator : public QQmlIncubator { @@ -753,7 +753,7 @@ void tst_qqmlincubator::chainedAsynchronousIfNested() protected: virtual void statusChanged(Status s) { if (s == Ready && next) - component->create(*next, 0, ctxt); + component->create(*next, nullptr, ctxt); } private: @@ -762,10 +762,10 @@ void tst_qqmlincubator::chainedAsynchronousIfNested() QQmlContext *ctxt; }; - MyIncubator incubator2(0, &component, 0); + MyIncubator incubator2(nullptr, &component, nullptr); MyIncubator incubator1(&incubator2, &component, qmlContext(SelfRegisteringType::me())); - component.create(incubator1, 0, qmlContext(SelfRegisteringType::me())); + component.create(incubator1, nullptr, qmlContext(SelfRegisteringType::me())); QVERIFY(incubator.isLoading()); QVERIFY(incubator1.isLoading()); @@ -824,7 +824,7 @@ void tst_qqmlincubator::chainedAsynchronousIfNestedOnCompleted() protected: virtual void statusChanged(Status s) { if (s == Ready && next) { - component->create(*next, 0, ctxt); + component->create(*next, nullptr, ctxt); } } @@ -842,7 +842,7 @@ void tst_qqmlincubator::chainedAsynchronousIfNestedOnCompleted() QQmlContext *ctxt; static void callback(CompletionCallbackType *, void *data) { CallbackData *d = (CallbackData *)data; - d->component->create(*d->incubator, 0, d->ctxt); + d->component->create(*d->incubator, nullptr, d->ctxt); } }; @@ -852,15 +852,15 @@ void tst_qqmlincubator::chainedAsynchronousIfNestedOnCompleted() QVERIFY(incubator.isLoading()); QVERIFY(!SelfRegisteringType::me()); - while (SelfRegisteringType::me() == 0 && incubator.isLoading()) { + while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) { bool b = false; controller.incubateWhile(&b); } - QVERIFY(SelfRegisteringType::me() != 0); + QVERIFY(SelfRegisteringType::me() != nullptr); QVERIFY(incubator.isLoading()); - MyIncubator incubator3(0, &c1, qmlContext(SelfRegisteringType::me())); + MyIncubator incubator3(nullptr, &c1, qmlContext(SelfRegisteringType::me())); MyIncubator incubator2(&incubator3, &c1, qmlContext(SelfRegisteringType::me())); MyIncubator incubator1(&incubator2, &c1, qmlContext(SelfRegisteringType::me())); @@ -952,7 +952,7 @@ void tst_qqmlincubator::chainedAsynchronousClear() protected: virtual void statusChanged(Status s) { if (s == Ready && next) { - component->create(*next, 0, ctxt); + component->create(*next, nullptr, ctxt); } } @@ -970,7 +970,7 @@ void tst_qqmlincubator::chainedAsynchronousClear() QQmlContext *ctxt; static void callback(CompletionCallbackType *, void *data) { CallbackData *d = (CallbackData *)data; - d->component->create(*d->incubator, 0, d->ctxt); + d->component->create(*d->incubator, nullptr, d->ctxt); } }; @@ -980,15 +980,15 @@ void tst_qqmlincubator::chainedAsynchronousClear() QVERIFY(incubator.isLoading()); QVERIFY(!SelfRegisteringType::me()); - while (SelfRegisteringType::me() == 0 && incubator.isLoading()) { + while (SelfRegisteringType::me() == nullptr && incubator.isLoading()) { bool b = false; controller.incubateWhile(&b); } - QVERIFY(SelfRegisteringType::me() != 0); + QVERIFY(SelfRegisteringType::me() != nullptr); QVERIFY(incubator.isLoading()); - MyIncubator incubator3(0, &c1, qmlContext(SelfRegisteringType::me())); + MyIncubator incubator3(nullptr, &c1, qmlContext(SelfRegisteringType::me())); MyIncubator incubator2(&incubator3, &c1, qmlContext(SelfRegisteringType::me())); MyIncubator incubator1(&incubator2, &c1, qmlContext(SelfRegisteringType::me())); @@ -1103,12 +1103,12 @@ void tst_qqmlincubator::selfDelete() QCOMPARE(incubator->QQmlIncubator::status(), QQmlIncubator::Loading); QVERIFY(!SelfRegisteringType::me()); - while (SelfRegisteringType::me() == 0 && incubator->isLoading()) { + while (SelfRegisteringType::me() == nullptr && incubator->isLoading()) { bool b = false; controller.incubateWhile(&b); } - QVERIFY(SelfRegisteringType::me() != 0); + QVERIFY(SelfRegisteringType::me() != nullptr); QVERIFY(incubator->isLoading()); // We have to cheat and manually remove it from the creator->allCreatedObjects diff --git a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp index 3f6c200027..ada3f9e37b 100644 --- a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp +++ b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp @@ -60,14 +60,14 @@ void tst_qqmlinfo::qmlObject() QQmlComponent component(&engine, testFileUrl("qmlObject.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString message = component.url().toString() + ":3:1: QML QtObject: Test Message"; QTest::ignoreMessage(QtInfoMsg, qPrintable(message)); qmlInfo(object) << "Test Message"; QObject *nested = qvariant_cast<QObject *>(object->property("nested")); - QVERIFY(nested != 0); + QVERIFY(nested != nullptr); message = component.url().toString() + ":6:13: QML QtObject: Second Test Message"; QTest::ignoreMessage(QtInfoMsg, qPrintable(message)); @@ -79,12 +79,12 @@ void tst_qqmlinfo::nestedQmlObject() QQmlComponent component(&engine, testFileUrl("nestedQmlObject.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *nested = qvariant_cast<QObject *>(object->property("nested")); - QVERIFY(nested != 0); + QVERIFY(nested != nullptr); QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2")); - QVERIFY(nested2 != 0); + QVERIFY(nested2 != nullptr); QString message = component.url().toString() + ":5:13: QML NestedObject: Outer Object"; QTest::ignoreMessage(QtInfoMsg, qPrintable(message)); @@ -100,12 +100,12 @@ void tst_qqmlinfo::nestedComponent() QQmlComponent component(&engine, testFileUrl("NestedComponent.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *nested = qvariant_cast<QObject *>(object->property("nested")); - QVERIFY(nested != 0); + QVERIFY(nested != nullptr); QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2")); - QVERIFY(nested2 != 0); + QVERIFY(nested2 != nullptr); QString message = component.url().toString() + ":10:9: QML NestedObject: Complex Object"; QTest::ignoreMessage(QtInfoMsg, qPrintable(message)); @@ -130,7 +130,7 @@ void tst_qqmlinfo::nonQmlObject() void tst_qqmlinfo::nullObject() { QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: Null Object Test Message"); - qmlInfo(0) << "Null Object Test Message"; + qmlInfo(nullptr) << "Null Object Test Message"; } void tst_qqmlinfo::nonQmlContextedObject() @@ -145,44 +145,44 @@ void tst_qqmlinfo::nonQmlContextedObject() void tst_qqmlinfo::types() { QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: false"); - qmlInfo(0) << false; + qmlInfo(nullptr) << false; QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 1.1"); - qmlInfo(0) << 1.1; + qmlInfo(nullptr) << 1.1; QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 1.2"); - qmlInfo(0) << 1.2f; + qmlInfo(nullptr) << 1.2f; QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 15"); - qmlInfo(0) << 15; + qmlInfo(nullptr) << 15; QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: 'b'"); - qmlInfo(0) << QChar('b'); + qmlInfo(nullptr) << QChar('b'); QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: \"Qt\""); - qmlInfo(0) << QByteArray("Qt"); + qmlInfo(nullptr) << QByteArray("Qt"); QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: true"); - qmlInfo(0) << bool(true); + qmlInfo(nullptr) << bool(true); //### do we actually want QUrl to show up in the output? //### why the extra space at the end? QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: QUrl(\"http://www.qt-project.org\") "); - qmlInfo(0) << QUrl("http://www.qt-project.org"); + qmlInfo(nullptr) << QUrl("http://www.qt-project.org"); //### should this be quoted? QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: hello"); - qmlInfo(0) << QLatin1String("hello"); + qmlInfo(nullptr) << QLatin1String("hello"); //### should this be quoted? QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: World"); QString str("Hello World"); QStringRef ref(&str, 6, 5); - qmlInfo(0) << ref; + qmlInfo(nullptr) << ref; //### should this be quoted? QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: Quick"); - qmlInfo(0) << QString ("Quick"); + qmlInfo(nullptr) << QString ("Quick"); } void tst_qqmlinfo::chaining() @@ -190,7 +190,7 @@ void tst_qqmlinfo::chaining() QString str("Hello World"); QStringRef ref(&str, 6, 5); QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: false 1.1 1.2 15 hello 'b' World \"Qt\" true Quick QUrl(\"http://www.qt-project.org\") "); - qmlInfo(0) << false << ' ' + qmlInfo(nullptr) << false << ' ' << 1.1 << ' ' << 1.2f << ' ' << 15 << ' ' @@ -207,13 +207,13 @@ void tst_qqmlinfo::chaining() void tst_qqmlinfo::messageTypes() { QTest::ignoreMessage(QtDebugMsg, "<Unknown File>: debug"); - qmlDebug(0) << QLatin1String("debug"); + qmlDebug(nullptr) << QLatin1String("debug"); QTest::ignoreMessage(QtInfoMsg, "<Unknown File>: info"); - qmlInfo(0) << QLatin1String("info"); + qmlInfo(nullptr) << QLatin1String("info"); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: warning"); - qmlWarning(0) << QLatin1String("warning"); + qmlWarning(nullptr) << QLatin1String("warning"); } QTEST_MAIN(tst_qqmlinfo) diff --git a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp index 90b719d000..a66f13e6bb 100644 --- a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp +++ b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp @@ -59,7 +59,7 @@ void tst_qqmlinstantiator::createNone() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("createNone.qml")); QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create()); - QVERIFY(instantiator != 0); + QVERIFY(instantiator != nullptr); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 0); QCOMPARE(instantiator->property("success").toBool(), true); @@ -71,7 +71,7 @@ void tst_qqmlinstantiator::createSingle() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("createSingle.qml")); QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create()); - QVERIFY(instantiator != 0); + QVERIFY(instantiator != nullptr); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 1); QVERIFY(instantiator->delegate()->isReady()); @@ -88,7 +88,7 @@ void tst_qqmlinstantiator::createMultiple() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("createMultiple.qml")); QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create()); - QVERIFY(instantiator != 0); + QVERIFY(instantiator != nullptr); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 10); @@ -106,7 +106,7 @@ void tst_qqmlinstantiator::stringModel() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("stringModel.qml")); QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create()); - QVERIFY(instantiator != 0); + QVERIFY(instantiator != nullptr); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 4); @@ -123,7 +123,7 @@ void tst_qqmlinstantiator::activeProperty() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("inactive.qml")); QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create()); - QVERIFY(instantiator != 0); + QVERIFY(instantiator != nullptr); QSignalSpy activeSpy(instantiator, SIGNAL(activeChanged())); QSignalSpy countSpy(instantiator, SIGNAL(countChanged())); QSignalSpy objectSpy(instantiator, SIGNAL(objectChanged())); @@ -158,7 +158,7 @@ void tst_qqmlinstantiator::intModelChange() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("createMultiple.qml")); QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(component.create()); - QVERIFY(instantiator != 0); + QVERIFY(instantiator != nullptr); QSignalSpy activeSpy(instantiator, SIGNAL(activeChanged())); QSignalSpy countSpy(instantiator, SIGNAL(countChanged())); QSignalSpy objectSpy(instantiator, SIGNAL(objectChanged())); @@ -194,11 +194,11 @@ void tst_qqmlinstantiator::createAndRemove() StringModel *model = new StringModel("model1"); engine.rootContext()->setContextProperty("model1", model); QObject *rootObject = component.create(); - QVERIFY(rootObject != 0); + QVERIFY(rootObject != nullptr); QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator*>(rootObject->findChild<QObject*>("instantiator1")); - QVERIFY(instantiator != 0); + QVERIFY(instantiator != nullptr); model->drop(1); QVector<QString> names; names << "Beta" << "Gamma" << "Delta"; @@ -234,7 +234,7 @@ void tst_qqmlinstantiator::asynchronous() QQmlInstantiator *instantiator = qobject_cast<QQmlInstantiator *>(incubator.object()); while (incubationController.incubatingObjectCount() > 0) incubationController.incubateFor(10); - QVERIFY(instantiator != 0); + QVERIFY(instantiator != nullptr); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 10); diff --git a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp index fca72ab021..cbb7ebb0ff 100644 --- a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp +++ b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp @@ -182,7 +182,7 @@ void tst_qqmlitemmodels::itemSelection() QCOMPARE(object->property("count").toInt(), 5); QCOMPARE(object->property("contains").toBool(), true); - const char *propNames[] = { "itemSelectionRead", "itemSelectionBinding", 0 }; + const char *propNames[] = { "itemSelectionRead", "itemSelectionBinding", nullptr }; for (const char **name = propNames; *name; name++) { QVariant isVariant = object->property(*name); QCOMPARE(isVariant.userType(), qMetaTypeId<QItemSelection>()); @@ -217,7 +217,7 @@ void tst_qqmlitemmodels::modelIndexList() QModelIndexList someMIL = object->someModelIndexList(); QCOMPARE(cppMILVariant.value<QModelIndexList>(), someMIL); - const char *propNames[] = { "modelIndexListRead", "modelIndexListBinding", 0 }; + const char *propNames[] = { "modelIndexListRead", "modelIndexListBinding", nullptr }; for (const char **name = propNames; *name; name++) { QVariant milVariant = object->property(*name); QCOMPARE(milVariant.userType(), qMetaTypeId<QModelIndexList>()); diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp index 1a81528bc4..0eb4f26878 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.cpp +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -185,8 +185,8 @@ void SimpleObjectCustomParser::applyBindings(QObject *object, QV4::CompiledData: MyQmlObject::MyQmlObject() : m_value(-1) - , m_interface(0) - , m_qmlobject(0) + , m_interface(nullptr) + , m_qmlobject(nullptr) , m_childAddedEventCount(0) { qRegisterMetaType<MyCustomVariantType>("MyCustomVariantType"); diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index d08ad47310..952e4a22a1 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -619,7 +619,7 @@ void tst_qqmllanguage::simpleObject() QQmlComponent component(&engine, testFileUrl("simpleObject.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmllanguage::simpleContainer() @@ -627,7 +627,7 @@ void tst_qqmllanguage::simpleContainer() QQmlComponent component(&engine, testFileUrl("simpleContainer.qml")); VERIFY_ERRORS(0); MyContainer *container= qobject_cast<MyContainer*>(component.create()); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->getChildren()->count(),2); } @@ -636,7 +636,7 @@ void tst_qqmllanguage::interfaceProperty() QQmlComponent component(&engine, testFileUrl("interfaceProperty.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->interface()); QCOMPARE(object->interface()->id, 913); } @@ -646,7 +646,7 @@ void tst_qqmllanguage::interfaceQList() QQmlComponent component(&engine, testFileUrl("interfaceQList.qml")); VERIFY_ERRORS(0); MyContainer *container= qobject_cast<MyContainer*>(component.create()); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->getQListInterfaces()->count(), 2); for(int ii = 0; ii < 2; ++ii) QCOMPARE(container->getQListInterfaces()->at(ii)->id, 913); @@ -657,7 +657,7 @@ void tst_qqmllanguage::assignObjectToSignal() QQmlComponent component(&engine, testFileUrl("assignObjectToSignal.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); emit object->basicSignal(); } @@ -667,7 +667,7 @@ void tst_qqmllanguage::assignObjectToVariant() QQmlComponent component(&engine, testFileUrl("assignObjectToVariant.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant v = object->property("a"); QVERIFY(v.userType() == qMetaTypeId<QObject *>()); } @@ -677,7 +677,7 @@ void tst_qqmllanguage::assignLiteralSignalProperty() QQmlComponent component(&engine, testFileUrl("assignLiteralSignalProperty.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->onLiteralSignal(), 10); } @@ -687,7 +687,7 @@ void tst_qqmllanguage::assignQmlComponent() QQmlComponent component(&engine, testFileUrl("assignQmlComponent.qml")); VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->getChildren()->count(), 1); QObject *child = object->getChildren()->at(0); QCOMPARE(child->property("x"), QVariant(10)); @@ -700,7 +700,7 @@ void tst_qqmllanguage::assignBasicTypes() QQmlComponent component(&engine, testFileUrl("assignBasicTypes.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); QCOMPARE(object->qtEnumProperty(), Qt::RichText); @@ -729,9 +729,9 @@ void tst_qqmllanguage::assignBasicTypes() QCOMPARE(object->vector4Property(), QVector4D(10, 1, 2.2f, 2.3f)); const QUrl encoded = QUrl::fromEncoded("main.qml?with%3cencoded%3edata", QUrl::TolerantMode); QCOMPARE(object->urlProperty(), component.url().resolved(encoded)); - QVERIFY(object->objectProperty() != 0); + QVERIFY(object->objectProperty() != nullptr); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty()); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->intProperty(), 8); //these used to go via script. Ensure they no longer do @@ -745,7 +745,7 @@ void tst_qqmllanguage::assignTypeExtremes() QQmlComponent component(&engine, testFileUrl("assignTypeExtremes.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->uintProperty(), 0xEE6B2800); QCOMPARE(object->intProperty(), -0x77359400); } @@ -756,7 +756,7 @@ void tst_qqmllanguage::assignCompositeToType() QQmlComponent component(&engine, testFileUrl("assignCompositeToType.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } // Test that literals are stored correctly in variant properties @@ -765,7 +765,7 @@ void tst_qqmllanguage::assignLiteralToVariant() QQmlComponent component(&engine, testFileUrl("assignLiteralToVariant.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(isJSNumberType(object->property("test1").userType())); QVERIFY(isJSNumberType(object->property("test2").userType())); @@ -804,7 +804,7 @@ void tst_qqmllanguage::assignLiteralToVar() QQmlComponent component(&engine, testFileUrl("assignLiteralToVar.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(isJSNumberType(object->property("test1").userType())); QCOMPARE(object->property("test2").userType(), (int)QMetaType::Double); @@ -852,7 +852,7 @@ void tst_qqmllanguage::assignLiteralToJSValue() QQmlComponent component(&engine, testFileUrl("assignLiteralToJSValue.qml")); VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); { MyQmlObject *object = root->findChild<MyQmlObject *>("test1"); @@ -940,7 +940,7 @@ void tst_qqmllanguage::assignNullStrings() QQmlComponent component(&engine, testFileUrl("assignNullStrings.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->stringProperty().isNull()); QVERIFY(object->byteArrayProperty().isNull()); QMetaObject::invokeMethod(object, "assignNullStringsFromJs", Qt::DirectConnection); @@ -954,7 +954,7 @@ void tst_qqmllanguage::bindJSValueToVar() VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QObject *object = root->findChild<QObject *>("varProperties"); @@ -1003,7 +1003,7 @@ void tst_qqmllanguage::bindJSValueToVariant() VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QObject *object = root->findChild<QObject *>("variantProperties"); @@ -1052,7 +1052,7 @@ void tst_qqmllanguage::bindJSValueToType() VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); { MyTypeObject *object = root->findChild<MyTypeObject *>("typedProperties"); @@ -1087,7 +1087,7 @@ void tst_qqmllanguage::bindTypeToJSValue() VERIFY_ERRORS(0); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); { MyQmlObject *object = root->findChild<MyQmlObject *>("flagProperty"); @@ -1226,7 +1226,7 @@ void tst_qqmllanguage::customParserTypes() QQmlComponent component(&engine, testFileUrl("customParserTypes.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("count"), QVariant(2)); } @@ -1236,7 +1236,7 @@ void tst_qqmllanguage::rootAsQmlComponent() QQmlComponent component(&engine, testFileUrl("rootAsQmlComponent.qml")); VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("x"), QVariant(11)); QCOMPARE(object->getChildren()->count(), 2); } @@ -1260,12 +1260,12 @@ void tst_qqmllanguage::inlineQmlComponents() QQmlComponent component(&engine, testFileUrl("inlineQmlComponents.qml")); VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->getChildren()->count(), 1); QQmlComponent *comp = qobject_cast<QQmlComponent *>(object->getChildren()->at(0)); - QVERIFY(comp != 0); + QVERIFY(comp != nullptr); MyQmlObject *compObject = qobject_cast<MyQmlObject *>(comp->create()); - QVERIFY(compObject != 0); + QVERIFY(compObject != nullptr); QCOMPARE(compObject->value(), 11); } @@ -1276,17 +1276,17 @@ void tst_qqmllanguage::idProperty() QQmlComponent component(&engine, testFileUrl("idProperty.qml")); VERIFY_ERRORS(0); MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->getChildren()->count(), 2); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->getChildren()->at(0)); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->id(), QString("myObjectId")); QCOMPARE(object->property("object"), QVariant::fromValue((QObject *)child)); child = qobject_cast<MyTypeObject *>(object->getChildren()->at(1)); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->id(), QString("name.with.dots")); } { @@ -1307,7 +1307,7 @@ void tst_qqmllanguage::autoNotifyConnection() QQmlComponent component(&engine, testFileUrl("autoNotifyConnection.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QMetaProperty prop = object->metaObject()->property(object->metaObject()->indexOfProperty("receivedNotify")); QVERIFY(prop.isValid()); @@ -1322,7 +1322,7 @@ void tst_qqmllanguage::assignSignal() QQmlComponent component(&engine, testFileUrl("assignSignal.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); emit object->basicSignal(); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlotWithArgs(9)"); @@ -1334,7 +1334,7 @@ void tst_qqmllanguage::assignSignalFunctionExpression() QQmlComponent component(&engine, testFileUrl("assignSignalFunctionExpression.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); emit object->basicSignal(); QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlotWithArgs(9)"); @@ -1363,7 +1363,7 @@ void tst_qqmllanguage::overrideSignal() if (errorFile.isEmpty()) { VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); delete object; } else { @@ -1377,7 +1377,7 @@ void tst_qqmllanguage::dynamicProperties() QQmlComponent component(&engine, testFileUrl("dynamicProperties.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("intProperty"), QVariant(10)); QCOMPARE(object->property("boolProperty"), QVariant(false)); QCOMPARE(object->property("doubleProperty"), QVariant(-10.1)); @@ -1395,7 +1395,7 @@ void tst_qqmllanguage::dynamicPropertiesNested() QQmlComponent component(&engine, testFileUrl("dynamicPropertiesNested.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("super_a").toInt(), 11); // Overridden QCOMPARE(object->property("super_c").toInt(), 14); // Inherited @@ -1411,7 +1411,7 @@ void tst_qqmllanguage::listProperties() QQmlComponent component(&engine, testFileUrl("listProperties.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toInt(), 2); } @@ -1431,18 +1431,18 @@ void tst_qqmllanguage::dynamicObjectProperties() QQmlComponent component(&engine, testFileUrl("dynamicObjectProperties.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QCOMPARE(object->property("objectProperty"), qVariantFromValue((QObject*)0)); - QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)0)); + QCOMPARE(object->property("objectProperty"), qVariantFromValue((QObject*)nullptr)); + QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)nullptr)); } { QQmlComponent component(&engine, testFileUrl("dynamicObjectProperties.2.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QVERIFY(object->property("objectProperty") != qVariantFromValue((QObject*)0)); + QVERIFY(object->property("objectProperty") != qVariantFromValue((QObject*)nullptr)); } } @@ -1454,7 +1454,7 @@ void tst_qqmllanguage::dynamicSignalsAndSlots() QQmlComponent component(&engine, testFileUrl("dynamicSignalsAndSlots.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->metaObject()->indexOfMethod("signal1()") != -1); QVERIFY(object->metaObject()->indexOfMethod("signal2()") != -1); QVERIFY(object->metaObject()->indexOfMethod("slot1()") != -1); @@ -1470,7 +1470,7 @@ void tst_qqmllanguage::simpleBindings() QQmlComponent component(&engine, testFileUrl("simpleBindings.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value1"), QVariant(10)); QCOMPARE(object->property("value2"), QVariant(10)); QCOMPARE(object->property("value3"), QVariant(21)); @@ -1484,20 +1484,20 @@ void tst_qqmllanguage::autoComponentCreation() QQmlComponent component(&engine, testFileUrl("autoComponentCreation.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->componentProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->componentProperty() != nullptr); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->realProperty(), qreal(9)); } { QQmlComponent component(&engine, testFileUrl("autoComponentCreation.2.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->componentProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->componentProperty() != nullptr); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->realProperty(), qreal(9)); } } @@ -1507,10 +1507,10 @@ void tst_qqmllanguage::autoComponentCreationInGroupProperty() QQmlComponent component(&engine, testFileUrl("autoComponentCreationInGroupProperties.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->componentProperty() != 0); + QVERIFY(object != nullptr); + QVERIFY(object->componentProperty() != nullptr); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); - QVERIFY(child != 0); + QVERIFY(child != nullptr); QCOMPARE(child->realProperty(), qreal(9)); } @@ -1520,7 +1520,7 @@ void tst_qqmllanguage::propertyValueSource() QQmlComponent component(&engine, testFileUrl("propertyValueSource.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QList<QObject *> valueSources; QObjectList allChildren = object->findChildren<QObject*>(); @@ -1532,7 +1532,7 @@ void tst_qqmllanguage::propertyValueSource() QCOMPARE(valueSources.count(), 1); MyPropertyValueSource *valueSource = qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); - QVERIFY(valueSource != 0); + QVERIFY(valueSource != nullptr); QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object)); QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); } @@ -1541,7 +1541,7 @@ void tst_qqmllanguage::propertyValueSource() QQmlComponent component(&engine, testFileUrl("propertyValueSource.2.qml")); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QList<QObject *> valueSources; QObjectList allChildren = object->findChildren<QObject*>(); @@ -1553,7 +1553,7 @@ void tst_qqmllanguage::propertyValueSource() QCOMPARE(valueSources.count(), 1); MyPropertyValueSource *valueSource = qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); - QVERIFY(valueSource != 0); + QVERIFY(valueSource != nullptr); QCOMPARE(valueSource->prop.object(), qobject_cast<QObject*>(object)); QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); } @@ -1564,9 +1564,9 @@ void tst_qqmllanguage::attachedProperties() QQmlComponent component(&engine, testFileUrl("attachedProperties.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *attached = qmlAttachedPropertiesObject<MyQmlObject>(object); - QVERIFY(attached != 0); + QVERIFY(attached != nullptr); QCOMPARE(attached->property("value"), QVariant(10)); QCOMPARE(attached->property("value2"), QVariant(13)); } @@ -1577,7 +1577,7 @@ void tst_qqmllanguage::dynamicObjects() QQmlComponent component(&engine, testFileUrl("dynamicObject.1.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } // Tests the registration of custom variant string converters @@ -1586,7 +1586,7 @@ void tst_qqmllanguage::customVariantTypes() QQmlComponent component(&engine, testFileUrl("customVariantTypes.qml")); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->customType().a, 10); } @@ -1600,7 +1600,7 @@ void tst_qqmllanguage::valueTypes() QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rectProperty(), QRect(10, 11, 12, 13)); @@ -1631,7 +1631,7 @@ void tst_qqmllanguage::cppnamespace() QQmlComponent component(&engine, testFileUrl("cppnamespace.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("intProperty").toInt(), (int)MyNamespace::MyOtherNSEnum::OtherKey2); @@ -1642,7 +1642,7 @@ void tst_qqmllanguage::cppnamespace() QQmlComponent component(&engine, testFileUrl("cppnamespace.2.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } } @@ -1654,7 +1654,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.1.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Read through alias QCOMPARE(object->property("valueAlias").toInt(), 10); @@ -1674,12 +1674,12 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.2.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Read through alias MyQmlObject *v = qvariant_cast<MyQmlObject *>(object->property("aliasObject")); - QVERIFY(v != 0); + QVERIFY(v != nullptr); QCOMPARE(v->value(), 10); // Write through alias @@ -1688,7 +1688,7 @@ void tst_qqmllanguage::aliasProperties() object->setProperty("aliasObject", qVariantFromValue(v2)); MyQmlObject *v3 = qvariant_cast<MyQmlObject *>(object->property("aliasObject")); - QVERIFY(v3 != 0); + QVERIFY(v3 != nullptr); QCOMPARE(v3, v2); delete object; @@ -1699,7 +1699,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.3.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(), 1892); QCOMPARE(object->property("value2").toInt(), 1892); @@ -1720,7 +1720,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.4.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("enumAlias").toInt(), 1); @@ -1732,7 +1732,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.5.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant v = object->property("otherAlias"); QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>()); @@ -1754,7 +1754,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.6.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("a").toInt(), 1923); } @@ -1766,12 +1766,12 @@ void tst_qqmllanguage::aliasProperties() VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *object1 = qvariant_cast<QObject *>(object->property("object")); - QVERIFY(object1 != 0); + QVERIFY(object1 != nullptr); QObject *object2 = qvariant_cast<QObject *>(object1->property("object")); - QVERIFY(object2 != 0); + QVERIFY(object2 != nullptr); QObject *alias = qvariant_cast<QObject *>(object->property("aliasedObject")); QCOMPARE(alias, object2); @@ -1780,7 +1780,7 @@ void tst_qqmllanguage::aliasProperties() QObject *alias2 = object; // "Random" start value int status = -1; - void *a[] = { &alias2, 0, &status }; + void *a[] = { &alias2, nullptr, &status }; QMetaObject::metacall(object, QMetaObject::ReadProperty, object->metaObject()->indexOfProperty("aliasedObject"), a); QVERIFY(!alias2); @@ -1791,7 +1791,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.8.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(), 10); @@ -1803,7 +1803,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.9.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(), 10); @@ -1816,7 +1816,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.10.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Read through alias QCOMPARE(object->property("valueAlias").toRect(), QRect(10, 11, 9, 8)); @@ -1836,7 +1836,7 @@ void tst_qqmllanguage::aliasProperties() QQmlComponent component(&engine, testFileUrl("alias.11.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // Read through alias QCOMPARE(object->property("aliasProperty").toInt(), 19); @@ -1911,19 +1911,19 @@ void tst_qqmllanguage::componentCompositeType() QQmlComponent component(&engine, testFileUrl("componentCompositeType.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } class TestType : public QObject { Q_OBJECT public: - TestType(QObject *p=0) : QObject(p) {} + TestType(QObject *p=nullptr) : QObject(p) {} }; class TestType2 : public QObject { Q_OBJECT public: - TestType2(QObject *p=0) : QObject(p) {} + TestType2(QObject *p=nullptr) : QObject(p) {} }; void tst_qqmllanguage::i18n_data() @@ -1945,7 +1945,7 @@ void tst_qqmllanguage::i18n() QQmlComponent component(&engine, testFileUrl(file)); VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->stringProperty(), stringProperty); delete object; @@ -1960,7 +1960,7 @@ void tst_qqmllanguage::onCompleted() QTest::ignoreMessage(QtDebugMsg, "Completed 6 10"); QTest::ignoreMessage(QtDebugMsg, "Completed 10 11"); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } // Check that the Component::onDestruction attached property works @@ -1969,7 +1969,7 @@ void tst_qqmllanguage::onDestruction() QQmlComponent component(&engine, testFileUrl("onDestruction.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10"); QTest::ignoreMessage(QtDebugMsg, "Destruction 6 10"); QTest::ignoreMessage(QtDebugMsg, "Destruction 10 11"); @@ -1984,7 +1984,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(!object->scriptProperty().isEmpty()); QCOMPARE(object->scriptProperty().stringLiteral(), QString()); bool ok; @@ -1992,12 +1992,12 @@ void tst_qqmllanguage::scriptString() QCOMPARE(ok, false); const QQmlScriptStringPrivate *scriptPrivate = QQmlScriptStringPrivate::get(object->scriptProperty()); - QVERIFY(scriptPrivate != 0); + QVERIFY(scriptPrivate != nullptr); QCOMPARE(scriptPrivate->script, QString("foo + bar")); QCOMPARE(scriptPrivate->scope, qobject_cast<QObject*>(object)); QCOMPARE(scriptPrivate->context, qmlContext(object)); - QVERIFY(object->grouped() != 0); + QVERIFY(object->grouped() != nullptr); const QQmlScriptStringPrivate *groupedPrivate = QQmlScriptStringPrivate::get(object->grouped()->script()); QCOMPARE(groupedPrivate->script, QString("console.log(1921)")); QCOMPARE(groupedPrivate->scope, qobject_cast<QObject*>(object)); @@ -2009,7 +2009,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->scriptProperty().stringLiteral(), QString("hello\\n\\\"world\\\"")); } @@ -2018,7 +2018,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); bool ok; QCOMPARE(object->scriptProperty().numberLiteral(&ok), qreal(12.345)); QCOMPARE(ok, true); @@ -2030,7 +2030,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); bool ok; QCOMPARE(object->scriptProperty().booleanLiteral(&ok), true); QCOMPARE(ok, true); @@ -2041,7 +2041,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->scriptProperty().isNullLiteral(), true); } @@ -2050,7 +2050,7 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->scriptProperty().isUndefinedLiteral(), true); } { @@ -2058,11 +2058,11 @@ void tst_qqmllanguage::scriptString() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlScriptString ss = object->scriptProperty(); { - QQmlExpression expr(ss, /*context*/0, object); + QQmlExpression expr(ss, /*context*/nullptr, object); QCOMPARE(expr.evaluate().toInt(), int(100)); } @@ -2071,7 +2071,7 @@ void tst_qqmllanguage::scriptString() QVERIFY(testScope.metaObject()->indexOfProperty("intProperty") != object->metaObject()->indexOfProperty("intProperty")); testScope.setIntProperty(42); - QQmlExpression expr(ss, /*context*/0, &testScope); + QQmlExpression expr(ss, /*context*/nullptr, &testScope); QCOMPARE(expr.evaluate().toInt(), int(42)); } } @@ -2084,9 +2084,9 @@ void tst_qqmllanguage::scriptStringJs() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlContext *context = QQmlEngine::contextForObject(object); - QVERIFY(context != 0); + QVERIFY(context != nullptr); bool ok; QCOMPARE(QQmlScriptStringPrivate::get(object->scriptProperty())->script, QString("\" hello \\\" world \"")); @@ -2188,7 +2188,7 @@ void tst_qqmllanguage::scriptStringWithoutSourceCode() VERIFY_ERRORS(0); MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlScriptString ss = object->scriptProperty(); QVERIFY(!ss.isEmpty()); QCOMPARE(ss.stringLiteral(), QString()); @@ -2197,13 +2197,13 @@ void tst_qqmllanguage::scriptStringWithoutSourceCode() QCOMPARE(ok, false); const QQmlScriptStringPrivate *scriptPrivate = QQmlScriptStringPrivate::get(ss); - QVERIFY(scriptPrivate != 0); + QVERIFY(scriptPrivate != nullptr); QVERIFY(scriptPrivate->script.isEmpty()); QCOMPARE(scriptPrivate->scope, qobject_cast<QObject*>(object)); QCOMPARE(scriptPrivate->context, qmlContext(object)); { - QQmlExpression expr(ss, /*context*/0, object); + QQmlExpression expr(ss, /*context*/nullptr, object); QCOMPARE(expr.evaluate().toInt(), int(100)); } } @@ -2215,17 +2215,17 @@ void tst_qqmllanguage::scriptStringComparison() QQmlComponent component1(&engine, testFileUrl("scriptString.qml")); QVERIFY(!component1.isError() && component1.errors().isEmpty()); MyTypeObject *object1 = qobject_cast<MyTypeObject*>(component1.create()); - QVERIFY(object1 != 0); + QVERIFY(object1 != nullptr); QQmlComponent component2(&engine, testFileUrl("scriptString2.qml")); QVERIFY(!component2.isError() && component2.errors().isEmpty()); MyTypeObject *object2 = qobject_cast<MyTypeObject*>(component2.create()); - QVERIFY(object2 != 0); + QVERIFY(object2 != nullptr); QQmlComponent component3(&engine, testFileUrl("scriptString3.qml")); QVERIFY(!component3.isError() && component3.errors().isEmpty()); MyTypeObject *object3 = qobject_cast<MyTypeObject*>(component3.create()); - QVERIFY(object3 != 0); + QVERIFY(object3 != nullptr); //QJSValue inst1 = engine.newQObject(object1); QJSValue inst2 = engine.newQObject(object2); @@ -2285,7 +2285,7 @@ void tst_qqmllanguage::scriptStringComparison() // because the (none literal) script string may access variables which have different // values in both instances and hence evaluated to different results. MyTypeObject *object1_2 = qobject_cast<MyTypeObject*>(component1.create()); - QVERIFY(object1_2 != 0); + QVERIFY(object1_2 != nullptr); QVERIFY(object1->scriptProperty() != object1_2->scriptProperty()); } @@ -2297,7 +2297,7 @@ void tst_qqmllanguage::defaultPropertyListOrder() VERIFY_ERRORS(0); MyContainer *container = qobject_cast<MyContainer *>(component.create()); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->getChildren()->count(), 6); QCOMPARE(container->getChildren()->at(0)->property("index"), QVariant(0)); @@ -2426,7 +2426,7 @@ void tst_qqmllanguage::testType(const QString& qml, const QString& type, const Q } else { VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(QString(object->metaObject()->className()), type); delete object; } @@ -2440,7 +2440,7 @@ void tst_qqmllanguage::inlineAssignmentsOverrideBindings() QQmlComponent component(&engine, testFileUrl("inlineAssignmentsOverrideBindings.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toInt(), 11); delete o; } @@ -2874,7 +2874,7 @@ void tst_qqmllanguage::importsPath() VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toString(), value); delete object; @@ -3085,7 +3085,7 @@ void tst_qqmllanguage::importJs() if (performTest) { QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(),true); delete object; } @@ -3130,27 +3130,27 @@ void tst_qqmllanguage::qmlAttachedPropertiesObjectMethod() { QObject object; - QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, false), (QObject *)0); + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, false), (QObject *)nullptr); QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(&object, true)); { QQmlComponent component(&engine, testFileUrl("qmlAttachedPropertiesObjectMethod.1.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(object, false), (QObject *)0); - QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(object, false), (QObject *)nullptr); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != nullptr); } { QQmlComponent component(&engine, testFileUrl("qmlAttachedPropertiesObjectMethod.2.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); - QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, false) != 0); - QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, false) != nullptr); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != nullptr); } } @@ -3172,7 +3172,7 @@ void tst_qqmllanguage::customOnProperty() VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("on").toInt(), 10); @@ -3186,7 +3186,7 @@ void tst_qqmllanguage::variantNotify() VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("notifyCount").toInt(), 1); @@ -3200,7 +3200,7 @@ void tst_qqmllanguage::revisions() VERIFY_ERRORS(0); MyRevisionedClass *object = qobject_cast<MyRevisionedClass*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->prop2(), 10.0); @@ -3212,7 +3212,7 @@ void tst_qqmllanguage::revisions() VERIFY_ERRORS(0); MyRevisionedSubclass *object = qobject_cast<MyRevisionedSubclass*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->prop1(), 10.0); QCOMPARE(object->prop2(), 10.0); @@ -3225,7 +3225,7 @@ void tst_qqmllanguage::revisions() QQmlComponent component(&engine, testFileUrl("versionedbase.qml")); VERIFY_ERRORS(0); MySubclass *object = qobject_cast<MySubclass*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->prop1(), 10.0); QCOMPARE(object->prop2(), 10.0); @@ -3277,7 +3277,7 @@ void tst_qqmllanguage::subclassedUncreateableRevision() QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready"); c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QObject *obj = c.create(); - QCOMPARE(obj, static_cast<QObject*>(0)); + QCOMPARE(obj, static_cast<QObject*>(nullptr)); QCOMPARE(c.errors().count(), 1); QCOMPARE(c.errors().first().description(), QString("Cannot create MyUncreateableBaseClass")); } @@ -3290,7 +3290,7 @@ void tst_qqmllanguage::subclassedUncreateableRevision() c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QObject *obj = c.create(); if (!shouldWork) { - QCOMPARE(obj, static_cast<QObject*>(0)); + QCOMPARE(obj, static_cast<QObject*>(nullptr)); return; } @@ -3333,7 +3333,7 @@ void tst_qqmllanguage::subclassedExtendedUncreateableRevision() QTest::ignoreMessage(QtWarningMsg, "QQmlComponent: Component is not ready"); c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QObject *obj = c.create(); - QCOMPARE(obj, static_cast<QObject*>(0)); + QCOMPARE(obj, static_cast<QObject*>(nullptr)); QCOMPARE(c.errors().count(), 1); QCOMPARE(c.errors().first().description(), QString("Cannot create MyExtendedUncreateableBaseClass")); } @@ -3346,7 +3346,7 @@ void tst_qqmllanguage::subclassedExtendedUncreateableRevision() c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QObject *obj = c.create(); if (!shouldWork) { - QCOMPARE(obj, static_cast<QObject*>(0)); + QCOMPARE(obj, static_cast<QObject*>(nullptr)); return; } @@ -3416,7 +3416,7 @@ void tst_qqmllanguage::aliasPropertyChangeSignals() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -3429,7 +3429,7 @@ void tst_qqmllanguage::aliasPropertyChangeSignals() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); @@ -3445,7 +3445,7 @@ void tst_qqmllanguage::propertyInit() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toInt(), 1); @@ -3457,7 +3457,7 @@ void tst_qqmllanguage::propertyInit() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toInt(), 123); @@ -3472,7 +3472,7 @@ void tst_qqmllanguage::registrationOrder() QQmlComponent component(&engine, testFileUrl("registrationOrder.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->metaObject(), &MyVersion2Class::staticMetaObject); delete o; } @@ -3482,7 +3482,7 @@ void tst_qqmllanguage::readonly() QQmlComponent component(&engine, testFileUrl("readonly.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toInt(), 10); QCOMPARE(o->property("test2").toInt(), 18); @@ -3534,7 +3534,7 @@ void tst_qqmllanguage::receivers() QQmlComponent component(&engine, testFileUrl("receivers.qml")); MyReceiversTestObject *o = qobject_cast<MyReceiversTestObject*>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->mySignalCount(), 1); QCOMPARE(o->propChangedCount(), 2); QCOMPARE(o->myUnconnectedSignalCount(), 0); @@ -3552,7 +3552,7 @@ void tst_qqmllanguage::registeredCompositeType() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; } @@ -3564,7 +3564,7 @@ void tst_qqmllanguage::registeredCompositeTypeWithEnum() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("enumValue0").toInt(), static_cast<int>(MyCompositeBaseType::EnumValue0)); QCOMPARE(o->property("enumValue42").toInt(), static_cast<int>(MyCompositeBaseType::EnumValue42)); @@ -3580,7 +3580,7 @@ void tst_qqmllanguage::registeredCompositeTypeWithAttachedProperty() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("attachedProperty").toString(), QStringLiteral("test")); @@ -3606,7 +3606,7 @@ void tst_qqmllanguage::signalWithDefaultArg() QQmlComponent component(&engine, testFileUrl("signalWithDefaultArg.qml")); MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("signalCount").toInt(), 0); QCOMPARE(object->property("signalArg").toInt(), 0); @@ -3637,7 +3637,7 @@ void tst_qqmllanguage::signalParameterTypes() { QQmlComponent component(&engine, testFileUrl("signalParameterTypes.1.qml")); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(obj->property("success").toBool()); delete obj; } @@ -3646,7 +3646,7 @@ void tst_qqmllanguage::signalParameterTypes() { QQmlComponent component(&engine, testFileUrl("signalParameterTypes.2.qml")); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(obj->property("success").toBool()); delete obj; } @@ -3662,14 +3662,14 @@ void tst_qqmllanguage::globalEnums() QQmlComponent component(&engine, testFileUrl("globalEnums.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); MyEnum1Class *enum1Class = o->findChild<MyEnum1Class *>(QString::fromLatin1("enum1Class")); - QVERIFY(enum1Class != 0); + QVERIFY(enum1Class != nullptr); QVERIFY(enum1Class->getValue() == -1); MyEnumDerivedClass *enum2Class = o->findChild<MyEnumDerivedClass *>(QString::fromLatin1("enumDerivedClass")); - QVERIFY(enum2Class != 0); + QVERIFY(enum2Class != nullptr); QVERIFY(enum2Class->getValueA() == -1); QVERIFY(enum2Class->getValueB() == -1); QVERIFY(enum2Class->getValueC() == 0); @@ -3754,7 +3754,7 @@ void tst_qqmllanguage::scopedEnum() QQmlComponent component(&engine, testFileUrl("scopedEnum.qml")); MyTypeObject *o = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->scopedEnum(), MyTypeObject::MyScopedEnum::ScopedVal1); QCOMPARE(o->intProperty(), (int)MyTypeObject::MyScopedEnum::ScopedVal2); @@ -3831,7 +3831,7 @@ void tst_qqmllanguage::literals() QQmlComponent component(&engine, testFile("literals.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property(property.toLatin1()), value); delete object; } @@ -3853,13 +3853,13 @@ void tst_qqmllanguage::objectDeletionNotify() QQmlComponent component(&engine, testFile(file)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); QMetaObject::invokeMethod(object, "destroyObject"); // Process the deletion event - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QCOMPARE(object->property("success").toBool(), true); @@ -3872,7 +3872,7 @@ void tst_qqmllanguage::scopedProperties() QQmlComponent component(&engine, testFile("scopedProperties.qml")); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QVERIFY(o->property("success").toBool()); } @@ -3880,7 +3880,7 @@ void tst_qqmllanguage::deepProperty() { QQmlComponent component(&engine, testFile("deepProperty.qml")); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QFont font = qvariant_cast<QFont>(qvariant_cast<QObject*>(o->property("someObject"))->property("font")); QCOMPARE(font.family(), QStringLiteral("test")); } @@ -3899,10 +3899,10 @@ void tst_qqmllanguage::implicitImportsLast() QQmlComponent component(&engine, testFile("localOrderTest.qml")); VERIFY_ERRORS(0); QObject *object = qobject_cast<QObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(QString(object->metaObject()->className()).startsWith(QLatin1String("QQuickMouseArea"))); QObject* object2 = object->property("item").value<QObject*>(); - QVERIFY(object2 != 0); + QVERIFY(object2 != nullptr); QCOMPARE(QString(object2->metaObject()->className()), QLatin1String("QQuickRectangle")); engine.setImportPathList(defaultImportPathList); @@ -3910,8 +3910,8 @@ void tst_qqmllanguage::implicitImportsLast() void tst_qqmllanguage::getSingletonInstance(QQmlEngine& engine, const char* fileName, const char* propertyName, QObject** result /* out */) { - QVERIFY(fileName != 0); - QVERIFY(propertyName != 0); + QVERIFY(fileName != nullptr); + QVERIFY(propertyName != nullptr); if (!fileName || !propertyName) return; @@ -3919,15 +3919,15 @@ void tst_qqmllanguage::getSingletonInstance(QQmlEngine& engine, const char* file QQmlComponent component(&engine, testFile(fileName)); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); getSingletonInstance(object, propertyName, result); } void tst_qqmllanguage::getSingletonInstance(QObject* o, const char* propertyName, QObject** result /* out */) { - QVERIFY(o != 0); - QVERIFY(propertyName != 0); + QVERIFY(o != nullptr); + QVERIFY(propertyName != nullptr); if (!o || !propertyName) return; @@ -3935,11 +3935,11 @@ void tst_qqmllanguage::getSingletonInstance(QObject* o, const char* propertyName QVariant variant = o->property(propertyName); QVERIFY(variant.userType() == qMetaTypeId<QObject *>()); - QObject *singleton = NULL; + QObject *singleton = nullptr; if (variant.canConvert<QObject*>()) singleton = variant.value<QObject*>(); - QVERIFY(singleton != 0); + QVERIFY(singleton != nullptr); *result = singleton; } @@ -3959,7 +3959,7 @@ void tst_qqmllanguage::compositeSingletonProperties() QQmlComponent component(&engine, testFile("singletonTest1.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 125, "value2", -55); } @@ -3968,14 +3968,14 @@ void tst_qqmllanguage::compositeSingletonProperties() // engine are the same. void tst_qqmllanguage::compositeSingletonSameEngine() { - QObject* s1 = NULL; + QObject* s1 = nullptr; getSingletonInstance(engine, "singletonTest2.qml", "singleton1", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); s1->setProperty("testProp2", QVariant(13)); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest3.qml", "singleton2", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s2->property("testProp2"), QVariant(13)); QCOMPARE(s1, s2); @@ -3987,14 +3987,14 @@ void tst_qqmllanguage::compositeSingletonDifferentEngine() { QQmlEngine e2; - QObject* s1 = NULL; + QObject* s1 = nullptr; getSingletonInstance(engine, "singletonTest2.qml", "singleton1", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); s1->setProperty("testProp2", QVariant(13)); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(e2, "singletonTest3.qml", "singleton2", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s2->property("testProp2"), QVariant(25)); QVERIFY(s1 != s2); @@ -4013,19 +4013,19 @@ void tst_qqmllanguage::compositeSingletonQualifiedNamespace() QQmlComponent component(&engine, testFile("singletonTest5.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 125, "value2", -55); // lets verify that the singleton instance we are using is the same // when loaded through another file (without namespace!) - QObject *s1 = NULL; + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest5a.qml", "singletonInstance", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s1, s2); } @@ -4038,20 +4038,20 @@ void tst_qqmllanguage::compositeSingletonModule() QQmlComponent component(&engine, testFile("singletonTest6.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 125, "value2", -55); verifyCompositeSingletonPropertyValues(o, "value3", 125, "value4", -55); // lets verify that the singleton instance we are using is the same // when loaded through another file - QObject *s1 = NULL; + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest6a.qml", "singletonInstance", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s1, s2); } @@ -4064,20 +4064,20 @@ void tst_qqmllanguage::compositeSingletonModuleVersioned() QQmlComponent component(&engine, testFile("singletonTest7.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 225, "value2", 55); verifyCompositeSingletonPropertyValues(o, "value3", 225, "value4", 55); // lets verify that the singleton instance we are using is the same // when loaded through another file - QObject *s1 = NULL; + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest7a.qml", "singletonInstance", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s1, s2); } @@ -4090,20 +4090,20 @@ void tst_qqmllanguage::compositeSingletonModuleQualified() QQmlComponent component(&engine, testFile("singletonTest8.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 225, "value2", 55); verifyCompositeSingletonPropertyValues(o, "value3", 225, "value4", 55); // lets verify that the singleton instance we are using is the same // when loaded through another file - QObject *s1 = NULL; + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); - QObject* s2 = NULL; + QObject* s2 = nullptr; getSingletonInstance(engine, "singletonTest8a.qml", "singletonInstance", &s2); - QVERIFY(s2 != 0); + QVERIFY(s2 != nullptr); QCOMPARE(s1, s2); } @@ -4129,7 +4129,7 @@ void tst_qqmllanguage::compositeSingletonDynamicSignal() QQmlComponent component(&engine, testFile("singletonTest11.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 99, "value2", -55); } @@ -4178,7 +4178,7 @@ void tst_qqmllanguage::compositeSingletonRemote() VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 525, "value2", 355); } @@ -4191,7 +4191,7 @@ void tst_qqmllanguage::compositeSingletonJavaScriptPragma() QQmlComponent component(&engine, testFile("singletonTest16.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); // The value1 that is read from the SingletonType was changed from 125 to 99 // in compositeSingletonDynamicSignal() above. As the type is a singleton and @@ -4209,7 +4209,7 @@ void tst_qqmllanguage::compositeSingletonSelectors() QQmlComponent component(&e2, testFile("singletonTest1.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 625, "value2", 455); } @@ -4221,7 +4221,7 @@ void tst_qqmllanguage::compositeSingletonRegistered() QQmlComponent component(&engine, testFile("singletonTest17.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); verifyCompositeSingletonPropertyValues(o, "value1", 925, "value2", 755); } @@ -4234,7 +4234,7 @@ void tst_qqmllanguage::compositeSingletonCircular() QQmlTestMessageHandler messageHandler; QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); // ensure we aren't hitting the recursion warning QVERIFY2(messageHandler.messages().isEmpty(), qPrintable(messageHandler.messageString())); @@ -4321,7 +4321,7 @@ void tst_qqmllanguage::preservePropertyCacheOnGroupObjects() QVERIFY(ddata); QQmlPropertyCache *subCache = ddata->propertyCache; QVERIFY(subCache); - QQmlPropertyData *pd = subCache->property(QStringLiteral("newProperty"), /*object*/0, /*context*/0); + QQmlPropertyData *pd = subCache->property(QStringLiteral("newProperty"), /*object*/nullptr, /*context*/nullptr); QVERIFY(pd); QCOMPARE(pd->propType(), qMetaTypeId<int>()); } @@ -4589,7 +4589,7 @@ void tst_qqmllanguage::noChildEvents() component.setData("import QtQml 2.0; import Test 1.0; MyQmlObject { property QtObject child: QtObject {} }", QUrl()); VERIFY_ERRORS(0); MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->childAddedEventCount(), 0); } @@ -4609,14 +4609,14 @@ void tst_qqmllanguage::deleteSingletons() QQmlComponent component(&tmpEngine, testFile("singletonTest5.qml")); VERIFY_ERRORS(0); QObject *o = component.create(); - QVERIFY(o != 0); - QObject *s1 = NULL; + QVERIFY(o != nullptr); + QObject *s1 = nullptr; getSingletonInstance(o, "singletonInstance", &s1); - QVERIFY(s1 != 0); + QVERIFY(s1 != nullptr); singleton = s1; - QVERIFY(singleton.data() != 0); + QVERIFY(singleton.data() != nullptr); } - QVERIFY(singleton.data() == 0); + QVERIFY(singleton.data() == nullptr); } void tst_qqmllanguage::arrayBuffer_data() @@ -4636,7 +4636,7 @@ void tst_qqmllanguage::arrayBuffer() QQmlComponent component(&engine, testFile(file)); VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("ok").toBool(), true); } @@ -4855,9 +4855,9 @@ void tst_qqmllanguage::instanceof() VERIFY_ERRORS(0); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); - QQmlExpression expr(engine.contextForObject(o.data()), 0, QString::fromLatin1(QTest::currentDataTag())); + QQmlExpression expr(engine.contextForObject(o.data()), nullptr, QString::fromLatin1(QTest::currentDataTag())); QVariant ret = expr.evaluate(); if (expectedValue.type() == QVariant::Bool) { diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp index 513bea2e16..e6e47bda28 100644 --- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp +++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp @@ -45,7 +45,7 @@ struct Range template <typename T> struct Array { - Array() : array(0), count(0) {} + Array() : array(nullptr), count(0) {} template<int N> Array(const T (&array)[N]) : array(array), count(N) {} T operator [](int index) const { return array[index]; } @@ -181,7 +181,7 @@ void tst_qqmllistcompositor::find_data() << (RangeList() << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 1, 1, int(C::AppendFlag | C::PrependFlag | C::CacheFlag)) - << Range(0, 0, 1, int(VisibleFlag| C::CacheFlag))) + << Range(nullptr, 0, 1, int(VisibleFlag| C::CacheFlag))) << C::Cache << 2 << Selection << 0 << 0 << 0 << 0 << 0 @@ -238,7 +238,7 @@ void tst_qqmllistcompositor::findInsertPosition_data() << (RangeList() << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 1, 1, int(C::AppendFlag | C::PrependFlag | C::CacheFlag)) - << Range(0, 0, 1, int(VisibleFlag| C::CacheFlag))) + << Range(nullptr, 0, 1, int(VisibleFlag| C::CacheFlag))) << Selection << 0 << 0 << 0 << 0 << 0 << uint(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag) << 0; @@ -246,7 +246,7 @@ void tst_qqmllistcompositor::findInsertPosition_data() << (RangeList() << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 1, 1, int(C::AppendFlag | C::PrependFlag | C::CacheFlag)) - << Range(0, 0, 1, int(VisibleFlag| C::CacheFlag))) + << Range(nullptr, 0, 1, int(VisibleFlag| C::CacheFlag))) << Selection << 1 << 1 << 1 << 1 << 3 << uint(0) << 0; @@ -390,17 +390,17 @@ void tst_qqmllistcompositor::clearFlags_data() int listA; void *a = &listA; { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0}; - static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0}; + static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr,nullptr}; static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0}; - static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0}; + static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr,nullptr}; static const int visibleIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0}; - static const void *visibleLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0}; + static const void *visibleLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr,nullptr}; static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,11,0,0,0,0}; - static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0,0}; + static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr,nullptr}; QTest::newRow("Default, 2, 2, Selection") << (RangeList() << Range(a, 0, 12, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) - << Range(0, 0, 4, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) + << Range(nullptr, 0, 4, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) << C::Default << 2 << 2 << int(SelectionFlag) << (RemoveList() << Remove(2, 2, 2, 2, 2, SelectionFlag | C::CacheFlag)) @@ -409,19 +409,19 @@ void tst_qqmllistcompositor::clearFlags_data() << IndexArray(visibleIndexes) << ListArray(visibleLists) << IndexArray(selectionIndexes) << ListArray(selectionLists); } { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0}; - static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0}; + static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr,nullptr}; static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0}; - static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0}; + static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr,nullptr}; static const int visibleIndexes[] = {0,2,3,5,6,7,8,9,10,11,0,0,0,0}; - static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0,0}; + static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr,nullptr}; static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,11,0,0,0,0}; - static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0,0}; + static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr,nullptr}; QTest::newRow("Selection, 1, 2, Visible") << (RangeList() << Range(a, 0, 2, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 2, 2, int(C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 4, 8, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) - << Range(0, 0, 4, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) + << Range(nullptr, 0, 4, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) << Selection << 1 << 2 << int(VisibleFlag) << (RemoveList() << Remove(1, 1, 1, 1, 1, VisibleFlag | C::CacheFlag) @@ -431,13 +431,13 @@ void tst_qqmllistcompositor::clearFlags_data() << IndexArray(visibleIndexes) << ListArray(visibleLists) << IndexArray(selectionIndexes) << ListArray(selectionLists); } { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0,0}; - static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0,0}; + static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr,nullptr}; static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0}; - static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0}; + static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr}; static const int visibleIndexes[] = {0,2,3,5,6,7,8,9,10,11,0,0,0}; - static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0}; + static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr}; static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,11,0,0,0}; - static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0}; + static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr}; QTest::newRow("Default, 13, 1, Prepend | Selection | Visible | Default") << (RangeList() << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) @@ -445,7 +445,7 @@ void tst_qqmllistcompositor::clearFlags_data() << Range(a, 2, 2, int(C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 4, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 5, 7, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) - << Range(0, 0, 4, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) + << Range(nullptr, 0, 4, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) << C::Default << 13 << 1 << int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag) << (RemoveList() << Remove(11, 11, 13, 13, 1, SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) @@ -454,13 +454,13 @@ void tst_qqmllistcompositor::clearFlags_data() << IndexArray(visibleIndexes) << ListArray(visibleLists) << IndexArray(selectionIndexes) << ListArray(selectionLists); } { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,0}; - static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a,0}; + static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a,nullptr}; static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11,0,0,0}; - static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,0,0,0}; + static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr}; static const int visibleIndexes[] = {0,2,3,5,6,7,8,9,10,11,0,0,0}; - static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0}; + static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr}; static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,11,0,0,0}; - static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,0,0,0}; + static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a, a,nullptr,nullptr,nullptr}; QTest::newRow("Cache, 11, 4, Cache") << (RangeList() << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) @@ -468,8 +468,8 @@ void tst_qqmllistcompositor::clearFlags_data() << Range(a, 2, 2, int(C::PrependFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 4, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 5, 7, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) - << Range(0, 0, 1, int(C::CacheFlag)) - << Range(0, 0, 3, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) + << Range(nullptr, 0, 1, int(C::CacheFlag)) + << Range(nullptr, 0, 3, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) << C::Cache << 11 << 4 << int(C::CacheFlag) << (RemoveList()) << IndexArray(cacheIndexes) << ListArray(cacheLists) @@ -477,13 +477,13 @@ void tst_qqmllistcompositor::clearFlags_data() << IndexArray(visibleIndexes) << ListArray(visibleLists) << IndexArray(selectionIndexes) << ListArray(selectionLists); } { static const int cacheIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,0}; - static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a,0}; + static const void *cacheLists[] = {a,a,a,a,a,a,a,a,a,a, a,nullptr}; static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,0}; - static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a,0}; + static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a,nullptr}; static const int visibleIndexes[] = {0,2,3,5,6,7,8,9,10,0}; - static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a,0}; + static const void *visibleLists[] = {a,a,a,a,a,a,a,a, a,nullptr}; static const int selectionIndexes[] = {0,1,4,5,6,7,8,9,10,0}; - static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a,0}; + static const void *selectionLists[] = {a,a,a,a,a,a,a,a, a,nullptr}; QTest::newRow("Default, 11, 3, Default | Visible | Selection") << (RangeList() << Range(a, 0, 1, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) @@ -492,8 +492,8 @@ void tst_qqmllistcompositor::clearFlags_data() << Range(a, 4, 1, int(C::PrependFlag | SelectionFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 5, 6, int(C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag)) << Range(a, 11, 1, int(C::AppendFlag | C::PrependFlag | SelectionFlag | VisibleFlag | C::DefaultFlag)) - << Range(0, 0, 2, int(SelectionFlag | VisibleFlag | C::DefaultFlag)) - << Range(0, 0, 1, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) + << Range(nullptr, 0, 2, int(SelectionFlag | VisibleFlag | C::DefaultFlag)) + << Range(nullptr, 0, 1, int(SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag))) << C::Default << 11 << 3 << int(C::DefaultFlag | VisibleFlag| SelectionFlag) << (RemoveList() << Remove(9, 9, 11, 11, 1, SelectionFlag | VisibleFlag | C::DefaultFlag) @@ -584,13 +584,13 @@ void tst_qqmllistcompositor::setFlags_data() int listA; void *a = &listA; { static const int cacheIndexes[] = {0,0,0,0}; - static const void *cacheLists[] = {0,0,0,0}; + static const void *cacheLists[] = {nullptr,nullptr,nullptr,nullptr}; static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11}; static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a}; QTest::newRow("Default, 2, 2, Default") << (RangeList() << Range(a, 0, 12, C::DefaultFlag) - << Range(0, 0, 4, C::CacheFlag)) + << Range(nullptr, 0, 4, C::CacheFlag)) << C::Default << 2 << 2 << int(C::DefaultFlag) << (InsertList()) << IndexArray(cacheIndexes) << ListArray(cacheLists) @@ -598,7 +598,7 @@ void tst_qqmllistcompositor::setFlags_data() << IndexArray() << ListArray() << IndexArray() << ListArray(); } { static const int cacheIndexes[] = {0,0,0,0}; - static const void *cacheLists[] = {0,0,0,0}; + static const void *cacheLists[] = {nullptr,nullptr,nullptr,nullptr}; static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11}; static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a}; static const int visibleIndexes[] = {2,3}; @@ -606,7 +606,7 @@ void tst_qqmllistcompositor::setFlags_data() QTest::newRow("Default, 2, 2, Visible") << (RangeList() << Range(a, 0, 12, C::DefaultFlag) - << Range(0, 0, 4, C::CacheFlag)) + << Range(nullptr, 0, 4, C::CacheFlag)) << C::Default << 2 << 2 << int(VisibleFlag) << (InsertList() << Insert(0, 0, 2, 0, 2, VisibleFlag)) @@ -615,7 +615,7 @@ void tst_qqmllistcompositor::setFlags_data() << IndexArray(visibleIndexes) << ListArray(visibleLists) << IndexArray() << ListArray(); } { static const int cacheIndexes[] = {3,6,0,0,0,0}; - static const void *cacheLists[] = {a,a,0,0,0,0}; + static const void *cacheLists[] = {a,a,nullptr,nullptr,nullptr,nullptr}; static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11}; static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a}; static const int visibleIndexes[] = {2,3,6,7}; @@ -629,7 +629,7 @@ void tst_qqmllistcompositor::setFlags_data() << Range(a, 4, 2, C::DefaultFlag) << Range(a, 6, 2, VisibleFlag | C::DefaultFlag) << Range(a, 8, 4, C::DefaultFlag) - << Range(0, 0, 4, C::CacheFlag)) + << Range(nullptr, 0, 4, C::CacheFlag)) << Visible << 1 << 2 << int(SelectionFlag | C::CacheFlag) << (InsertList() << Insert(0, 1, 3, 0, 1, SelectionFlag | C::CacheFlag) @@ -639,11 +639,11 @@ void tst_qqmllistcompositor::setFlags_data() << IndexArray(visibleIndexes) << ListArray(visibleLists) << IndexArray(selectionIndexes) << ListArray(selectionLists); } { static const int cacheIndexes[] = {3,6,0,0,0,0}; - static const void *cacheLists[] = {a,a,0,0,0,0}; + static const void *cacheLists[] = {a,a,nullptr,nullptr,nullptr,nullptr}; static const int defaultIndexes[] = {0,1,2,3,4,5,6,7,8,9,10,11}; static const void *defaultLists[] = {a,a,a,a,a,a,a,a,a,a, a, a}; static const int visibleIndexes[] = {2,3,6,7,0}; - static const void *visibleLists[] = {a,a,a,a,0}; + static const void *visibleLists[] = {a,a,a,a,nullptr}; static const int selectionIndexes[] = {3,6}; static const void *selectionLists[] = {a,a}; QTest::newRow("Cache, 3, 1, Visible") @@ -655,7 +655,7 @@ void tst_qqmllistcompositor::setFlags_data() << Range(a, 6, 1, SelectionFlag | VisibleFlag | C::DefaultFlag | C::CacheFlag) << Range(a, 7, 1, VisibleFlag | C::DefaultFlag) << Range(a, 8, 4, C::DefaultFlag) - << Range(0, 0, 4, C::CacheFlag)) + << Range(nullptr, 0, 4, C::CacheFlag)) << C::Cache << 3 << 1 << int(VisibleFlag) << (InsertList() << Insert(2, 4, 12, 3, 1, VisibleFlag | C::CacheFlag)) @@ -770,14 +770,14 @@ void tst_qqmllistcompositor::move_data() int listC; void *c = &listC; { static const int cacheIndexes[] = {0,0,0,0,2,3}; - static const void *cacheLists[] = {0,0,0,0,c,c}; + static const void *cacheLists[] = {nullptr,nullptr,nullptr,nullptr,c,c}; static const int defaultIndexes[] = {0,0,1,2,3,4,5,0,1,2,3,4,5,1,2,3,0,1,2,3,4,5}; - static const void *defaultLists[] = {0,a,a,a,a,a,a,b,b,b,b,b,b,0,0,0,c,c,c,c,c,c}; + static const void *defaultLists[] = {nullptr,a,a,a,a,a,a,b,b,b,b,b,b,nullptr,nullptr,nullptr,c,c,c,c,c,c}; QTest::newRow("15, 0, 1") << (RangeList() << Range(a, 0, 6, C::DefaultFlag) << Range(b, 0, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag) - << Range(0, 0, 4, C::DefaultFlag | C::CacheFlag) + << Range(nullptr, 0, 4, C::DefaultFlag | C::CacheFlag) << Range(c, 0, 2, C::PrependFlag | C::DefaultFlag) << Range(c, 2, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag) << Range(c, 4, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)) @@ -791,15 +791,15 @@ void tst_qqmllistcompositor::move_data() << IndexArray() << ListArray() << IndexArray() << ListArray(); } { static const int cacheIndexes[] = {0,0,0,0,2,3}; - static const void *cacheLists[] = {0,0,0,0,c,c}; + static const void *cacheLists[] = {nullptr,nullptr,nullptr,nullptr,c,c}; static const int defaultIndexes[] = {0,1,0,1,2,3,4,5,0,1,2,3,4,5,2,3,0,1,2,3,4,5}; - static const void *defaultLists[] = {0,0,a,a,a,a,a,a,b,b,b,b,b,b,0,0,c,c,c,c,c,c}; + static const void *defaultLists[] = {nullptr,nullptr,a,a,a,a,a,a,b,b,b,b,b,b,nullptr,nullptr,c,c,c,c,c,c}; QTest::newRow("15, 1, 1") << (RangeList() - << Range(0, 0, 1, C::DefaultFlag | C::CacheFlag) + << Range(nullptr, 0, 1, C::DefaultFlag | C::CacheFlag) << Range(a, 0, 6, C::DefaultFlag) << Range(b, 0, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag) - << Range(0, 0, 3, C::DefaultFlag | C::CacheFlag) + << Range(nullptr, 0, 3, C::DefaultFlag | C::CacheFlag) << Range(c, 0, 2, C::PrependFlag | C::DefaultFlag) << Range(c, 2, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag) << Range(c, 4, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)) @@ -813,15 +813,15 @@ void tst_qqmllistcompositor::move_data() << IndexArray() << ListArray() << IndexArray() << ListArray(); } { static const int cacheIndexes[] = {0,0,0,0,2,3}; - static const void *cacheLists[] = {0,0,0,0,c,c}; + static const void *cacheLists[] = {nullptr,nullptr,nullptr,nullptr,c,c}; static const int defaultIndexes[] = {0,1,2,0,1,3,4,5,0,1,2,3,4,5,2,3,0,1,2,3,4,5}; - static const void *defaultLists[] = {a,a,a,0,0,a,a,a,b,b,b,b,b,b,0,0,c,c,c,c,c,c}; + static const void *defaultLists[] = {a,a,a,nullptr,nullptr,a,a,a,b,b,b,b,b,b,nullptr,nullptr,c,c,c,c,c,c}; QTest::newRow("0, 3, 2") << (RangeList() - << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag) + << Range(nullptr, 0, 2, C::DefaultFlag | C::CacheFlag) << Range(a, 0, 6, C::DefaultFlag) << Range(b, 0, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag) - << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag) + << Range(nullptr, 0, 2, C::DefaultFlag | C::CacheFlag) << Range(c, 0, 2, C::PrependFlag | C::DefaultFlag) << Range(c, 2, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag) << Range(c, 4, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)) @@ -835,16 +835,16 @@ void tst_qqmllistcompositor::move_data() << IndexArray() << ListArray() << IndexArray() << ListArray(); } { static const int cacheIndexes[] = {0,0,0,0,2,3}; - static const void *cacheLists[] = {0,0,0,0,c,c}; + static const void *cacheLists[] = {nullptr,nullptr,nullptr,nullptr,c,c}; static const int defaultIndexes[] = {0,5,0,1,2,3,4,5,0,1,0,1,2,2,3,3,4,1,2,3,4,5}; - static const void *defaultLists[] = {a,a,b,b,b,b,b,b,0,0,c,a,a,0,0,a,a,c,c,c,c,c}; + static const void *defaultLists[] = {a,a,b,b,b,b,b,b,nullptr,nullptr,c,a,a,nullptr,nullptr,a,a,c,c,c,c,c}; QTest::newRow("7, 1, 10") << (RangeList() << Range(a, 0, 3, C::DefaultFlag) - << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag) + << Range(nullptr, 0, 2, C::DefaultFlag | C::CacheFlag) << Range(a, 3, 3, C::DefaultFlag) << Range(b, 0, 6, C::AppendFlag | C::PrependFlag | C::DefaultFlag) - << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag) + << Range(nullptr, 0, 2, C::DefaultFlag | C::CacheFlag) << Range(c, 0, 2, C::PrependFlag | C::DefaultFlag) << Range(c, 2, 2, C::PrependFlag | C::DefaultFlag | C::CacheFlag) << Range(c, 4, 2, C::AppendFlag | C::PrependFlag | C::DefaultFlag)) @@ -864,18 +864,18 @@ void tst_qqmllistcompositor::move_data() << IndexArray() << ListArray() << IndexArray() << ListArray(); } { static const int cacheIndexes[] = {0,0,0,0,3,2}; - static const void *cacheLists[] = {0,0,0,0,c,c}; + static const void *cacheLists[] = {nullptr,nullptr,nullptr,nullptr,c,c}; static const int defaultIndexes[] = {0,5,0,1,2,3,4,5,0,1,0,1,2,2,3,3,4,3,4,5,1,2}; - static const void *defaultLists[] = {a,a,b,b,b,b,b,b,0,0,c,a,a,0,0,a,a,c,c,c,c,c}; + static const void *defaultLists[] = {a,a,b,b,b,b,b,b,nullptr,nullptr,c,a,a,nullptr,nullptr,a,a,c,c,c,c,c}; QTest::newRow("17, 20, 2") << (RangeList() << Range(a, 0, 1, C::DefaultFlag) << Range(a, 5, 1, C::DefaultFlag) << Range(b, 0, 6, C::DefaultFlag) - << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag) + << Range(nullptr, 0, 2, C::DefaultFlag | C::CacheFlag) << Range(c, 0, 1, C::DefaultFlag) << Range(a, 1, 2, C::DefaultFlag) - << Range(0, 0, 2, C::DefaultFlag | C::CacheFlag) + << Range(nullptr, 0, 2, C::DefaultFlag | C::CacheFlag) << Range(a, 3, 2, C::DefaultFlag) << Range(b, 0, 6, C::AppendFlag | C::PrependFlag) << Range(c, 0, 1, C::PrependFlag) @@ -1072,7 +1072,7 @@ void tst_qqmllistcompositor::clear() compositor.append(a, 0, 8, C::AppendFlag | C::PrependFlag | VisibleFlag | C::DefaultFlag); compositor.append(b, 4, 5, VisibleFlag | C::DefaultFlag); - compositor.append(0, 0, 3, VisibleFlag | C::DefaultFlag | C::CacheFlag); + compositor.append(nullptr, 0, 3, VisibleFlag | C::DefaultFlag | C::CacheFlag); QCOMPARE(compositor.count(C::Default), 16); QCOMPARE(compositor.count(Visible), 16); diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp index 1fbca26a66..4618ea4071 100644 --- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp +++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp @@ -49,7 +49,7 @@ Q_DECLARE_METATYPE(QList<QVariantHash>) inline QVariant runexpr(QQmlEngine *engine, const QString &str) { - QQmlExpression expr(engine->rootContext(), 0, str); + QQmlExpression expr(engine->rootContext(), nullptr, str); return expr.evaluate(); } @@ -132,7 +132,7 @@ bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVarian bool allOk = true; QQmlListModel *model = qobject_cast<QQmlListModel *>(object.value<QObject *>()); - if (model == 0) + if (model == nullptr) return false; if (model->count() != testList.count()) @@ -255,7 +255,7 @@ void tst_qqmllistmodel::static_types() QVERIFY(!component.isError()); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); if (error.isEmpty()) { QVariant actual = obj->property("test"); @@ -326,7 +326,7 @@ void tst_qqmllistmodel::static_i18n() QVERIFY(!component.isError()); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVariant actual = obj->property("test"); @@ -375,7 +375,7 @@ void tst_qqmllistmodel::dynamic_i18n() QVERIFY(!component.isError()); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVariant actual = obj->property("test"); @@ -413,7 +413,7 @@ void tst_qqmllistmodel::static_nestedElements() component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVariant count = obj->property("count"); QCOMPARE(count.type(), QVariant::Int); @@ -613,7 +613,7 @@ void tst_qqmllistmodel::enumerate() QQmlComponent component(&eng, testFileUrl("enumerate.qml")); QVERIFY(!component.isError()); QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QLatin1String expectedStrings[] = { QLatin1String("val1=1Y"), @@ -958,9 +958,9 @@ void tst_qqmllistmodel::crash_model_with_multiple_roles() QQmlComponent component(&eng, testFileUrl("multipleroles.qml")); QObject *rootItem = component.create(); QVERIFY(component.errorString().isEmpty()); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QQmlListModel *model = rootItem->findChild<QQmlListModel*>("listModel"); - QVERIFY(model != 0); + QVERIFY(model != nullptr); // used to cause a crash model->setProperty(0, "black", true); @@ -974,9 +974,9 @@ void tst_qqmllistmodel::crash_model_with_unknown_roles() QQmlComponent component(&eng, testFileUrl("multipleroles.qml")); QScopedPointer<QObject> rootItem(component.create()); QVERIFY(component.errorString().isEmpty()); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QQmlListModel *model = rootItem->findChild<QQmlListModel*>("listModel"); - QVERIFY(model != 0); + QVERIFY(model != nullptr); // used to cause a crash in debug builds model->index(0, 0, QModelIndex()).data(Qt::DisplayRole); @@ -990,7 +990,7 @@ void tst_qqmllistmodel::set_model_cache() QQmlComponent component(&eng, testFileUrl("setmodelcachelist.qml")); QObject *model = component.create(); QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString())); - QVERIFY(model != 0); + QVERIFY(model != nullptr); QVERIFY(model->property("ok").toBool()); delete model; @@ -1188,10 +1188,10 @@ void tst_qqmllistmodel::signal_handlers() QQmlComponent component(&eng, testFileUrl("signalhandlers.qml")); QObject *model = component.create(); QQmlListModel *lm = qobject_cast<QQmlListModel *>(model); - QVERIFY(lm != 0); + QVERIFY(lm != nullptr); lm->setDynamicRoles(dynamicRoles); QVERIFY2(component.errorString().isEmpty(), QTest::toString(component.errorString())); - QVERIFY(model != 0); + QVERIFY(model != nullptr); QVERIFY(model->property("ok").toBool()); delete model; @@ -1275,7 +1275,7 @@ void tst_qqmllistmodel::empty_element_warning() QVERIFY(!component.isError()); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); delete obj; } diff --git a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp index 6301c35676..6b8002cce5 100644 --- a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp +++ b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp @@ -48,7 +48,7 @@ Q_DECLARE_METATYPE(QList<QVariantHash>) inline QVariant runexpr(QQmlEngine *engine, const QString &str) { - QQmlExpression expr(engine->rootContext(), 0, str); + QQmlExpression expr(engine->rootContext(), nullptr, str); return expr.evaluate(); } @@ -111,7 +111,7 @@ bool tst_qqmllistmodelworkerscript::compareVariantList(const QVariantList &testL bool allOk = true; QQmlListModel *model = qobject_cast<QQmlListModel *>(object.value<QObject *>()); - if (model == 0) + if (model == nullptr) return false; if (model->count() != testList.count()) @@ -349,7 +349,7 @@ void tst_qqmllistmodelworkerscript::dynamic_worker() QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("model.qml")); QQuickItem *item = createWorkerTest(&eng, &component, &model); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QSignalSpy spyCount(&model, SIGNAL(countChanged())); @@ -400,7 +400,7 @@ void tst_qqmllistmodelworkerscript::dynamic_worker_sync() QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("model.qml")); QQuickItem *item = createWorkerTest(&eng, &component, &model); - QVERIFY(item != 0); + QVERIFY(item != nullptr); if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}')) script = script.mid(1, script.length() - 2); @@ -463,7 +463,7 @@ void tst_qqmllistmodelworkerscript::get_worker() QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("model.qml")); QQuickItem *item = createWorkerTest(&eng, &component, &model); - QVERIFY(item != 0); + QVERIFY(item != nullptr); // Add some values like get() test RUNEVAL(item, "model.append({roleA: 100})"); @@ -593,7 +593,7 @@ void tst_qqmllistmodelworkerscript::property_changes_worker() QQmlComponent component(&engine, testFileUrl("model.qml")); QVERIFY2(component.errorString().isEmpty(), component.errorString().toUtf8()); QQuickItem *item = createWorkerTest(&engine, &component, &model); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QQmlExpression expr(engine.rootContext(), &model, script_setup); expr.evaluate(); @@ -640,7 +640,7 @@ void tst_qqmllistmodelworkerscript::worker_sync() QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workersync.qml")); QQuickItem *item = createWorkerTest(&eng, &component, &model); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(model.count(), 0); @@ -705,7 +705,7 @@ void tst_qqmllistmodelworkerscript::worker_remove_element() QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workerremoveelement.qml")); QQuickItem *item = createWorkerTest(&eng, &component, &model); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QSignalSpy spyModelRemoved(&model, SIGNAL(rowsRemoved(QModelIndex,int,int))); @@ -738,7 +738,7 @@ void tst_qqmllistmodelworkerscript::worker_remove_element() QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workerremoveelement.qml")); QQuickItem *item = createWorkerTest(&eng, &component, model); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QVERIFY(QMetaObject::invokeMethod(item, "addItem")); @@ -768,7 +768,7 @@ void tst_qqmllistmodelworkerscript::worker_remove_list() QQmlEngine eng; QQmlComponent component(&eng, testFileUrl("workerremovelist.qml")); QQuickItem *item = createWorkerTest(&eng, &component, &model); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QSignalSpy spyModelRemoved(&model, SIGNAL(rowsRemoved(QModelIndex,int,int))); @@ -815,7 +815,7 @@ void tst_qqmllistmodelworkerscript::dynamic_role() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("model.qml")); QQuickItem *item = createWorkerTest(&engine, &component, &model); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QQmlExpression preExp(engine.rootContext(), &model, preamble); QCOMPARE(preExp.evaluate().toInt(), 0); diff --git a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp index 5c16a48378..199f7bc7e4 100644 --- a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp +++ b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp @@ -115,7 +115,7 @@ void tst_qqmllistreference::qmllistreference_invalid() QVERIFY(!r.canAt()); QVERIFY(!r.canClear()); QVERIFY(!r.canCount()); - QVERIFY(!r.append(0)); + QVERIFY(!r.append(nullptr)); QVERIFY(!r.at(10)); QVERIFY(!r.clear()); QCOMPARE(r.count(), 0); @@ -132,7 +132,7 @@ void tst_qqmllistreference::qmllistreference_invalid() QVERIFY(!r.canAt()); QVERIFY(!r.canClear()); QVERIFY(!r.canCount()); - QVERIFY(!r.append(0)); + QVERIFY(!r.append(nullptr)); QVERIFY(!r.at(10)); QVERIFY(!r.clear()); QCOMPARE(r.count(), 0); @@ -149,7 +149,7 @@ void tst_qqmllistreference::qmllistreference_invalid() QVERIFY(!r.canAt()); QVERIFY(!r.canClear()); QVERIFY(!r.canCount()); - QVERIFY(!r.append(0)); + QVERIFY(!r.append(nullptr)); QVERIFY(!r.at(10)); QVERIFY(!r.clear()); QCOMPARE(r.count(), 0); @@ -247,7 +247,7 @@ void tst_qqmllistreference::canAppend() { TestType tt; - tt.property.append = 0; + tt.property.append = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.canAppend()); } @@ -276,7 +276,7 @@ void tst_qqmllistreference::canAt() { TestType tt; - tt.property.at = 0; + tt.property.at = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.canAt()); } @@ -305,7 +305,7 @@ void tst_qqmllistreference::canClear() { TestType tt; - tt.property.clear = 0; + tt.property.clear = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.canClear()); } @@ -334,7 +334,7 @@ void tst_qqmllistreference::canCount() { TestType tt; - tt.property.count = 0; + tt.property.count = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.canCount()); } @@ -363,7 +363,7 @@ void tst_qqmllistreference::isReadable() { TestType tt; - tt.property.count = 0; + tt.property.count = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.isReadable()); } @@ -392,7 +392,7 @@ void tst_qqmllistreference::isManipulable() { TestType tt; - tt.property.count = 0; + tt.property.count = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.isManipulable()); } @@ -421,17 +421,17 @@ void tst_qqmllistreference::append() QVERIFY(!ref.append(&object)); QCOMPARE(tt->data.count(), 1); QCOMPARE(tt->data.at(0), tt); - QVERIFY(ref.append(0)); + QVERIFY(ref.append(nullptr)); QCOMPARE(tt->data.count(), 2); QCOMPARE(tt->data.at(0), tt); QVERIFY(!tt->data.at(1)); delete tt; - QVERIFY(!ref.append(0)); + QVERIFY(!ref.append(nullptr)); } { TestType tt; - tt.property.append = 0; + tt.property.append = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.append(&tt)); } @@ -466,7 +466,7 @@ void tst_qqmllistreference::at() { TestType tt; tt.data.append(&tt); - tt.property.at = 0; + tt.property.at = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.at(0)); } @@ -499,7 +499,7 @@ void tst_qqmllistreference::clear() { TestType tt; - tt.property.clear = 0; + tt.property.clear = nullptr; QQmlListReference ref(&tt, "data"); QVERIFY(!ref.clear()); } @@ -534,7 +534,7 @@ void tst_qqmllistreference::count() { TestType tt; tt.data.append(&tt); - tt.property.count = 0; + tt.property.count = nullptr; QQmlListReference ref(&tt, "data"); QCOMPARE(ref.count(), 0); } @@ -626,17 +626,17 @@ void tst_qqmllistreference::listProperty() QQmlComponent component(&engine, testFileUrl("propertyList.qml")); QScopedPointer<QObject> object( component.create() ); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE( object->property("state").toString(), QStringLiteral("MyState2") ); QQmlListReference list( object.data(), "states"); QCOMPARE( list.count(), 2 ); QQuickState* state1 = dynamic_cast<QQuickState*>( list.at( 0 ) ); - QVERIFY(state1 != 0); + QVERIFY(state1 != nullptr); QCOMPARE( state1->name(), QStringLiteral("MyState1") ); QQuickState* state2 = dynamic_cast<QQuickState*>( list.at( 1 ) ); - QVERIFY(state2 != 0); + QVERIFY(state2 != nullptr); QCOMPARE( state2->name(), QStringLiteral("MyState2") ); } diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp index 4f4deaafe5..c2c2413c98 100644 --- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp +++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp @@ -152,7 +152,7 @@ void tst_qqmllocale::addPropertyData(const QString &l) LOCALE_PROP(QString,exponential), LOCALE_PROP(int,measurementSystem), LOCALE_PROP(int,textDirection), - { 0, QVariant() } + { nullptr, QVariant() } }; int i = 0; @@ -663,7 +663,7 @@ void tst_qqmllocale::addDateTimeFormatData(const QString &l) "h:m:sap ddd MMMM d yy", "'The date and time is: 'H:mm:ss:zzz dd/MM/yy", "MMM d yyyy HH:mm t", - 0 + nullptr }; QByteArray locale = l.toLatin1(); int i = 0; @@ -751,7 +751,7 @@ void tst_qqmllocale::addDateFormatData(const QString &l) "ddd MMMM d yy", "'The date is: 'dd/MM/yy", "MMM d yyyy", - 0 + nullptr }; QByteArray locale = l.toLatin1(); int i = 0; @@ -839,7 +839,7 @@ void tst_qqmllocale::addTimeFormatData(const QString &l) "h:m:sap", "'The time is: 'H:mm:ss:zzz", "HH:mm t", - 0 + nullptr }; QByteArray locale = l.toLatin1(); int i = 0; diff --git a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp index 9467af6754..ea157a7d15 100644 --- a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp +++ b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp @@ -186,10 +186,10 @@ void tst_QQmlMetaObject::property() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl(testFile)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); const QMetaObject *mo = object->metaObject(); - QVERIFY(mo->superClass() != 0); + QVERIFY(mo->superClass() != nullptr); QVERIFY(QByteArray(mo->className()).contains("_QML_")); QCOMPARE(mo->propertyOffset(), mo->superClass()->propertyCount()); QCOMPARE(mo->propertyCount(), mo->superClass()->propertyCount() + 1); @@ -361,10 +361,10 @@ void tst_QQmlMetaObject::method() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl(testFile)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); const QMetaObject *mo = object->metaObject(); - QVERIFY(mo->superClass() != 0); + QVERIFY(mo->superClass() != nullptr); QVERIFY(QByteArray(mo->className()).contains("_QML_")); QCOMPARE(mo->methodOffset(), mo->superClass()->methodCount()); QCOMPARE(mo->methodCount(), mo->superClass()->methodCount() + 1); diff --git a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp index 58361b4b12..ff3361ff82 100644 --- a/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp +++ b/tests/auto/qml/qqmlmetatype/tst_qqmlmetatype.cpp @@ -271,7 +271,7 @@ void tst_qqmlmetatype::defaultObject() TestType t; ParserStatusTestType p; - QVERIFY(QQmlMetaType::defaultProperty((QObject *)0).name() == 0); + QVERIFY(QQmlMetaType::defaultProperty((QObject *)nullptr).name() == nullptr); QVERIFY(!QQmlMetaType::defaultProperty(&o).name()); QVERIFY(!QQmlMetaType::defaultProperty(&p).name()); QCOMPARE(QString(QQmlMetaType::defaultProperty(&t).name()), QString("foo")); diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp index fa9782f8c2..b44bc58373 100644 --- a/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/invalidFirstCommandModule/plugin.cpp @@ -34,7 +34,7 @@ class MyPluginType : public QObject { Q_OBJECT public: - MyPluginType(QObject *parent=0) : QObject(parent) {} + MyPluginType(QObject *parent=nullptr) : QObject(parent) {} }; diff --git a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp index fe01507412..ccd1066a36 100644 --- a/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/invalidNamespaceModule/plugin.cpp @@ -34,7 +34,7 @@ class MyPluginType : public QObject { Q_OBJECT public: - MyPluginType(QObject *parent=0) : QObject(parent) {} + MyPluginType(QObject *parent=nullptr) : QObject(parent) {} }; diff --git a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp index 92d30351a7..610710fbf8 100644 --- a/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/nestedPlugin/nestedPlugin.cpp @@ -36,7 +36,7 @@ class MyPluginType : public QObject Q_PROPERTY(QString value READ value) public: - MyPluginType(QObject *parent=0) : QObject(parent) {} + MyPluginType(QObject *parent=nullptr) : QObject(parent) {} QString value() const { return "Hello"; } }; @@ -47,7 +47,7 @@ class MyNestedPluginType : public QObject Q_PROPERTY(QString value READ value) public: - MyNestedPluginType(QObject *parent=0) : QObject(parent) {} + MyNestedPluginType(QObject *parent=nullptr) : QObject(parent) {} QString value() const { return "Goodbye"; } }; diff --git a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp index 5fc05b91bd..4c2109e02a 100644 --- a/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/nonstrictModule/plugin.cpp @@ -34,7 +34,7 @@ class MyPluginType : public QObject { Q_OBJECT public: - MyPluginType(QObject *parent=0) : QObject(parent) {} + MyPluginType(QObject *parent=nullptr) : QObject(parent) {} }; diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp index 515d56a3c4..cb8c395fdf 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/childplugin/childplugin.cpp @@ -37,7 +37,7 @@ class MyChildPluginType : public QObject Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue) public: - MyChildPluginType(QObject *parent=0) : QObject(parent) + MyChildPluginType(QObject *parent=nullptr) : QObject(parent) { qWarning("child import2.1 worked"); } diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp index 6cae5254bc..ced7e0895d 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.1/plugin.cpp @@ -37,7 +37,7 @@ class MyPluginType : public QObject Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue) public: - MyPluginType(QObject *parent=0) : QObject(parent) + MyPluginType(QObject *parent=nullptr) : QObject(parent) { qWarning("import2.1 worked"); } diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/plugin.cpp index ecec870374..67cfc2a579 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2.2/plugin.cpp @@ -37,7 +37,7 @@ class MyPluginType : public QObject Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue) public: - MyPluginType(QObject *parent=0) : QObject(parent) + MyPluginType(QObject *parent=nullptr) : QObject(parent) { qWarning("import2.2 worked"); } diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp index 56545cfa3c..7b8f2a96be 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/childplugin/childplugin.cpp @@ -37,7 +37,7 @@ class MyChildPluginType : public QObject Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue) public: - MyChildPluginType(QObject *parent=0) : QObject(parent) + MyChildPluginType(QObject *parent=nullptr) : QObject(parent) { qWarning("child import2 worked"); } diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp index 49a2a747a4..8a4598e3bf 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin.2/plugin.cpp @@ -37,7 +37,7 @@ class MyPluginType : public QObject Q_PROPERTY(int valueOnlyIn2 READ value WRITE setValue) public: - MyPluginType(QObject *parent=0) : QObject(parent) + MyPluginType(QObject *parent=nullptr) : QObject(parent) { qWarning("import2 worked"); } diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp index 28490d3d98..6a2deca1df 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin/childplugin/childplugin.cpp @@ -36,7 +36,7 @@ class MyChildPluginType : public QObject Q_PROPERTY(int value READ value WRITE setValue) public: - MyChildPluginType(QObject *parent=0) : QObject(parent) + MyChildPluginType(QObject *parent=nullptr) : QObject(parent) { qWarning("child import worked"); } diff --git a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp index db51185de6..5e39966a2a 100644 --- a/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/plugin/plugin.cpp @@ -36,7 +36,7 @@ class MyPluginType : public QObject Q_PROPERTY(int value READ value WRITE setValue) public: - MyPluginType(QObject *parent=0) : QObject(parent) + MyPluginType(QObject *parent=nullptr) : QObject(parent) { qWarning("import worked"); } diff --git a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp index 7669d65568..5c3c1b81c6 100644 --- a/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/pluginWrongCase/plugin.cpp @@ -36,7 +36,7 @@ class MyPluginType : public QObject Q_PROPERTY(int value READ value WRITE setValue) public: - MyPluginType(QObject *parent=0) : QObject(parent) + MyPluginType(QObject *parent=nullptr) : QObject(parent) { qWarning("import worked"); } diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp index 92211ebf9d..0780ea8325 100644 --- a/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/preemptedStrictModule/plugin.cpp @@ -34,7 +34,7 @@ class MyPluginType : public QObject { Q_OBJECT public: - MyPluginType(QObject *parent=0) : QObject(parent) {} + MyPluginType(QObject *parent=nullptr) : QObject(parent) {} }; diff --git a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp index 3df3e9cc81..bc896716e2 100644 --- a/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/preemptiveModule/plugin.cpp @@ -34,7 +34,7 @@ class MyPluginType : public QObject { Q_OBJECT public: - MyPluginType(QObject *parent=0) : QObject(parent) {} + MyPluginType(QObject *parent=nullptr) : QObject(parent) {} }; diff --git a/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp index afdeea80f4..ae8c231aab 100644 --- a/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/protectedModule/plugin.cpp @@ -33,7 +33,7 @@ class MyPluginType : public QObject { Q_OBJECT public: - MyPluginType(QObject *parent=0) : QObject(parent) {} + MyPluginType(QObject *parent=nullptr) : QObject(parent) {} }; diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp index 4f5176ae62..312ed325b1 100644 --- a/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/strictModule.2/plugin.cpp @@ -34,7 +34,7 @@ class MyPluginType : public QObject { Q_OBJECT public: - MyPluginType(QObject *parent=0) : QObject(parent) {} + MyPluginType(QObject *parent=nullptr) : QObject(parent) {} }; diff --git a/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp index eaa9aeb1d0..a622078159 100644 --- a/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/strictModule/plugin.cpp @@ -34,7 +34,7 @@ class MyPluginType : public QObject { Q_OBJECT public: - MyPluginType(QObject *parent=0) : QObject(parent) {} + MyPluginType(QObject *parent=nullptr) : QObject(parent) {} }; diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index 85e4918b61..fac3ff15fd 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -217,7 +217,7 @@ void tst_qqmlmoduleplugin::importsPlugin() qWarning() << err; VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(),123); delete object; } @@ -285,7 +285,7 @@ void tst_qqmlmoduleplugin::importPluginWithQmlFile() qWarning() << err; VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; } @@ -301,7 +301,7 @@ void tst_qqmlmoduleplugin::remoteImportWithQuotedUrl() QTRY_COMPARE(component.status(), QQmlComponent::Ready); QObject *object = component.create(); QCOMPARE(object->property("width").toInt(), 300); - QVERIFY(object != 0); + QVERIFY(object != nullptr); delete object; foreach (QQmlError err, component.errors()) @@ -323,7 +323,7 @@ void tst_qqmlmoduleplugin::remoteImportWithUnquotedUri() QTRY_COMPARE(component.status(), QQmlComponent::Ready); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("width").toInt(), 300); delete object; @@ -345,7 +345,7 @@ void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin() QQmlComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.qml"))); QObject *o = component.create(); - QVERIFY2(o != 0, QQmlDataTest::msgComponentError(component, &engine)); + QVERIFY2(o != nullptr, QQmlDataTest::msgComponentError(component, &engine)); QCOMPARE(o->property("test").toBool(), true); delete o; } @@ -354,7 +354,7 @@ void tst_qqmlmoduleplugin::importsMixedQmlCppPlugin() QQmlComponent component(&engine, testFileUrl(QStringLiteral("importsMixedQmlCppPlugin.2.qml"))); QObject *o = component.create(); - QVERIFY2(o != 0, QQmlDataTest::msgComponentError(component, &engine)); + QVERIFY2(o != nullptr, QQmlDataTest::msgComponentError(component, &engine)); QCOMPARE(o->property("test").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); delete o; @@ -482,7 +482,7 @@ void tst_qqmlmoduleplugin::importLocalModule() component.setData(qml.toUtf8(), testFileUrl("empty.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("majorVersion").value<int>(), majorVersion); QCOMPARE(object->property("minorVersion").value<int>(), minorVersion); } @@ -539,7 +539,7 @@ void tst_qqmlmoduleplugin::importStrictModule() if (error.isEmpty()) { QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } else { QVERIFY(!component.isReady()); QCOMPARE(component.errors().count(), 1); @@ -623,7 +623,7 @@ void tst_qqmlmoduleplugin::importProtectedModule() //If plugin is loaded due to import, should assert QScopedPointer<QObject> object(component.create()); //qDebug() << component.errorString(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_qqmlmoduleplugin::importVersionedModule() @@ -664,7 +664,7 @@ void tst_qqmlmoduleplugin::importsChildPlugin() qWarning() << err; VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(),123); delete object; } @@ -681,7 +681,7 @@ void tst_qqmlmoduleplugin::importsChildPlugin2() qWarning() << err; VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(),123); delete object; } @@ -698,7 +698,7 @@ void tst_qqmlmoduleplugin::importsChildPlugin21() qWarning() << err; VERIFY_ERRORS(0); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(),123); delete object; } diff --git a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp index 88a5d41975..381ae98195 100644 --- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp +++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp @@ -142,7 +142,7 @@ class tst_qqmlnotifier : public QQmlDataTest Q_OBJECT public: tst_qqmlnotifier() - : root(0), exportedClass(0), exportedObject(0) + : root(nullptr), exportedClass(nullptr), exportedObject(nullptr) {} private slots: @@ -180,28 +180,28 @@ void tst_qqmlnotifier::initTestCase() void tst_qqmlnotifier::createObjects() { delete root; - root = 0; - exportedClass = exportedObject = 0; + root = nullptr; + exportedClass = exportedObject = nullptr; QQmlComponent component(&engine, testFileUrl("connectnotify.qml")); exportedObject = new ExportedClass(); exportedObject->setObjectName("exportedObject"); engine.rootContext()->setContextProperty("_exportedObject", exportedObject); root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); exportedClass = qobject_cast<ExportedClass *>( root->findChild<ExportedClass*>("exportedClass")); - QVERIFY(exportedClass != 0); + QVERIFY(exportedClass != nullptr); exportedClass->verifyReceiverCount(); } void tst_qqmlnotifier::cleanupTestCase() { delete root; - root = 0; + root = nullptr; delete exportedObject; - exportedObject = 0; + exportedObject = nullptr; } void tst_qqmlnotifier::testConnectNotify() @@ -303,7 +303,7 @@ void tst_qqmlnotifier::disconnectOnDestroy() // Deleting a QML object should remove all connections. For exportedClass, this is tested in // the destructor, and for exportedObject, it is tested below. delete root; - root = 0; + root = nullptr; QCOMPARE(exportedObject->cppObjectPropConnections, 0); exportedObject->verifyReceiverCount(); } diff --git a/tests/auto/qml/qqmlopenmetaobject/tst_qqmlopenmetaobject.cpp b/tests/auto/qml/qqmlopenmetaobject/tst_qqmlopenmetaobject.cpp index c3ace5e0f3..7fd4d69b5e 100644 --- a/tests/auto/qml/qqmlopenmetaobject/tst_qqmlopenmetaobject.cpp +++ b/tests/auto/qml/qqmlopenmetaobject/tst_qqmlopenmetaobject.cpp @@ -44,7 +44,7 @@ class CustomObject: public QObject { Q_OBJECT public: - CustomObject(QObject *parent = 0) + CustomObject(QObject *parent = nullptr) : QObject(parent) {} }; diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 84a1bd9cc5..128dc21b9a 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -44,7 +44,7 @@ class MyQmlObject : public QObject Q_OBJECT Q_PROPERTY(QPoint pointProperty MEMBER m_point) public: - MyQmlObject(QObject *parent = 0) : QObject(parent) {} + MyQmlObject(QObject *parent = nullptr) : QObject(parent) {} private: QPoint m_point; @@ -56,7 +56,7 @@ class MyQObject : public QObject { Q_OBJECT public: - MyQObject(QObject *parent = 0) : QObject(parent), m_i(0) {} + MyQObject(QObject *parent = nullptr) : QObject(parent), m_i(0) {} int inc() { return ++m_i; } @@ -158,21 +158,21 @@ void tst_qqmlproperty::qmlmetaproperty() QObject *obj = new QObject; - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(nullptr, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(nullptr, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(obj, QObjectPrivate::get(obj)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(obj, QObjectPrivate::get(obj)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QCOMPARE(prop.name(), QString()); QCOMPARE(prop.read(), QVariant()); QCOMPARE(prop.write(QVariant()), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), false); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(!prop.method().isValid()); @@ -183,10 +183,10 @@ void tst_qqmlproperty::qmlmetaproperty() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isSignalProperty(), false); QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.object(), (QObject *)nullptr); QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); + QCOMPARE(prop.propertyTypeName(), (const char *)nullptr); QVERIFY(!prop.property().name()); QVERIFY(!QQmlPropertyPrivate::binding(prop)); QQmlPropertyPrivate::setBinding(prop, binding.data()); @@ -333,7 +333,7 @@ class PropertyObject : public QObject Q_CLASSINFO("DefaultProperty", "defaultProperty") public: - PropertyObject() : m_resetProperty(9), m_qObject(0), m_stringProperty("foo") {} + PropertyObject() : m_resetProperty(9), m_qObject(nullptr), m_stringProperty("foo") {} int defaultProperty() { return 10; } QRect rectProperty() { return QRect(10, 10, 1, 209); } @@ -400,11 +400,11 @@ void tst_qqmlproperty::qmlmetaproperty_object() { QQmlProperty prop(&object); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -413,10 +413,10 @@ void tst_qqmlproperty::qmlmetaproperty_object() QCOMPARE(prop.write(QVariant()), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), false); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(!prop.method().isValid()); @@ -427,10 +427,10 @@ void tst_qqmlproperty::qmlmetaproperty_object() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isSignalProperty(), false); QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.object(), (QObject *)nullptr); QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); + QCOMPARE(prop.propertyTypeName(), (const char *)nullptr); QVERIFY(!prop.property().name()); QVERIFY(!QQmlPropertyPrivate::binding(prop)); QQmlPropertyPrivate::setBinding(prop, binding.data()); @@ -448,12 +448,12 @@ void tst_qqmlproperty::qmlmetaproperty_object() { QQmlProperty prop(&dobject); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); static_cast<QQmlBinding *>(binding.data())->setTarget(prop); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -462,10 +462,10 @@ void tst_qqmlproperty::qmlmetaproperty_object() QCOMPARE(prop.write(QVariant()), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), true); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(!prop.method().isValid()); @@ -505,11 +505,11 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() { QQmlProperty prop(&object, QString("defaultProperty")); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -518,10 +518,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() QCOMPARE(prop.write(QVariant()), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), false); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(!prop.method().isValid()); @@ -532,10 +532,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isSignalProperty(), false); QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.object(), (QObject *)nullptr); QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); + QCOMPARE(prop.propertyTypeName(), (const char *)nullptr); QVERIFY(!prop.property().name()); QVERIFY(!QQmlPropertyPrivate::binding(prop)); QQmlPropertyPrivate::setBinding(prop, binding.data()); @@ -553,12 +553,12 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() { QQmlProperty prop(&dobject, QString("defaultProperty")); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); static_cast<QQmlBinding *>(binding.data())->setTarget(prop); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -567,10 +567,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() QCOMPARE(prop.write(QVariant()), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), true); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(!prop.method().isValid()); @@ -604,12 +604,12 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() { QQmlProperty prop(&dobject, QString("onClicked")); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); static_cast<QQmlBinding *>(binding.data())->setTarget(prop); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -618,10 +618,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() QCOMPARE(prop.write(QVariant("Hello")), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), false); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QCOMPARE(QString(prop.method().methodSignature()), QString("clicked()")); @@ -635,8 +635,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject)); QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QCOMPARE(prop.property().name(), (const char *)0); + QCOMPARE(prop.propertyTypeName(), (const char *)nullptr); + QCOMPARE(prop.property().name(), (const char *)nullptr); QVERIFY(!QQmlPropertyPrivate::binding(prop)); QQmlPropertyPrivate::setBinding(prop, binding.data()); QVERIFY(binding->ref == 1); @@ -654,12 +654,12 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() { QQmlProperty prop(&dobject, QString("onPropertyWithNotifyChanged")); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); static_cast<QQmlBinding *>(binding.data())->setTarget(prop); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -668,10 +668,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() QCOMPARE(prop.write(QVariant("Hello")), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), false); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QCOMPARE(QString(prop.method().methodSignature()), QString("oddlyNamedNotifySignal()")); @@ -685,8 +685,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string() QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject)); QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QCOMPARE(prop.property().name(), (const char *)0); + QCOMPARE(prop.propertyTypeName(), (const char *)nullptr); + QCOMPARE(prop.property().name(), (const char *)nullptr); QVERIFY(!QQmlPropertyPrivate::binding(prop)); QQmlPropertyPrivate::setBinding(prop, binding.data()); QVERIFY(binding->ref == 1); @@ -710,11 +710,11 @@ void tst_qqmlproperty::qmlmetaproperty_object_context() { QQmlProperty prop(&object, engine.rootContext()); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -723,10 +723,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_context() QCOMPARE(prop.write(QVariant()), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), false); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(!prop.method().isValid()); @@ -737,10 +737,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isSignalProperty(), false); QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.object(), (QObject *)nullptr); QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); + QCOMPARE(prop.propertyTypeName(), (const char *)nullptr); QVERIFY(!prop.property().name()); QVERIFY(!QQmlPropertyPrivate::binding(prop)); QQmlPropertyPrivate::setBinding(prop, binding.data()); @@ -758,12 +758,12 @@ void tst_qqmlproperty::qmlmetaproperty_object_context() { QQmlProperty prop(&dobject, engine.rootContext()); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); static_cast<QQmlBinding *>(binding.data())->setTarget(prop); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -772,10 +772,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_context() QCOMPARE(prop.write(QVariant()), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), true); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(!prop.method().isValid()); @@ -815,11 +815,11 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() { QQmlProperty prop(&object, QString("defaultProperty"), engine.rootContext()); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&object, QObjectPrivate::get(&object)->signalIndex("destroyed()"), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -828,10 +828,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.write(QVariant()), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), false); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(!prop.method().isValid()); @@ -842,10 +842,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isSignalProperty(), false); QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.object(), (QObject *)nullptr); QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); + QCOMPARE(prop.propertyTypeName(), (const char *)nullptr); QVERIFY(!prop.property().name()); QVERIFY(!QQmlPropertyPrivate::binding(prop)); QQmlPropertyPrivate::setBinding(prop, binding.data()); @@ -863,12 +863,12 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() { QQmlProperty prop(&dobject, QString("defaultProperty"), engine.rootContext()); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); static_cast<QQmlBinding *>(binding.data())->setTarget(prop); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QObjectPrivate::get(&dobject)->signalIndex("clicked()"), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -877,10 +877,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.write(QVariant()), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), true); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QVERIFY(!prop.method().isValid()); @@ -914,12 +914,12 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() { QQmlProperty prop(&dobject, QString("onClicked"), engine.rootContext()); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); static_cast<QQmlBinding *>(binding.data())->setTarget(prop); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -928,10 +928,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.write(QVariant("Hello")), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), false); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QCOMPARE(QString(prop.method().methodSignature()), QString("clicked()")); @@ -945,8 +945,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject)); QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QCOMPARE(prop.property().name(), (const char *)0); + QCOMPARE(prop.propertyTypeName(), (const char *)nullptr); + QCOMPARE(prop.property().name(), (const char *)nullptr); QVERIFY(!QQmlPropertyPrivate::binding(prop)); QQmlPropertyPrivate::setBinding(prop, binding.data()); QVERIFY(binding->ref == 1); @@ -964,12 +964,12 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() { QQmlProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext()); - QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), 0, QQmlContextData::get(engine.rootContext()))); + QQmlAbstractBinding::Ptr binding(QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, QLatin1String("null"), nullptr, QQmlContextData::get(engine.rootContext()))); static_cast<QQmlBinding *>(binding.data())->setTarget(prop); QVERIFY(binding); - QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1); + QQmlBoundSignalExpression *sigExpr = new QQmlBoundSignalExpression(&dobject, QQmlPropertyPrivate::get(prop)->signalIndex(), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1); QQmlJavaScriptExpression::DeleteWatcher sigExprWatcher(sigExpr); - QVERIFY(sigExpr != 0 && !sigExprWatcher.wasDeleted()); + QVERIFY(sigExpr != nullptr && !sigExprWatcher.wasDeleted()); QObject *obj = new QObject; @@ -978,10 +978,10 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.write(QVariant("Hello")), false); QCOMPARE(prop.hasNotifySignal(), false); QCOMPARE(prop.needsNotifySignal(), false); - QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(nullptr, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); QCOMPARE(prop.connectNotifySignal(obj, 0), false); - QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(nullptr, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); QCOMPARE(prop.connectNotifySignal(obj, -1), false); QCOMPARE(QString(prop.method().methodSignature()), QString("oddlyNamedNotifySignal()")); @@ -995,8 +995,8 @@ void tst_qqmlproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.object(), qobject_cast<QObject*>(&dobject)); QCOMPARE(prop.propertyTypeCategory(), QQmlProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QCOMPARE(prop.property().name(), (const char *)0); + QCOMPARE(prop.propertyTypeName(), (const char *)nullptr); + QCOMPARE(prop.property().name(), (const char *)nullptr); QVERIFY(!QQmlPropertyPrivate::binding(prop)); QQmlPropertyPrivate::setBinding(prop, binding.data()); QVERIFY(binding->ref == 1); @@ -1062,7 +1062,7 @@ void tst_qqmlproperty::name() } { - QQmlProperty p(0, "foo"); + QQmlProperty p(nullptr, "foo"); QCOMPARE(p.name(), QString()); } @@ -1150,8 +1150,8 @@ void tst_qqmlproperty::read() QQmlProperty p(&o, "onClicked"); QCOMPARE(p.read(), QVariant()); - QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1)); - QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p)); + QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1)); + QVERIFY(nullptr != QQmlPropertyPrivate::signalExpression(p)); QCOMPARE(p.read(), QVariant()); } @@ -1162,8 +1162,8 @@ void tst_qqmlproperty::read() QQmlProperty p(&o, "onPropertyWithNotifyChanged"); QCOMPARE(p.read(), QVariant()); - QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1)); - QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p)); + QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1)); + QVERIFY(nullptr != QQmlPropertyPrivate::signalExpression(p)); QCOMPARE(p.read(), QVariant()); } @@ -1213,7 +1213,7 @@ void tst_qqmlproperty::read() { QQmlComponent component(&engine, testFileUrl("readSynthesizedObject.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlProperty p(object, "test", &engine); @@ -1228,7 +1228,7 @@ void tst_qqmlproperty::read() { // static QQmlComponent component(&engine, testFileUrl("readSynthesizedObject.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant v = QQmlProperty::read(object, "test", &engine); QCOMPARE(v.userType(), int(QMetaType::QObjectStar)); @@ -1241,7 +1241,7 @@ void tst_qqmlproperty::read() QQmlComponent component(&engine); component.setData("import Test 1.0\nMyContainer { }", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlProperty p(object, "MyContainer.foo", qmlContext(object)); QCOMPARE(p.read(), QVariant(13)); @@ -1251,7 +1251,7 @@ void tst_qqmlproperty::read() QQmlComponent component(&engine); component.setData("import Test 1.0\nMyContainer { MyContainer.foo: 10 }", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlProperty p(object, "MyContainer.foo", qmlContext(object)); QCOMPARE(p.read(), QVariant(10)); @@ -1261,7 +1261,7 @@ void tst_qqmlproperty::read() QQmlComponent component(&engine); component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlProperty p(object, "Foo.MyContainer.foo", qmlContext(object)); QCOMPARE(p.read(), QVariant(10)); @@ -1271,7 +1271,7 @@ void tst_qqmlproperty::read() QQmlComponent component(&engine); component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(QQmlProperty::read(object, "Foo.MyContainer.foo", qmlContext(object)), QVariant(10)); delete object; @@ -1341,12 +1341,12 @@ void tst_qqmlproperty::write() QQmlProperty p(&o, "onClicked"); QCOMPARE(p.write(QVariant("console.log(1921)")), false); - QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1)); - QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p)); + QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1)); + QVERIFY(nullptr != QQmlPropertyPrivate::signalExpression(p)); QCOMPARE(p.write(QVariant("console.log(1921)")), false); - QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p)); + QVERIFY(nullptr != QQmlPropertyPrivate::signalExpression(p)); } // Automatic signal property @@ -1355,12 +1355,12 @@ void tst_qqmlproperty::write() QQmlProperty p(&o, "onPropertyWithNotifyChanged"); QCOMPARE(p.write(QVariant("console.log(1921)")), false); - QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), 0, QLatin1String("null"), QString(), -1, -1)); - QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p)); + QQmlPropertyPrivate::takeSignalExpression(p, new QQmlBoundSignalExpression(&o, QQmlPropertyPrivate::get(p)->signalIndex(), QQmlContextData::get(engine.rootContext()), nullptr, QLatin1String("null"), QString(), -1, -1)); + QVERIFY(nullptr != QQmlPropertyPrivate::signalExpression(p)); QCOMPARE(p.write(QVariant("console.log(1921)")), false); - QVERIFY(0 != QQmlPropertyPrivate::signalExpression(p)); + QVERIFY(nullptr != QQmlPropertyPrivate::signalExpression(p)); } // Value-type property @@ -1436,7 +1436,7 @@ void tst_qqmlproperty::write() QQmlComponent component(&engine); component.setData("import Test 1.0\nPropertyObject { stringProperty: constQChar }", QUrl()); PropertyObject *obj = qobject_cast<PropertyObject*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); if (obj) { QQmlProperty stringProperty(obj, "stringProperty"); QCOMPARE(stringProperty.read(), QVariant(QString(obj->constQChar()))); @@ -1476,7 +1476,7 @@ void tst_qqmlproperty::write() QQmlComponent component(&engine); component.setData("import Test 1.0\nMyContainer { }", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlProperty p(object, "MyContainer.foo", qmlContext(object)); p.write(QVariant(99)); @@ -1487,7 +1487,7 @@ void tst_qqmlproperty::write() QQmlComponent component(&engine); component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlProperty p(object, "Foo.MyContainer.foo", qmlContext(object)); p.write(QVariant(99)); @@ -1498,7 +1498,7 @@ void tst_qqmlproperty::write() { PropertyObject o; QQmlProperty p(&o, QString("qObject")); - QCOMPARE(o.qObject(), (QObject*)0); + QCOMPARE(o.qObject(), (QObject*)nullptr); QObject *newObject = new MyQObject(this); QCOMPARE(p.write(QVariant::fromValue(newObject)), true); QCOMPARE(o.qObject(), newObject); @@ -1515,7 +1515,7 @@ void tst_qqmlproperty::write() QQmlEngine engine; PropertyObject o; QQmlProperty p(&o, QString("qObject"), &engine); - QCOMPARE(o.qObject(), (QObject*)0); + QCOMPARE(o.qObject(), (QObject*)nullptr); QObject *newObject = new MyQObject(this); QCOMPARE(p.write(QVariant::fromValue(newObject)), true); QCOMPARE(o.qObject(), newObject); @@ -1617,7 +1617,7 @@ void tst_qqmlproperty::writeObjectToList() QQmlComponent containerComponent(&engine); containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create()); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QQmlListReference list(container, "children"); QCOMPARE(list.count(), 1); @@ -1633,7 +1633,7 @@ void tst_qqmlproperty::writeListToList() QQmlComponent containerComponent(&engine); containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create()); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QQmlListReference list(container, "children"); QCOMPARE(list.count(), 1); @@ -1817,7 +1817,7 @@ void tst_qqmlproperty::crashOnValueProperty() component.setData("import Test 1.0\nPropertyObject { wrectProperty.x: 10 }", QUrl()); PropertyObject *obj = qobject_cast<PropertyObject*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QQmlProperty p(obj, "wrectProperty.x", qmlContext(obj)); QCOMPARE(p.name(), QString("wrectProperty.x")); @@ -1826,7 +1826,7 @@ void tst_qqmlproperty::crashOnValueProperty() //don't crash once the engine is deleted delete engine; - engine = 0; + engine = nullptr; QCOMPARE(p.propertyTypeName(), "int"); QCOMPARE(p.read(), QVariant(10)); @@ -1852,7 +1852,7 @@ void tst_qqmlproperty::aliasPropertyBindings() QQmlComponent component(&engine, testFileUrl(file)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // the object where realProperty lives QObject *realPropertyObject = object; @@ -1871,8 +1871,8 @@ void tst_qqmlproperty::aliasPropertyBindings() QQmlProperty aliasProperty(object, QLatin1String("aliasProperty")); // Check there is a binding on these two properties - QVERIFY(QQmlPropertyPrivate::binding(realProperty) != 0); - QVERIFY(QQmlPropertyPrivate::binding(aliasProperty) != 0); + QVERIFY(QQmlPropertyPrivate::binding(realProperty) != nullptr); + QVERIFY(QQmlPropertyPrivate::binding(aliasProperty) != nullptr); // Check that its the same binding on these two properties QCOMPARE(QQmlPropertyPrivate::binding(realProperty), @@ -1881,8 +1881,8 @@ void tst_qqmlproperty::aliasPropertyBindings() // Change the binding object->setProperty("state", QString("switch")); - QVERIFY(QQmlPropertyPrivate::binding(realProperty) != 0); - QVERIFY(QQmlPropertyPrivate::binding(aliasProperty) != 0); + QVERIFY(QQmlPropertyPrivate::binding(realProperty) != nullptr); + QVERIFY(QQmlPropertyPrivate::binding(aliasProperty) != nullptr); QCOMPARE(QQmlPropertyPrivate::binding(realProperty), QQmlPropertyPrivate::binding(aliasProperty)); @@ -1903,8 +1903,8 @@ void tst_qqmlproperty::aliasPropertyBindings() // Revert object->setProperty("state", QString("")); - QVERIFY(QQmlPropertyPrivate::binding(realProperty) != 0); - QVERIFY(QQmlPropertyPrivate::binding(aliasProperty) != 0); + QVERIFY(QQmlPropertyPrivate::binding(realProperty) != nullptr); + QVERIFY(QQmlPropertyPrivate::binding(aliasProperty) != nullptr); QCOMPARE(QQmlPropertyPrivate::binding(realProperty), QQmlPropertyPrivate::binding(aliasProperty)); @@ -1946,7 +1946,7 @@ void tst_qqmlproperty::copy() QCOMPARE(p2.propertyTypeCategory(), QQmlProperty::Normal); QCOMPARE(p2.propertyType(), (int)QVariant::Int); - delete property; property = 0; + delete property; property = nullptr; QCOMPARE(p1.name(), QString("defaultProperty")); QCOMPARE(p1.read(), QVariant(10)); @@ -1967,9 +1967,9 @@ void tst_qqmlproperty::noContext() QQmlComponent compB(&engine, testFileUrl("NoContextTypeB.qml")); QObject *a = compA.create(); - QVERIFY(a != 0); + QVERIFY(a != nullptr); QObject *b = compB.create(); - QVERIFY(b != 0); + QVERIFY(b != nullptr); QVERIFY(QQmlProperty::write(b, "myTypeA", QVariant::fromValue(a), &engine)); @@ -2037,7 +2037,7 @@ void tst_qqmlproperty::readOnlyDynamicProperties() { QQmlComponent comp(&engine, testFileUrl("readonlyPrimitiveVsVar.qml")); QObject *obj = comp.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(!obj->metaObject()->property(obj->metaObject()->indexOfProperty("r_var")).isWritable()); QVERIFY(!obj->metaObject()->property(obj->metaObject()->indexOfProperty("r_int")).isWritable()); @@ -2066,7 +2066,7 @@ void tst_qqmlproperty::floatToStringPrecision() { QQmlComponent comp(&engine, testFileUrl("floatToStringPrecision.qml")); QObject *obj = comp.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QFETCH(QString, propertyName); QFETCH(double, number); diff --git a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp index ac1b76b9d2..b9e56b39a2 100644 --- a/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp +++ b/tests/auto/qml/qqmlpropertycache/tst_qqmlpropertycache.cpp @@ -61,7 +61,7 @@ class BaseObject : public QObject Q_PROPERTY(int propertyA READ propertyA NOTIFY propertyAChanged) Q_PROPERTY(QString propertyB READ propertyB NOTIFY propertyBChanged) public: - BaseObject(QObject *parent = 0) : QObject(parent) {} + BaseObject(QObject *parent = nullptr) : QObject(parent) {} int propertyA() const { return 0; } QString propertyB() const { return QString(); } @@ -81,7 +81,7 @@ class DerivedObject : public BaseObject Q_PROPERTY(int propertyC READ propertyC NOTIFY propertyCChanged) Q_PROPERTY(QString propertyD READ propertyD NOTIFY propertyDChanged) public: - DerivedObject(QObject *parent = 0) : BaseObject(parent) {} + DerivedObject(QObject *parent = nullptr) : BaseObject(parent) {} int propertyC() const { return 0; } QString propertyD() const { return QString(); } @@ -97,7 +97,7 @@ Q_SIGNALS: QQmlPropertyData *cacheProperty(QQmlPropertyCache *cache, const char *name) { - return cache->property(QLatin1String(name), 0, 0); + return cache->property(QLatin1String(name), nullptr, nullptr); } void tst_qqmlpropertycache::properties() diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index b8ea98df2b..62a8cd117d 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -71,7 +71,7 @@ class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus Q_PROPERTY(int someFixedProperty READ someFixedProperty WRITE setSomeFixedProperty NOTIFY someFixedPropertyChanged) public: LazyPropertyMap() - : QQmlPropertyMap(this, /*parent*/0) + : QQmlPropertyMap(this, /*parent*/nullptr) , value(0) {} @@ -313,7 +313,7 @@ class MyEnhancedPropertyMap : public QQmlPropertyMap { Q_OBJECT public: - MyEnhancedPropertyMap() : QQmlPropertyMap(this, 0), m_testSlotCalled(false) {} + MyEnhancedPropertyMap() : QQmlPropertyMap(this, nullptr), m_testSlotCalled(false) {} bool testSlotCalled() const { return m_testSlotCalled; } signals: diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index 0bc1127069..b96eecafe8 100644 --- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp +++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp @@ -168,7 +168,7 @@ void tst_qqmlqt::enums() { QQmlComponent component(&engine, testFileUrl("enums.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toInt(), (int)Qt::Key_Escape); QCOMPARE(object->property("test2").toInt(), (int)Qt::DescendingOrder); @@ -188,7 +188,7 @@ void tst_qqmlqt::rgba() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0, 0, 0.8)); @@ -211,7 +211,7 @@ void tst_qqmlqt::hsla() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHslF(1, 0, 0, 0.8)); QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHslF(1, 0.5, 0.3, 1)); @@ -233,7 +233,7 @@ void tst_qqmlqt::hsva() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHsvF(1, 0, 0, 0.8)); QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHsvF(1, 0.5, 0.3, 1)); @@ -261,7 +261,7 @@ void tst_qqmlqt::colorEqual() QTest::ignoreMessage(QtWarningMsg, qPrintable(component.url().toString() + ":35: Error: Qt.colorEqual(): Invalid color name")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1a").toBool(), false); QCOMPARE(object->property("test1b").toBool(), false); @@ -338,7 +338,7 @@ void tst_qqmlqt::rect() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QRectF>(object->property("test1")), QRectF(10, 13, 100, 109)); QCOMPARE(qvariant_cast<QRectF>(object->property("test2")), QRectF(-10, 13, 100, 109.6)); @@ -359,7 +359,7 @@ void tst_qqmlqt::point() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QPointF>(object->property("test1")), QPointF(19, 34)); QCOMPARE(qvariant_cast<QPointF>(object->property("test2")), QPointF(-3, 109.2)); @@ -379,7 +379,7 @@ void tst_qqmlqt::size() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QSizeF>(object->property("test1")), QSizeF(19, 34)); QCOMPARE(qvariant_cast<QSizeF>(object->property("test2")), QSizeF(3, 109.2)); @@ -400,7 +400,7 @@ void tst_qqmlqt::vector2d() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QVector2D>(object->property("test1")), QVector2D(1, 0.9f)); QCOMPARE(qvariant_cast<QVector2D>(object->property("test2")), QVector2D(102, -982.1f)); @@ -420,7 +420,7 @@ void tst_qqmlqt::vector3d() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9f)); QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1f)); @@ -440,7 +440,7 @@ void tst_qqmlqt::vector4d() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QVector4D>(object->property("test1")), QVector4D(1, 0, 0.9f, 0.6f)); QCOMPARE(qvariant_cast<QVector4D>(object->property("test2")), QVector4D(102, -10, -982.1f, 10)); @@ -460,7 +460,7 @@ void tst_qqmlqt::quaternion() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QQuaternion>(object->property("test1")), QQuaternion(2, 17, 0.9f, 0.6f)); QCOMPARE(qvariant_cast<QQuaternion>(object->property("test2")), QQuaternion(102, -10, -982.1f, 10)); @@ -482,7 +482,7 @@ void tst_qqmlqt::matrix4x4() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test1")), QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); QCOMPARE(qvariant_cast<QMatrix4x4>(object->property("test2")), QMatrix4x4(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4)); @@ -503,7 +503,7 @@ void tst_qqmlqt::font() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QFont>(object->property("test1")), QFont("Arial", 22)); QCOMPARE(qvariant_cast<QFont>(object->property("test2")), QFont("Arial", 20, QFont::DemiBold, true)); @@ -523,7 +523,7 @@ void tst_qqmlqt::lighter() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).lighter()); QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); @@ -545,7 +545,7 @@ void tst_qqmlqt::darker() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).darker()); QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); @@ -568,7 +568,7 @@ void tst_qqmlqt::tint() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(0, 0, 1)); QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0, 0)); @@ -601,7 +601,7 @@ void tst_qqmlqt::openUrlExternally() QQmlComponent component(&engine, testFileUrl("openUrlExternally.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(handler.called,1); QCOMPARE(handler.last, QUrl("test:url")); @@ -623,7 +623,7 @@ void tst_qqmlqt::openUrlExternally_pragmaLibrary() QQmlComponent component(&engine, testFileUrl("openUrlExternally_lib.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(handler.called,1); QCOMPARE(handler.last, QUrl("test:url")); @@ -644,7 +644,7 @@ void tst_qqmlqt::md5() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test2").toString(), QLatin1String(QCryptographicHash::hash("Hello World", QCryptographicHash::Md5).toHex())); @@ -662,7 +662,7 @@ void tst_qqmlqt::createComponent() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml")); QCOMPARE(object->property("relativeUrl").toString(), testFileUrl("createComponentData.qml").toString()); @@ -676,7 +676,7 @@ void tst_qqmlqt::createComponent() { QQmlComponent component(&engine, testFileUrl("createComponent.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QTRY_VERIFY(object->property("success").toBool()); delete object; } @@ -687,7 +687,7 @@ void tst_qqmlqt::createComponent_pragmaLibrary() // Currently, just loading createComponent_lib.qml causes crash on some platforms QQmlComponent component(&engine, testFileUrl("createComponent_lib.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("status").toInt(), int(QQmlComponent::Ready)); QCOMPARE(object->property("readValue").toInt(), int(1913)); delete object; @@ -711,13 +711,13 @@ void tst_qqmlqt::createQmlObject() QTest::ignoreMessage(QtDebugMsg, qPrintable(warning6)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("emptyArg").toBool(), true); QCOMPARE(object->property("success").toBool(), true); QQuickItem *item = qobject_cast<QQuickItem *>(object); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->childItems().count(), 1); delete object; @@ -790,7 +790,7 @@ void tst_qqmlqt::dateTimeFormatting() QObject *object = component.create(); QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(inputProperties.count() > 0); QVariant result; @@ -863,7 +863,7 @@ void tst_qqmlqt::dateTimeFormattingVariants() QObject *object = component.create(); QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVariant result; QVERIFY(QMetaObject::invokeMethod(object, method.toUtf8().constData(), @@ -923,7 +923,7 @@ void tst_qqmlqt::isQtObject() { QQmlComponent component(&engine, testFileUrl("isQtObject.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), false); @@ -942,7 +942,7 @@ void tst_qqmlqt::btoa() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test2").toString(), QString("SGVsbG8gd29ybGQh")); @@ -957,7 +957,7 @@ void tst_qqmlqt::atob() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test2").toString(), QString("Hello world!")); @@ -972,7 +972,7 @@ void tst_qqmlqt::fontFamilies() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QFontDatabase database; QCOMPARE(object->property("test2"), QVariant::fromValue(database.families())); @@ -986,7 +986,7 @@ void tst_qqmlqt::quit() QSignalSpy spy(&engine, SIGNAL(quit())); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(spy.count(), 1); delete object; @@ -1011,7 +1011,7 @@ void tst_qqmlqt::resolvedUrl() QQmlComponent component(&engine, testFileUrl("resolvedUrl.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("result").toString(), component.url().toString()); QCOMPARE(object->property("isString").toBool(), true); @@ -1101,14 +1101,14 @@ void tst_qqmlqt::later() QQmlComponent component(&engine, testFileUrl("later.qml")); QObject *root = component.create(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); if (!function.isEmpty()) QMetaObject::invokeMethod(root, qPrintable(function)); for (int i = 0; i < propNames.size(); ++i) { if (propNames.at(i) == QLatin1String("processEvents")) { - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } else if (propNames.at(i) == QLatin1String("collectGarbage")) { engine.collectGarbage(); @@ -1131,7 +1131,7 @@ void tst_qqmlqt::qtObjectContents() QQmlComponent component(&engine, testFileUrl("qtObjectContents.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("values").canConvert<QJSValue>()); QVariantMap values = object->property("values").value<QJSValue>().toVariant().toMap(); @@ -1255,7 +1255,7 @@ void tst_qqmlqt::timeRoundtrip() eng.rootContext()->setContextProperty(QLatin1String("tp"), &tp); QQmlComponent component(&eng, testFileUrl("timeRoundtrip.qml")); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); // QML reads m_getTime and saves the result as m_putTime; this should come out the same, without // any perturbation (e.g. by DST effects) from converting from QTime to V4's Date and back diff --git a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp index e08389045c..12c3032eda 100644 --- a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp +++ b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp @@ -87,7 +87,7 @@ class CppObject : public QObject Q_PROPERTY(QFont fontProperty MEMBER m_fontProperty NOTIFY fontPropertyChanged) public: - CppObject(QObject *parent = 0) : QObject(parent), + CppObject(QObject *parent = nullptr) : QObject(parent), m_intProperty(123), m_boolProperty(true), m_realProperty(1.23), diff --git a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp index 3b982d1ab7..f1dcefdab6 100644 --- a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp +++ b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp @@ -164,7 +164,7 @@ void tst_qqmlsqldatabase::testQml() component.setData(qml.toUtf8(), testFileUrl("empty.qml")); // just a file for relative local imports QVERIFY(!component.isError()); QQuickText *text = qobject_cast<QQuickText*>(component.create()); - QVERIFY(text != 0); + QVERIFY(text != nullptr); QCOMPARE(text->text(),QString("passed")); } diff --git a/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp index 5231af88be..52e27af647 100644 --- a/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp +++ b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp @@ -86,7 +86,7 @@ void tst_qqmlstatemachine::tst_cppObjectSignal() QQmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("_cppObject", &cppObject); QScopedPointer<QObject> rootObject(component.create()); - QVERIFY(rootObject != 0); + QVERIFY(rootObject != nullptr); // wait for state machine to start QTRY_VERIFY(rootObject->property("running").toBool()); diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp index 44e7c706bf..64f804c200 100644 --- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp +++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp @@ -116,7 +116,7 @@ void tst_qqmltimer::notRepeating() QQmlComponent component(&engine); component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); QVERIFY(timer->isRunning()); QVERIFY(!timer->isRepeating()); QCOMPARE(timer->interval(), 100); @@ -138,7 +138,7 @@ void tst_qqmltimer::notRepeatingStart() QQmlComponent component(&engine); component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); QVERIFY(!timer->isRunning()); TimerHelper helper; @@ -163,7 +163,7 @@ void tst_qqmltimer::repeat() QQmlComponent component(&engine); component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); TimerHelper helper; connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); @@ -205,7 +205,7 @@ void tst_qqmltimer::triggeredOnStart() QQmlComponent component(&engine); component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); QVERIFY(timer->triggeredOnStart()); TimerHelper helper; @@ -239,7 +239,7 @@ void tst_qqmltimer::triggeredOnStartRepeat() QQmlComponent component(&engine); component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); TimerHelper helper; connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); @@ -268,7 +268,7 @@ void tst_qqmltimer::noTriggerIfNotRunning() "}" ), QUrl::fromLocalFile("")); QObject *item = component.create(); - QVERIFY(item != 0); + QVERIFY(item != nullptr); consistentWait(200); QCOMPARE(item->property("ok").toBool(), true); @@ -281,7 +281,7 @@ void tst_qqmltimer::changeDuration() QQmlComponent component(&engine); component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); TimerHelper helper; connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); @@ -317,7 +317,7 @@ void tst_qqmltimer::restart() QQmlComponent component(&engine); component.setData(QByteArray("import QtQml 2.0\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); QQmlTimer *timer = qobject_cast<QQmlTimer*>(component.create()); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); TimerHelper helper; connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); @@ -350,7 +350,7 @@ void tst_qqmltimer::restartFromTriggered() " }"), QUrl::fromLocalFile("")); QScopedPointer<QObject> object(component.create()); QQmlTimer *timer = qobject_cast<QQmlTimer*>(object.data()); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); TimerHelper helper; connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); @@ -378,7 +378,7 @@ void tst_qqmltimer::runningFromTriggered() " }"), QUrl::fromLocalFile("")); QScopedPointer<QObject> object(component.create()); QQmlTimer *timer = qobject_cast<QQmlTimer*>(object.data()); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); TimerHelper helper; connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); @@ -401,9 +401,9 @@ void tst_qqmltimer::parentProperty() QQmlComponent component(&engine); component.setData(QByteArray("import QtQuick 2.0\nItem { Timer { objectName: \"timer\"; running: parent.visible } }"), QUrl::fromLocalFile("")); QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QQmlTimer *timer = item->findChild<QQmlTimer*>("timer"); - QVERIFY(timer != 0); + QVERIFY(timer != nullptr); QVERIFY(timer->isRunning()); diff --git a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp index 80c54bdf8e..fc736cde1a 100644 --- a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp +++ b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp @@ -71,7 +71,7 @@ void tst_qqmltranslation::translation() QQmlEngine engine; QQmlComponent component(&engine, testFile); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); if (verifyCompiledData) { QQmlContext *context = qmlContext(object); @@ -131,7 +131,7 @@ void tst_qqmltranslation::idTranslation() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("idtranslation.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); { QQmlContext *context = qmlContext(object); diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index 5a3d76e903..c10a8a08c1 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -61,7 +61,7 @@ void tst_QQMLTypeLoader::testLoadComplete() QVERIFY(QTest::qWaitForWindowExposed(window)); QObject *rootObject = window->rootObject(); - QTRY_VERIFY(rootObject != 0); + QTRY_VERIFY(rootObject != nullptr); QTRY_COMPARE(rootObject->property("created").toInt(), 2); QTRY_COMPARE(rootObject->property("loaded").toInt(), 2); delete window; @@ -136,7 +136,7 @@ void tst_QQMLTypeLoader::trimCache3() QQmlProperty::write(window->rootObject(), "source", QString()); // handle our deleteLater and cleanup - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); window->engine()->collectGarbage(); @@ -173,7 +173,7 @@ class TestObject : public QObject { Q_OBJECT public: - TestObject(QObject *parent = 0) : QObject(parent) {} + TestObject(QObject *parent = nullptr) : QObject(parent) {} }; QML_DECLARE_TYPE(TestObject) diff --git a/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp index 1902801c8f..22074602b7 100644 --- a/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp +++ b/tests/auto/qml/qqmlvaluetypeproviders/tst_qqmlvaluetypeproviders.cpp @@ -78,7 +78,7 @@ void tst_qqmlvaluetypeproviders::qtqmlValueTypes() QVERIFY(!component.isError()); QVERIFY(component.errors().isEmpty()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("qtqmlTypeSuccess").toBool()); QVERIFY(object->property("qtquickTypeSuccess").toBool()); delete object; @@ -91,7 +91,7 @@ void tst_qqmlvaluetypeproviders::qtquickValueTypes() QVERIFY(!component.isError()); QVERIFY(component.errors().isEmpty()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("qtqmlTypeSuccess").toBool()); QVERIFY(object->property("qtquickTypeSuccess").toBool()); delete object; @@ -104,7 +104,7 @@ void tst_qqmlvaluetypeproviders::comparisonSemantics() QVERIFY(!component.isError()); QVERIFY(component.errors().isEmpty()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("comparisonSuccess").toBool()); delete object; } @@ -116,7 +116,7 @@ void tst_qqmlvaluetypeproviders::cppIntegration() QVERIFY(!component.isError()); QVERIFY(component.errors().isEmpty()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); // ensure accessing / comparing / assigning cpp-defined props // and qml-defined props works in QML. @@ -156,7 +156,7 @@ void tst_qqmlvaluetypeproviders::jsObjectConversion() QVERIFY(!component.isError()); QVERIFY(component.errors().isEmpty()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("qtquickTypeSuccess").toBool()); delete object; } @@ -168,7 +168,7 @@ void tst_qqmlvaluetypeproviders::invokableFunctions() QVERIFY(!component.isError()); QVERIFY(component.errors().isEmpty()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("complete").toBool()); QVERIFY(object->property("success").toBool()); delete object; @@ -233,7 +233,7 @@ public: if (type == qMetaTypeId<TestValue>()) return &TestValueType::staticMetaObject; - return 0; + return nullptr; } }; @@ -284,7 +284,7 @@ void tst_qqmlvaluetypeproviders::userType() QQmlComponent component(&e, testFileUrl("userType.qml")); QScopedPointer<QObject> obj(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("success").toBool(), true); } @@ -295,7 +295,7 @@ void tst_qqmlvaluetypeproviders::changedSignal() QVERIFY(!component.isError()); QVERIFY(component.errors().isEmpty()); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("complete").toBool()); QVERIFY(object->property("success").toBool()); } diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index ce52afc862..c252bba001 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -108,7 +108,7 @@ void tst_qqmlvaluetypes::point() { QQmlComponent component(&engine, testFileUrl("point_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("p_x").toInt(), 10); QCOMPARE(object->property("p_y").toInt(), 4); @@ -120,7 +120,7 @@ void tst_qqmlvaluetypes::point() { QQmlComponent component(&engine, testFileUrl("point_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->point(), QPoint(11, 12)); @@ -130,7 +130,7 @@ void tst_qqmlvaluetypes::point() { QQmlComponent component(&engine, testFileUrl("point_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QPoint(10, 4)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -153,7 +153,7 @@ void tst_qqmlvaluetypes::pointf() { QQmlComponent component(&engine, testFileUrl("pointf_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(float(object->property("p_x").toDouble()), float(11.3)); QCOMPARE(float(object->property("p_y").toDouble()), float(-10.9)); @@ -165,7 +165,7 @@ void tst_qqmlvaluetypes::pointf() { QQmlComponent component(&engine, testFileUrl("pointf_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->pointf(), QPointF(6.8, 9.3)); @@ -175,7 +175,7 @@ void tst_qqmlvaluetypes::pointf() { QQmlComponent component(&engine, testFileUrl("pointf_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QPointF(11.3, -10.9)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -198,7 +198,7 @@ void tst_qqmlvaluetypes::size() { QQmlComponent component(&engine, testFileUrl("size_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("s_width").toInt(), 1912); QCOMPARE(object->property("s_height").toInt(), 1913); @@ -210,7 +210,7 @@ void tst_qqmlvaluetypes::size() { QQmlComponent component(&engine, testFileUrl("size_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->size(), QSize(13, 88)); @@ -220,7 +220,7 @@ void tst_qqmlvaluetypes::size() { QQmlComponent component(&engine, testFileUrl("size_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QSize(1912, 1913)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -243,7 +243,7 @@ void tst_qqmlvaluetypes::sizef() { QQmlComponent component(&engine, testFileUrl("sizef_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(float(object->property("s_width").toDouble()), float(0.1)); QCOMPARE(float(object->property("s_height").toDouble()), float(100923.2)); @@ -255,7 +255,7 @@ void tst_qqmlvaluetypes::sizef() { QQmlComponent component(&engine, testFileUrl("sizef_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->sizef(), QSizeF(44.3, 92.8)); @@ -265,7 +265,7 @@ void tst_qqmlvaluetypes::sizef() { QQmlComponent component(&engine, testFileUrl("sizef_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QSizeF(0.1, 100923)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -288,7 +288,7 @@ void tst_qqmlvaluetypes::variant() { QQmlComponent component(&engine, testFileUrl("variant_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(float(object->property("s_width").toDouble()), float(0.1)); QCOMPARE(float(object->property("s_height").toDouble()), float(100923.2)); @@ -300,7 +300,7 @@ void tst_qqmlvaluetypes::variant() { QQmlComponent component(&engine, testFileUrl("variant_write.1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("complete").toBool()); QVERIFY(object->property("success").toBool()); delete object; @@ -309,7 +309,7 @@ void tst_qqmlvaluetypes::variant() { QQmlComponent component(&engine, testFileUrl("variant_write.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("complete").toBool()); QVERIFY(object->property("success").toBool()); delete object; @@ -359,7 +359,7 @@ void tst_qqmlvaluetypes::sizereadonly() { QQmlComponent component(&engine, testFileUrl("sizereadonly_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("s_width").toInt(), 1912); QCOMPARE(object->property("s_height").toInt(), 1913); @@ -403,7 +403,7 @@ void tst_qqmlvaluetypes::rect() { QQmlComponent component(&engine, testFileUrl("rect_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("r_x").toInt(), 2); QCOMPARE(object->property("r_y").toInt(), 3); @@ -421,7 +421,7 @@ void tst_qqmlvaluetypes::rect() { QQmlComponent component(&engine, testFileUrl("rect_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect(), QRect(1234, 7, 56, 63)); @@ -431,7 +431,7 @@ void tst_qqmlvaluetypes::rect() { QQmlComponent component(&engine, testFileUrl("rect_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QRect(2, 3, 109, 102)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -454,7 +454,7 @@ void tst_qqmlvaluetypes::rectf() { QQmlComponent component(&engine, testFileUrl("rectf_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(float(object->property("r_x").toDouble()), float(103.8)); QCOMPARE(float(object->property("r_y").toDouble()), float(99.2)); @@ -472,7 +472,7 @@ void tst_qqmlvaluetypes::rectf() { QQmlComponent component(&engine, testFileUrl("rectf_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rectf(), QRectF(70.1, -113.2, 80924.8, 99.2)); @@ -482,7 +482,7 @@ void tst_qqmlvaluetypes::rectf() { QQmlComponent component(&engine, testFileUrl("rectf_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QRectF(103.8, 99.2, 88.1, 77.6)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -505,7 +505,7 @@ void tst_qqmlvaluetypes::vector2d() { QQmlComponent component(&engine, testFileUrl("vector2d_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE((float)object->property("v_x").toDouble(), (float)32.88); QCOMPARE((float)object->property("v_y").toDouble(), (float)1.3); @@ -517,7 +517,7 @@ void tst_qqmlvaluetypes::vector2d() { QQmlComponent component(&engine, testFileUrl("vector2d_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->vector2(), QVector2D(-0.3f, -12.9f)); @@ -527,7 +527,7 @@ void tst_qqmlvaluetypes::vector2d() { QQmlComponent component(&engine, testFileUrl("vector2d_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QVector2D(32.88, 1.3)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -545,7 +545,7 @@ void tst_qqmlvaluetypes::vector2d() { QQmlComponent component(&engine, testFileUrl("vector2d_invokables.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); delete object; } @@ -556,7 +556,7 @@ void tst_qqmlvaluetypes::vector3d() { QQmlComponent component(&engine, testFileUrl("vector3d_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE((float)object->property("v_x").toDouble(), (float)23.88); QCOMPARE((float)object->property("v_y").toDouble(), (float)3.1); @@ -569,7 +569,7 @@ void tst_qqmlvaluetypes::vector3d() { QQmlComponent component(&engine, testFileUrl("vector3d_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->vector(), QVector3D(-0.3f, -12.9f, 907.4f)); @@ -579,7 +579,7 @@ void tst_qqmlvaluetypes::vector3d() { QQmlComponent component(&engine, testFileUrl("vector3d_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QVector3D(23.88, 3.1, 4.3)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -598,7 +598,7 @@ void tst_qqmlvaluetypes::vector3d() { QQmlComponent component(&engine, testFileUrl("vector3d_invokables.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); delete object; } @@ -609,7 +609,7 @@ void tst_qqmlvaluetypes::vector4d() { QQmlComponent component(&engine, testFileUrl("vector4d_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2); QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88); @@ -623,7 +623,7 @@ void tst_qqmlvaluetypes::vector4d() { QQmlComponent component(&engine, testFileUrl("vector4d_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->vector4(), QVector4D(-0.3f, -12.9f, 907.4f, 88.5f)); @@ -633,7 +633,7 @@ void tst_qqmlvaluetypes::vector4d() { QQmlComponent component(&engine, testFileUrl("vector4d_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QVector4D(54.2, 23.88, 3.1, 4.3)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -651,7 +651,7 @@ void tst_qqmlvaluetypes::vector4d() { QQmlComponent component(&engine, testFileUrl("vector4d_invokables.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); delete object; } @@ -662,7 +662,7 @@ void tst_qqmlvaluetypes::quaternion() { QQmlComponent component(&engine, testFileUrl("quaternion_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE((float)object->property("v_scalar").toDouble(), (float)4.3); QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2); @@ -676,7 +676,7 @@ void tst_qqmlvaluetypes::quaternion() { QQmlComponent component(&engine, testFileUrl("quaternion_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->quaternion(), QQuaternion(88.5f, -0.3f, -12.9f, 907.4f)); @@ -686,7 +686,7 @@ void tst_qqmlvaluetypes::quaternion() { QQmlComponent component(&engine, testFileUrl("quaternion_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QQuaternion(4.3, 54.2, 23.88, 3.1)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -707,7 +707,7 @@ void tst_qqmlvaluetypes::matrix4x4() { QQmlComponent component(&engine, testFileUrl("matrix4x4_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE((float)object->property("v_m11").toDouble(), (float)1); QCOMPARE((float)object->property("v_m12").toDouble(), (float)2); @@ -737,7 +737,7 @@ void tst_qqmlvaluetypes::matrix4x4() { QQmlComponent component(&engine, testFileUrl("matrix4x4_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->matrix(), QMatrix4x4(11, 12, 13, 14, 21, 22, 23, 24, @@ -750,7 +750,7 @@ void tst_qqmlvaluetypes::matrix4x4() { QQmlComponent component(&engine, testFileUrl("matrix4x4_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)"); QCOMPARE(object->property("tostring").toString(), tostring); @@ -768,7 +768,7 @@ void tst_qqmlvaluetypes::matrix4x4() { QQmlComponent component(&engine, testFileUrl("matrix4x4_invokables.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); delete object; } @@ -779,7 +779,7 @@ void tst_qqmlvaluetypes::font() { QQmlComponent component(&engine, testFileUrl("font_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("f_family").toString(), object->font().family()); QCOMPARE(object->property("f_bold").toBool(), object->font().bold()); @@ -802,7 +802,7 @@ void tst_qqmlvaluetypes::font() { QQmlComponent component(&engine, testFileUrl("font_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QFont font; font.setFamily("Helvetica"); @@ -835,7 +835,7 @@ void tst_qqmlvaluetypes::font() { QQmlComponent component(&engine, testFileUrl("font_write.2.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->font().pixelSize(), 10); @@ -847,7 +847,7 @@ void tst_qqmlvaluetypes::font() QQmlComponent component(&engine, testFileUrl("font_write.3.qml")); QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size."); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->font().pixelSize(), 10); @@ -857,7 +857,7 @@ void tst_qqmlvaluetypes::font() QQmlComponent component(&engine, testFileUrl("font_write.4.qml")); QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size."); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->font().pixelSize(), 10); @@ -866,11 +866,11 @@ void tst_qqmlvaluetypes::font() { QQmlComponent component(&engine, testFileUrl("font_write.5.qml")); QObject *object = qobject_cast<QObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); MyTypeObject *object1 = object->findChild<MyTypeObject *>("object1"); - QVERIFY(object1 != 0); + QVERIFY(object1 != nullptr); MyTypeObject *object2 = object->findChild<MyTypeObject *>("object2"); - QVERIFY(object2 != 0); + QVERIFY(object2 != nullptr); QCOMPARE(object1->font().pixelSize(), 19); QCOMPARE(object2->font().pointSize(), 14); @@ -881,7 +881,7 @@ void tst_qqmlvaluetypes::font() { QQmlComponent component(&engine, testFileUrl("font_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString tostring = QLatin1String("QFont(") + object->font().toString() + QLatin1Char(')'); QCOMPARE(object->property("tostring").toString(), tostring); @@ -902,7 +902,7 @@ void tst_qqmlvaluetypes::color() { QQmlComponent component(&engine, testFileUrl("color_read.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE((float)object->property("v_r").toDouble(), (float)0.2); QCOMPARE((float)object->property("v_g").toDouble(), (float)0.88); @@ -930,7 +930,7 @@ void tst_qqmlvaluetypes::color() { QQmlComponent component(&engine, testFileUrl("color_write.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QColor newColor; newColor.setRedF(0.5); @@ -945,7 +945,7 @@ void tst_qqmlvaluetypes::color() { QQmlComponent component(&engine, testFileUrl("color_write_HSV.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QColor newColor; newColor.setHsvF(0.43, 0.77, 0.88, 0.7); @@ -957,7 +957,7 @@ void tst_qqmlvaluetypes::color() { QQmlComponent component(&engine, testFileUrl("color_write_HSL.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QColor newColor; newColor.setHslF(0.43, 0.74, 0.54, 0.7); @@ -969,7 +969,7 @@ void tst_qqmlvaluetypes::color() { QQmlComponent component(&engine, testFileUrl("color_compare.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QString colorString("#5733e199"); QCOMPARE(object->property("colorToString").toString(), colorString); QCOMPARE(object->property("colorEqualsIdenticalRgba").toBool(), true); @@ -1004,7 +1004,7 @@ void tst_qqmlvaluetypes::bindingAssignment() { QQmlComponent component(&engine, testFileUrl("bindingAssignment.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect().x(), 10); QCOMPARE(object->rect().y(), 15); @@ -1025,7 +1025,7 @@ void tst_qqmlvaluetypes::bindingAssignment() QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); QQmlComponent component(&engine, testFileUrl("bindingAssignment.2.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect().x(), 5); object->setProperty("value", QVariant(92)); QCOMPARE(object->rect().x(), 5); @@ -1038,7 +1038,7 @@ void tst_qqmlvaluetypes::bindingRead() { QQmlComponent component(&engine, testFileUrl("bindingRead.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("value").toInt(), 2); @@ -1054,7 +1054,7 @@ void tst_qqmlvaluetypes::staticAssignment() { QQmlComponent component(&engine, testFileUrl("staticAssignment.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect().x(), 9); @@ -1066,7 +1066,7 @@ void tst_qqmlvaluetypes::scriptAccess() { QQmlComponent component(&engine, testFileUrl("scriptAccess.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("valuePre").toInt(), 2); QCOMPARE(object->rect().x(), 19); @@ -1081,7 +1081,7 @@ void tst_qqmlvaluetypes::autoBindingRemoval() { QQmlComponent component(&engine, testFileUrl("autoBindingRemoval.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect().x(), 10); @@ -1103,7 +1103,7 @@ void tst_qqmlvaluetypes::autoBindingRemoval() { QQmlComponent component(&engine, testFileUrl("autoBindingRemoval.2.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect().x(), 10); @@ -1127,7 +1127,7 @@ void tst_qqmlvaluetypes::autoBindingRemoval() QString warning = component.url().toString() + ":6:11: Unable to assign [undefined] to QRect"; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); object->setProperty("value", QVariant(QRect(9, 22, 33, 44))); @@ -1150,7 +1150,7 @@ void tst_qqmlvaluetypes::valueSources() { QQmlComponent component(&engine, testFileUrl("valueSources.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect().x(), 3345); @@ -1174,7 +1174,7 @@ void tst_qqmlvaluetypes::valueInterceptors() QQmlComponent component(&engine, testFileUrl("valueInterceptors.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); checkNoErrors(component); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect().x(), 13); @@ -1208,10 +1208,10 @@ void tst_qqmlvaluetypes::deletedObject() QQmlComponent component(&engine, testFileUrl("deletedObject.qml")); QTest::ignoreMessage(QtDebugMsg, "Test: 2"); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *dObject = qvariant_cast<QObject *>(object->property("object")); - QVERIFY(dObject != 0); + QVERIFY(dObject != nullptr); delete dObject; QTest::ignoreMessage(QtDebugMsg, "Test: undefined"); @@ -1225,7 +1225,7 @@ void tst_qqmlvaluetypes::bindingVariantCopy() { QQmlComponent component(&engine, testFileUrl("bindingVariantCopy.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect(), QRect(19, 33, 5, 99)); @@ -1237,7 +1237,7 @@ void tst_qqmlvaluetypes::scriptVariantCopy() { QQmlComponent component(&engine, testFileUrl("scriptVariantCopy.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->rect(), QRect(2, 3, 109, 102)); @@ -1253,7 +1253,7 @@ void tst_qqmlvaluetypes::enums() { QQmlComponent component(&engine, testFileUrl("enums.1.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->font().capitalization(), QFont::AllUppercase); delete object; } @@ -1261,7 +1261,7 @@ void tst_qqmlvaluetypes::enums() { QQmlComponent component(&engine, testFileUrl("enums.2.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->font().capitalization(), QFont::AllUppercase); delete object; } @@ -1269,7 +1269,7 @@ void tst_qqmlvaluetypes::enums() { QQmlComponent component(&engine, testFileUrl("enums.3.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->font().capitalization(), QFont::AllUppercase); delete object; } @@ -1277,7 +1277,7 @@ void tst_qqmlvaluetypes::enums() { QQmlComponent component(&engine, testFileUrl("enums.4.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->font().capitalization(), QFont::AllUppercase); delete object; } @@ -1285,7 +1285,7 @@ void tst_qqmlvaluetypes::enums() { QQmlComponent component(&engine, testFileUrl("enums.5.qml")); MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->font().capitalization(), QFont::AllUppercase); delete object; } @@ -1298,7 +1298,7 @@ void tst_qqmlvaluetypes::conflictingBindings() { QQmlComponent component(&engine, testFileUrl("conflicting.1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); @@ -1316,7 +1316,7 @@ void tst_qqmlvaluetypes::conflictingBindings() { QQmlComponent component(&engine, testFileUrl("conflicting.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6); @@ -1334,7 +1334,7 @@ void tst_qqmlvaluetypes::conflictingBindings() { QQmlComponent component(&engine, testFileUrl("conflicting.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); @@ -1354,7 +1354,7 @@ void tst_qqmlvaluetypes::returnValues() { QQmlComponent component(&engine, testFileUrl("returnValues.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -1367,7 +1367,7 @@ void tst_qqmlvaluetypes::varAssignment() { QQmlComponent component(&engine, testFileUrl("varAssignment.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("x").toInt(), 1); QCOMPARE(object->property("y").toInt(), 2); @@ -1382,7 +1382,7 @@ void tst_qqmlvaluetypes::bindingsSpliceCorrectly() { QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.1.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -1392,7 +1392,7 @@ void tst_qqmlvaluetypes::bindingsSpliceCorrectly() { QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.2.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -1403,7 +1403,7 @@ void tst_qqmlvaluetypes::bindingsSpliceCorrectly() { QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.3.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -1413,7 +1413,7 @@ void tst_qqmlvaluetypes::bindingsSpliceCorrectly() { QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.4.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -1423,7 +1423,7 @@ void tst_qqmlvaluetypes::bindingsSpliceCorrectly() { QQmlComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.5.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); @@ -1435,7 +1435,7 @@ void tst_qqmlvaluetypes::nonValueTypeComparison() { QQmlComponent component(&engine, testFileUrl("nonValueTypeComparison.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test1").toBool(), true); QCOMPARE(object->property("test2").toBool(), true); @@ -1447,7 +1447,7 @@ void tst_qqmlvaluetypes::initializeByWrite() { QQmlComponent component(&engine, testFileUrl("initializeByWrite.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("test").toBool(), true); diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp index 1a23286ede..1f1be122f1 100644 --- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp +++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp @@ -115,7 +115,7 @@ void tst_qquickfolderlistmodel::basicProperties() checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); QCOMPARE(flm->property("nameFilters").toStringList(), QStringList() << "*.qml"); // from basic.qml QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(QDir::currentPath())); @@ -149,7 +149,7 @@ void tst_qquickfolderlistmodel::status() checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); QTRY_COMPARE(flm->property("status").toInt(), int(Ready)); flm->setProperty("folder", QUrl::fromLocalFile("")); QTRY_COMPARE(flm->property("status").toInt(), int(Null)); @@ -163,7 +163,7 @@ void tst_qquickfolderlistmodel::showFiles() checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); flm->setProperty("folder", dataDirectoryUrl()); QTRY_COMPARE(flm->property("count").toInt(), 8); // wait for refresh @@ -181,7 +181,7 @@ void tst_qquickfolderlistmodel::resetFiltering() checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); flm->setProperty("folder", testFileUrl("resetfiltering")); // _q_directoryUpdated may be triggered if model was empty before, but there won't be a rowsRemoved signal @@ -203,7 +203,7 @@ void tst_qquickfolderlistmodel::nameFilters() checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); connect(flm, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(removed(QModelIndex,int,int))); @@ -235,7 +235,7 @@ void tst_qquickfolderlistmodel::refresh() checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); flm->setProperty("folder", dataDirectoryUrl()); QTRY_COMPARE(flm->property("count").toInt(),8); // wait for refresh @@ -258,7 +258,7 @@ void tst_qquickfolderlistmodel::cdUp() checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); const QUrl startFolder = flm->property("folder").toUrl(); QVERIFY(startFolder.isValid()); @@ -336,7 +336,7 @@ void tst_qquickfolderlistmodel::showDotAndDotDot() checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); flm->setProperty("folder", folder); flm->setProperty("rootFolder", rootFolder); @@ -371,7 +371,7 @@ void tst_qquickfolderlistmodel::sortReversed() QQmlComponent component(&engine, testFileUrl("sortReversed.qml")); checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); flm->setProperty("folder", dataDirectoryUrl()); QTRY_COMPARE(flm->property("count").toInt(), 9); // wait for refresh QCOMPARE(flm->data(flm->index(0),FileNameRole).toString(), QLatin1String("txtdir")); @@ -382,7 +382,7 @@ void tst_qquickfolderlistmodel::introspectQrc() QQmlComponent component(&engine, testFileUrl("qrc.qml")); checkNoErrors(component); QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); - QVERIFY(flm != 0); + QVERIFY(flm != nullptr); QTRY_COMPARE(flm->property("count").toInt(), 1); // wait for refresh QCOMPARE(flm->data(flm->index(0),FileNameRole).toString(), QLatin1String("hello.txt")); } diff --git a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp index 49135ca920..e8a4be6faf 100644 --- a/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp +++ b/tests/auto/qml/qquickworkerscript/tst_qquickworkerscript.cpp @@ -79,7 +79,7 @@ void tst_QQuickWorkerScript::source() { QQmlComponent component(&m_engine, testFileUrl("worker.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); const QMetaObject *mo = worker->metaObject(); QVariant value(100); @@ -104,7 +104,7 @@ void tst_QQuickWorkerScript::messaging() QQmlComponent component(&m_engine, testFileUrl("worker.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); waitForEchoMessage(worker); @@ -144,7 +144,7 @@ void tst_QQuickWorkerScript::messaging_sendQObjectList() QQmlComponent component(&m_engine, testFileUrl("worker.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QVariantList objects; for (int i=0; i<3; i++) @@ -165,7 +165,7 @@ void tst_QQuickWorkerScript::messaging_sendJsObject() { QQmlComponent component(&m_engine, testFileUrl("worker.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); // Properties are in alphabetical order to enable string-based comparison after // QVariant roundtrip, since the properties will be stored in a QVariantMap. @@ -204,7 +204,7 @@ void tst_QQuickWorkerScript::script_with_pragma() QQmlComponent component(&m_engine, testFileUrl("worker_pragma.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); waitForEchoMessage(worker); @@ -220,7 +220,7 @@ void tst_QQuickWorkerScript::script_included() { QQmlComponent component(&m_engine, testFileUrl("worker_include.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QString value("Hello"); @@ -247,7 +247,7 @@ void tst_QQuickWorkerScript::scriptError_onLoad() QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QTRY_COMPARE(qquickworkerscript_lastWarning, testFileUrl("script_error_onLoad.js").toString() + QLatin1String(":3:10: SyntaxError: Expected token `,'")); @@ -261,7 +261,7 @@ void tst_QQuickWorkerScript::scriptError_onCall() { QQmlComponent component(&m_engine, testFileUrl("worker_error_onCall.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler); QVariant value; @@ -279,7 +279,7 @@ void tst_QQuickWorkerScript::script_function() { QQmlComponent component(&m_engine, testFileUrl("worker_function.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QString value("Hello"); @@ -297,7 +297,7 @@ void tst_QQuickWorkerScript::script_var() { QQmlComponent component(&m_engine, testFileUrl("worker_var.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QString value("Hello"); @@ -316,7 +316,7 @@ void tst_QQuickWorkerScript::script_global() { QQmlComponent component(&m_engine, testFileUrl("worker_global.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QString value("Hello"); @@ -340,7 +340,7 @@ void tst_QQuickWorkerScript::script_global() QQmlComponent component(&m_engine, testFileUrl("worker_global2.qml")); QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create()); - QVERIFY(worker != 0); + QVERIFY(worker != nullptr); QTRY_COMPARE(qquickworkerscript_lastWarning, testFileUrl("script_global2.js").toString() + QLatin1String(":1: Invalid write to global property \"world\"")); diff --git a/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp b/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp index eab3837245..90b6feee28 100644 --- a/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp +++ b/tests/auto/qml/qtqmlmodules/tst_qtqmlmodules.cpp @@ -49,7 +49,7 @@ void tst_qtqmlmodules::baseTypes() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("base.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); delete object; @@ -60,7 +60,7 @@ void tst_qtqmlmodules::modelsTypes() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("models.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); delete object; @@ -71,7 +71,7 @@ void tst_qtqmlmodules::unavailableTypes() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("unavailable.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->property("success").toBool()); delete object; diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 2dc5a8ed23..716651ec0c 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -36,7 +36,7 @@ #include <QQmlEngine> #include <QQmlError> -static QtMessageHandler testlibMsgHandler = 0; +static QtMessageHandler testlibMsgHandler = nullptr; void msgHandlerFilter(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg) { if (type == QtCriticalMsg || type == QtFatalMsg) diff --git a/tests/auto/quick/geometry/tst_geometry.cpp b/tests/auto/quick/geometry/tst_geometry.cpp index 904f85c4c6..54de46276c 100644 --- a/tests/auto/quick/geometry/tst_geometry.cpp +++ b/tests/auto/quick/geometry/tst_geometry.cpp @@ -58,7 +58,7 @@ void GeometryTest::testPoint2D() QSGGeometry::updateRectGeometry(&geometry, QRectF(1, 2, 3, 4)); QSGGeometry::Point2D *pts = geometry.vertexDataAsPoint2D(); - QVERIFY(pts != 0); + QVERIFY(pts != nullptr); QCOMPARE(pts[0].x, (float) 1); QCOMPARE(pts[0].y, (float) 2); @@ -91,7 +91,7 @@ void GeometryTest::testTexturedPoint2D() QSGGeometry::updateTexturedRectGeometry(&geometry, QRectF(1, 2, 3, 4), QRectF(5, 6, 7, 8)); QSGGeometry::TexturedPoint2D *pts = geometry.vertexDataAsTexturedPoint2D(); - QVERIFY(pts != 0); + QVERIFY(pts != nullptr); QCOMPARE(pts[0].x, (float) 1); QCOMPARE(pts[0].y, (float) 2); diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index e7303604b4..c9af5a5c34 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -118,8 +118,8 @@ class DummyRenderer : public QSGBatchRenderer::Renderer public: DummyRenderer(QSGRootNode *root, QSGDefaultRenderContext *renderContext) : QSGBatchRenderer::Renderer(renderContext) - , changedNode(0) - , changedState(0) + , changedNode(nullptr) + , changedState(nullptr) , renderCount(0) { setRootNode(root); diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp index a2934eee32..8d8c915e39 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp @@ -72,7 +72,7 @@ void tst_MptaInterop::createView(QScopedPointer<QQuickView> &window, const char window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } void tst_MptaInterop::initTestCase() diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp index f827b82205..53bb10b7b8 100644 --- a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp @@ -77,7 +77,7 @@ void tst_DragHandler::createView(QScopedPointer<QQuickView> &window, const char window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } QSet<QQuickPointerHandler*> tst_DragHandler::passiveGrabbers(QQuickWindow *window, int pointId /*= 0*/) diff --git a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp index d38ae3190e..0158d864c4 100644 --- a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp @@ -94,7 +94,7 @@ class EventItem : public QQuickItem { Q_OBJECT public: - EventItem(QQuickItem *parent = 0) + EventItem(QQuickItem *parent = nullptr) : QQuickItem(parent), acceptPointer(false), grabPointer(false), acceptMouse(false), acceptTouch(false), filterTouch(false) {} @@ -269,7 +269,7 @@ void tst_PointerHandlers::createView(QScopedPointer<QQuickView> &window, const c window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } void tst_PointerHandlers::initTestCase() diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp index 9e3261f7b2..cf18b5eca1 100644 --- a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp @@ -85,7 +85,7 @@ void tst_TapHandler::createView(QScopedPointer<QQuickView> &window, const char * window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } void tst_TapHandler::initTestCase() diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp index e843f9e5a1..0ee78fae54 100644 --- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp +++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp @@ -143,7 +143,7 @@ void tst_QQuickAccessible::commonTests() view->setSource(testFileUrl(accessibleRoleFileName)); view->show(); // view->setFocus(); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(view); QVERIFY(iface); @@ -160,10 +160,10 @@ void tst_QQuickAccessible::quickAttachedProperties() component.setData("import QtQuick 2.0\nItem {\n" "}", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object); - QCOMPARE(attachedObject, static_cast<QObject*>(0)); + QCOMPARE(attachedObject, static_cast<QObject*>(nullptr)); delete object; } @@ -181,7 +181,7 @@ void tst_QQuickAccessible::quickAttachedProperties() "Accessible.role: Accessible.Button\n" "}", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object); QVERIFY(attachedObject); @@ -207,7 +207,7 @@ void tst_QQuickAccessible::quickAttachedProperties() "Accessible.description: \"Duck\"\n" "}", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object); QVERIFY(attachedObject); @@ -282,7 +282,7 @@ QAccessibleInterface *topLevelChildAt(QAccessibleInterface *iface, int x, int y) { QAccessibleInterface *child = iface->childAt(x, y); if (!child) - return 0; + return nullptr; QAccessibleInterface *childOfChild; while ( ( childOfChild = child->childAt(x, y)) ) { diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp index 077c8b422d..3e5a054cc7 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -334,7 +334,7 @@ void tst_qquickanimatedimage::sourceSizeChanges() QQmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", ""); QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage*>(component.create()); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); QSignalSpy sourceSizeSpy(anim, SIGNAL(sourceSizeChanged())); @@ -397,7 +397,7 @@ void tst_qquickanimatedimage::sourceSizeChanges_intermediate() ctxt->setContextProperty("srcImage", ""); QScopedPointer<QQuickAnimatedImage> anim(qobject_cast<QQuickAnimatedImage*>(component.create())); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); @@ -422,7 +422,7 @@ void tst_qquickanimatedimage::qtbug_16520() QQuickRectangle *root = qobject_cast<QQuickRectangle *>(component.create()); QVERIFY(root); QQuickAnimatedImage *anim = root->findChild<QQuickAnimatedImage*>("anim"); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); anim->setProperty("source", server.urlString("/stickman.gif")); QTRY_COMPARE(anim->opacity(), qreal(0)); @@ -445,7 +445,7 @@ void tst_qquickanimatedimage::progressAndStatusChanges() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); @@ -499,7 +499,7 @@ void tst_qquickanimatedimage::playingAndPausedChanges() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickAnimatedImage *obj = qobject_cast<QQuickAnimatedImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickAnimatedImage::Null); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp index dcb0e01b5d..71659754b0 100644 --- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp +++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp @@ -62,7 +62,7 @@ void tst_qquickanimatedsprite::initTestCase() void tst_qquickanimatedsprite::test_properties() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("basic.qml")); window->show(); @@ -87,7 +87,7 @@ void tst_qquickanimatedsprite::test_properties() void tst_qquickanimatedsprite::test_runningChangedSignal() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("runningChange.qml")); window->show(); @@ -117,7 +117,7 @@ static bool isWithinRange(T min, T value, T max) void tst_qquickanimatedsprite::test_frameChangedSignal() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("frameChange.qml")); window->show(); @@ -214,7 +214,7 @@ void tst_qquickanimatedsprite::test_largeAnimation() { QFETCH(bool, frameSync); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->engine()->addImageProvider(QLatin1String("test"), new AnimationImageProvider); window->setSource(testFileUrl("largeAnimation.qml")); window->show(); @@ -279,7 +279,7 @@ void tst_qquickanimatedsprite::test_reparenting() QVERIFY(sprite); QTRY_VERIFY(sprite->running()); - sprite->setParentItem(0); + sprite->setParentItem(nullptr); sprite->setParentItem(window.rootObject()); // don't crash (QTBUG-51162) diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index d28d065d17..de86bb16db 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -760,7 +760,7 @@ void tst_qquickanimations::badTypes() QQuickItemPrivate::get(rect)->setState("state1"); - QQuickRectangle *myRect = 0; + QQuickRectangle *myRect = nullptr; QTRY_VERIFY(myRect = rect->findChild<QQuickRectangle*>("MyRect")); QTRY_COMPARE(myRect->x(),qreal(200)); } @@ -1153,7 +1153,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::InOutQuad); } @@ -1164,7 +1164,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::OutBounce); QCOMPARE(animObject->easing().amplitude(), 5.0); } @@ -1176,7 +1176,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::OutElastic); QCOMPARE(animObject->easing().amplitude(), 5.0); QCOMPARE(animObject->easing().period(), 3.0); @@ -1189,7 +1189,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::InOutBack); QCOMPARE(animObject->easing().overshoot(), 2.0); } @@ -1201,7 +1201,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::BezierSpline); QList<QPointF> points = animObject->easing().cubicBezierSpline(); QCOMPARE(points.count(), 3); @@ -1324,7 +1324,7 @@ void tst_qquickanimations::nonTransitionBug() QQmlComponent c(&engine, testFileUrl("nonTransitionBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *mover = rect->findChild<QQuickRectangle*>("mover"); @@ -1350,7 +1350,7 @@ void tst_qquickanimations::registrationBug() QQmlComponent c(&engine, testFileUrl("registrationBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QTRY_COMPARE(rect->property("value"), QVariant(int(100))); } @@ -1360,10 +1360,10 @@ void tst_qquickanimations::doubleRegistrationBug() QQmlComponent c(&engine, testFileUrl("doubleRegistrationBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickAbstractAnimation *anim = rect->findChild<QQuickAbstractAnimation*>("animation"); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); QTRY_COMPARE(anim->qtAnimation()->state(), QAbstractAnimationJob::Stopped); } @@ -1401,7 +1401,7 @@ void tst_qquickanimations::transitionAssignmentBug() QQmlComponent c(&engine, testFileUrl("transitionAssignmentBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->property("nullObject").toBool(), false); } @@ -1413,7 +1413,7 @@ void tst_qquickanimations::pauseBindingBug() QQmlComponent c(&engine, testFileUrl("pauseBindingBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickAbstractAnimation *anim = rect->findChild<QQuickAbstractAnimation*>("animation"); QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimationJob::Paused); @@ -1427,7 +1427,7 @@ void tst_qquickanimations::pauseBug() QQmlComponent c(&engine, testFileUrl("pauseBug.qml")); QQuickAbstractAnimation *anim = qobject_cast<QQuickAbstractAnimation*>(c.create()); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimationJob::Paused); QCOMPARE(anim->isPaused(), true); QCOMPARE(anim->isRunning(), true); @@ -1444,14 +1444,14 @@ void tst_qquickanimations::loopingBug() QObject *obj = c.create(); QQuickAbstractAnimation *anim = obj->findChild<QQuickAbstractAnimation*>(); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); QCOMPARE(anim->qtAnimation()->totalDuration(), 300); QCOMPARE(anim->isRunning(), true); QTRY_COMPARE(static_cast<QAnimationGroupJob*>(anim->qtAnimation())->firstChild()->currentLoop(), 2); QTRY_COMPARE(anim->isRunning(), false); QQuickRectangle *rect = obj->findChild<QQuickRectangle*>(); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->rotation(), qreal(90)); delete obj; diff --git a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp index b681b4371f..62027f59f4 100644 --- a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp +++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp @@ -100,7 +100,7 @@ void tst_qquickapplication::active() QVERIFY(item->property("active").toBool()); QVERIFY(item->property("active2").toBool()); - QWindowSystemInterface::handleWindowActivated(0); + QWindowSystemInterface::handleWindowActivated(nullptr); #ifdef Q_OS_OSX // OS X has the concept of "reactivation" @@ -171,7 +171,7 @@ void tst_qquickapplication::state() QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationActive); // not active again - QWindowSystemInterface::handleWindowActivated(0); + QWindowSystemInterface::handleWindowActivated(nullptr); QTRY_VERIFY(QGuiApplication::focusWindow() != &window); QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationInactive); QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationInactive); diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp index bdd53702e5..fa9eba095d 100644 --- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp +++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp @@ -393,7 +393,7 @@ void tst_qquickbehaviors::delayedRegistration() QVERIFY2(!rect.isNull(), qPrintable(c.errorString())); QQuickItem *innerRect = rect->property("myItem").value<QQuickItem*>(); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QCOMPARE(innerRect->property("x").toInt(), int(0)); @@ -410,7 +410,7 @@ void tst_qquickbehaviors::startOnCompleted() QVERIFY2(!rect.isNull(), qPrintable(c.errorString())); QQuickItem *innerRect = rect->findChild<QQuickRectangle*>(); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QCOMPARE(innerRect->property("x").toInt(), int(0)); @@ -427,7 +427,7 @@ void tst_qquickbehaviors::multipleChangesToValueType() QVERIFY2(!rect.isNull(), qPrintable(c.errorString())); QQuickText *text = rect->findChild<QQuickText *>(); - QVERIFY(text != 0); + QVERIFY(text != nullptr); QFont value; value.setPointSize(24); diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp index c801077c75..02e89ba0a7 100644 --- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp @@ -101,7 +101,7 @@ void tst_qquickborderimage::noSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->source(), QUrl()); QCOMPARE(obj->width(), 0.); QCOMPARE(obj->height(), 0.); @@ -153,7 +153,7 @@ void tst_qquickborderimage::imageSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); if (remote) QTRY_COMPARE(obj->status(), QQuickBorderImage::Loading); @@ -183,7 +183,7 @@ void tst_qquickborderimage::clearSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickBorderImage::Ready); QCOMPARE(obj->width(), 120.); QCOMPARE(obj->height(), 120.); @@ -203,7 +203,7 @@ void tst_qquickborderimage::resized() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->sourceSize().width(), 120); @@ -220,7 +220,7 @@ void tst_qquickborderimage::smooth() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->smooth(), true); @@ -235,7 +235,7 @@ void tst_qquickborderimage::mirror() QQuickView *window = new QQuickView; window->setSource(testFileUrl("mirror.qml")); QQuickBorderImage *image = qobject_cast<QQuickBorderImage*>(window->rootObject()); - QVERIFY(image != 0); + QVERIFY(image != nullptr); QImage screenshot = window->grabWindow(); @@ -263,7 +263,7 @@ void tst_qquickborderimage::tileModes() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 100.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Repeat); @@ -276,7 +276,7 @@ void tst_qquickborderimage::tileModes() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 150.); QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Round); @@ -304,7 +304,7 @@ void tst_qquickborderimage::sciSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); if (remote) QTRY_COMPARE(obj->status(), QQuickBorderImage::Loading); @@ -352,7 +352,7 @@ void tst_qquickborderimage::invalidSciFile() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->status(), QQuickImageBase::Error); @@ -380,7 +380,7 @@ void tst_qquickborderimage::validSciFiles() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Round); @@ -397,7 +397,7 @@ void tst_qquickborderimage::pendingRemoteRequest() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickBorderImage::Loading); // verify no crash @@ -450,7 +450,7 @@ void tst_qquickborderimage::statusChanges() QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); qRegisterMetaType<QQuickImageBase::Status>(); QSignalSpy spy(obj, SIGNAL(statusChanged(QQuickImageBase::Status))); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); obj->setSource(source); if (remote) server.sendDelayedItem(); @@ -473,7 +473,7 @@ void tst_qquickborderimage::sourceSizeChanges() QQmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", ""); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QSignalSpy sourceSizeSpy(obj, SIGNAL(sourceSizeChanged())); @@ -539,7 +539,7 @@ void tst_qquickborderimage::progressAndStatusChanges() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickBorderImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); diff --git a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp index 9463f7b4d5..96a11e16e9 100644 --- a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp +++ b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp @@ -102,7 +102,7 @@ void tst_qquickdesignersupport::customData() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(newItem, view->engine()->contextForObject(newItem), "width", - 0)); + nullptr)); //Check if reseting property does work after setting binding QQuickDesignerSupportProperties::doResetProperty(newItem, view->rootContext(), "width"); @@ -136,7 +136,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); QCOMPARE(testComponent->property("x").toInt(), 200); @@ -149,7 +149,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(!QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); //Reset the binding to the default QQuickDesignerSupportProperties::doResetProperty(testComponent, @@ -159,7 +159,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); QCOMPARE(testComponent->property("x").toInt(), 200); @@ -173,7 +173,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); QCOMPARE(testComponent->property("x").toInt(), 300); @@ -188,7 +188,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); QCOMPARE(testComponent->property("x").toInt(), 200); } @@ -417,7 +417,7 @@ void tst_qquickdesignersupport::statesPropertyChanges() } -static QObject * s_object = 0; +static QObject * s_object = nullptr; static QQuickDesignerSupport::PropertyName s_propertyName; static void notifyPropertyChangeCallBackFunction(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName) @@ -476,7 +476,7 @@ void tst_qquickdesignersupport::testFixResourcePathsForObjectCallBack() QVERIFY(rootItem); - s_object = 0; + s_object = nullptr; QQuickDesignerSupportItems::registerFixResourcePathsForObjectCallBack(fixResourcePathsForObjectCallBackPointer); diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp index 6a919d048e..42af7d4443 100644 --- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp +++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp @@ -57,7 +57,7 @@ class TestDropTarget : public QQuickItem { Q_OBJECT public: - TestDropTarget(QQuickItem *parent = 0) + TestDropTarget(QQuickItem *parent = nullptr) : QQuickItem(parent) , enterEvents(0) , moveEvents(0) @@ -199,16 +199,16 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1); dropTarget.reset(); evaluate<void>(item, "Drag.cancel()"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.reset(); @@ -232,8 +232,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.cancel()"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1); // Enter events aren't sent to items without the QQuickItem::ItemAcceptsDrops flag. @@ -243,16 +243,16 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = true"); QCOMPARE(evaluate<bool>(item, "Drag.active"), true); QCOMPARE(evaluate<bool>(item, "dragActive"), true); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.reset(); evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.setFlags(QQuickItem::ItemAcceptsDrops); @@ -271,8 +271,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1); // Follow up events aren't sent to items if the enter event isn't accepted. @@ -283,16 +283,16 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = true"); QCOMPARE(evaluate<bool>(item, "Drag.active"), true); QCOMPARE(evaluate<bool>(item, "dragActive"), true); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.reset(); evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.accept = true; @@ -311,8 +311,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1); // Events are sent to hidden or disabled items. @@ -322,8 +322,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = true"); QCOMPARE(evaluate<bool>(item, "Drag.active"), true); QCOMPARE(evaluate<bool>(item, "dragActive"), true); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); evaluate<void>(item, "Drag.active = false"); @@ -346,8 +346,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = true"); QCOMPARE(evaluate<bool>(item, "Drag.active"), true); QCOMPARE(evaluate<bool>(item, "dragActive"), true); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); evaluate<void>(item, "Drag.active = false"); @@ -510,8 +510,8 @@ void tst_QQuickDrag::drop() QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.IgnoreAction"), true); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 1); QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0); @@ -522,8 +522,8 @@ void tst_QQuickDrag::drop() QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.IgnoreAction"), true); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 0); QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0); @@ -638,8 +638,8 @@ void tst_QQuickDrag::move() outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); item->setPosition(QPointF(110, 50)); QCoreApplication::processEvents(); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 1); QCOMPARE(outerTarget.moveEvents, 0); QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 1); QCOMPARE(leftTarget .moveEvents, 0); QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0); @@ -751,7 +751,7 @@ void tst_QQuickDrag::parentChange() QCOMPARE(dropTarget2.enterEvents, 1); // Removing then parent item sends a leave event. - item->setParentItem(0); + item->setParentItem(nullptr); QCOMPARE(dropTarget1.enterEvents, 1); QCOMPARE(dropTarget1.moveEvents, 1); QCOMPARE(dropTarget1.leaveEvents, 1); @@ -775,7 +775,7 @@ void tst_QQuickDrag::parentChange() item->setParentItem(window2.contentItem()); QCoreApplication::processEvents(); - item->setParentItem(0); + item->setParentItem(nullptr); QCoreApplication::processEvents(); QCOMPARE(dropTarget1.enterEvents, 1); QCOMPARE(dropTarget1.moveEvents, 1); @@ -1046,7 +1046,7 @@ class RecursingDropTarget : public TestDropTarget { public: RecursingDropTarget(const QString &script, int type, QQuickItem *parent) - : TestDropTarget(parent), script(script), type(type), item(0) {} + : TestDropTarget(parent), script(script), type(type), item(nullptr) {} void setItem(QQuickItem *i) { item = i; } diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp index 071a7b3607..3c7159782c 100644 --- a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp +++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp @@ -463,8 +463,8 @@ void tst_QQuickDropArea::source_internal() QQuickItem *dragSource = dropArea->findChild<QQuickItem *>("dragSource"); QVERIFY(dragSource); - QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(nullptr)); evaluate<void>(dragItem, "Drag.active = true"); QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(dragItem)); @@ -472,8 +472,8 @@ void tst_QQuickDropArea::source_internal() QCOMPARE(evaluate<QObject *>(dropArea, "eventSource"), static_cast<QObject *>(dragItem)); evaluate<void>(dragItem, "Drag.active = false"); - QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(nullptr)); evaluate<void>(dropArea, "{ eventSource = null }"); @@ -485,8 +485,8 @@ void tst_QQuickDropArea::source_internal() QCOMPARE(evaluate<QObject *>(dropArea, "eventSource"), static_cast<QObject *>(dragSource)); evaluate<void>(dragItem, "Drag.active = false"); - QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(nullptr)); } // Setting a source can't be emulated using the QWindowSystemInterface API. diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index bdf7d3dcfd..248f8447e0 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -57,7 +57,7 @@ class TouchDragArea : public QQuickItem Q_PROPERTY(bool keepTouchGrab READ keepTouchGrab WRITE setKeepTouchGrab NOTIFY keepTouchGrabChanged) public: - TouchDragArea(QQuickItem *parent = 0) + TouchDragArea(QQuickItem *parent = nullptr) : QQuickItem(parent) , touchEvents(0) , touchUpdates(0) @@ -226,7 +226,7 @@ void tst_qquickflickable::create() QQmlComponent c(&engine, testFileUrl("flickable01.qml")); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->isAtXBeginning(), true); QCOMPARE(obj->isAtXEnd(), false); QCOMPARE(obj->isAtYBeginning(), true); @@ -251,7 +251,7 @@ void tst_qquickflickable::horizontalViewportSize() QQmlComponent c(&engine, testFileUrl("flickable02.qml")); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->contentWidth(), 800.); QCOMPARE(obj->contentHeight(), 300.); QCOMPARE(obj->isAtXBeginning(), true); @@ -268,7 +268,7 @@ void tst_qquickflickable::verticalViewportSize() QQmlComponent c(&engine, testFileUrl("flickable03.qml")); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->contentWidth(), 200.); QCOMPARE(obj->contentHeight(), 6000.); QCOMPARE(obj->isAtXBeginning(), true); @@ -285,7 +285,7 @@ void tst_qquickflickable::visibleAreaRatiosUpdate() QQmlComponent c(&engine, testFileUrl("ratios.qml")); QQuickItem *obj = qobject_cast<QQuickItem*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); // check initial ratio values QCOMPARE(obj->property("heightRatioIs").toDouble(), obj->property("heightRatioShould").toDouble()); QCOMPARE(obj->property("widthRatioIs").toDouble(), obj->property("widthRatioShould").toDouble()); @@ -307,7 +307,7 @@ void tst_qquickflickable::properties() QQmlComponent c(&engine, testFileUrl("flickable04.qml")); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->isInteractive(), false); QCOMPARE(obj->boundsBehavior(), QQuickFlickable::StopAtBounds); QCOMPARE(obj->pressDelay(), 200); @@ -368,10 +368,10 @@ void tst_qquickflickable::rebound() window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QQuickTransition *rebound = window->rootObject()->findChild<QQuickTransition*>("rebound"); QVERIFY(rebound); @@ -507,7 +507,7 @@ void tst_qquickflickable::pressDelay() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); QSignalSpy spy(flickable, SIGNAL(pressDelayChanged())); @@ -535,7 +535,7 @@ void tst_qquickflickable::pressDelay() QCOMPARE(clickedSpy.count(),0); // On release the clicked signal should be emitted - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); QCOMPARE(clickedSpy.count(),1); // Press and release position should match @@ -553,7 +553,7 @@ void tst_qquickflickable::pressDelay() QCOMPARE(clickedSpy.count(),0); // On release the press, release and clicked signal should be emitted - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(180, 180)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(180, 180)); QCOMPARE(clickedSpy.count(),1); // Press and release position should match @@ -574,7 +574,7 @@ void tst_qquickflickable::pressDelay() QTRY_VERIFY(!mouseArea->property("pressed").toBool()); // On release the clicked signal should *not* be emitted - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 190)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 190)); QCOMPARE(clickedSpy.count(),1); } @@ -588,13 +588,13 @@ void tst_qquickflickable::nestedPressDelay() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(outer != 0); + QVERIFY(outer != nullptr); QQuickFlickable *inner = window->rootObject()->findChild<QQuickFlickable*>("innerFlickable"); - QVERIFY(inner != 0); + QVERIFY(inner != nullptr); moveAndPress(window.data(), QPoint(150, 150)); // the MouseArea is not pressed immediately @@ -614,7 +614,7 @@ void tst_qquickflickable::nestedPressDelay() QVERIFY(inner->property("moving").toBool()); QVERIFY(inner->property("dragging").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); QVERIFY(!inner->property("dragging").toBool()); QTRY_VERIFY(!inner->property("moving").toBool()); @@ -634,7 +634,7 @@ void tst_qquickflickable::nestedPressDelay() QVERIFY(!outer->property("moving").toBool()); QVERIFY(!outer->property("dragging").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(20, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(20, 150)); QVERIFY(!inner->property("dragging").toBool()); QTRY_VERIFY(!inner->property("moving").toBool()); @@ -653,7 +653,7 @@ void tst_qquickflickable::nestedPressDelay() QVERIFY(inner->property("moving").toBool()); QVERIFY(inner->property("dragging").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(90, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(90, 150)); QVERIFY(!inner->property("dragging").toBool()); QTRY_VERIFY(!inner->property("moving").toBool()); @@ -668,13 +668,13 @@ void tst_qquickflickable::filterReplayedPress() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(outer != 0); + QVERIFY(outer != nullptr); QQuickFlickable *inner = window->rootObject()->findChild<QQuickFlickable*>("innerFlickable"); - QVERIFY(inner != 0); + QVERIFY(inner != nullptr); QQuickItem *filteringMouseArea = outer->findChild<QQuickItem *>("filteringMouseArea"); QVERIFY(filteringMouseArea); @@ -697,7 +697,7 @@ void tst_qquickflickable::filterReplayedPress() QCOMPARE(filteringMouseArea->property("pressed").toBool(), true); QCOMPARE(filteringMouseArea->keepMouseGrab(), true); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); } @@ -711,13 +711,13 @@ void tst_qquickflickable::nestedClickThenFlick() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(outer != 0); + QVERIFY(outer != nullptr); QQuickFlickable *inner = window->rootObject()->findChild<QQuickFlickable*>("innerFlickable"); - QVERIFY(inner != 0); + QVERIFY(inner != nullptr); moveAndPress(window.data(), QPoint(150, 150)); @@ -725,7 +725,7 @@ void tst_qquickflickable::nestedClickThenFlick() QVERIFY(!outer->property("pressed").toBool()); QTRY_VERIFY(outer->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); QVERIFY(!outer->property("pressed").toBool()); @@ -743,7 +743,7 @@ void tst_qquickflickable::nestedClickThenFlick() QVERIFY(!outer->property("moving").toBool()); QVERIFY(inner->property("moving").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(80, 100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(80, 100)); } void tst_qquickflickable::flickableDirection() @@ -785,7 +785,7 @@ void tst_qquickflickable::resizeContent() QQuickItem *root = qobject_cast<QQuickItem*>(c.create()); QQuickFlickable *obj = findItem<QQuickFlickable>(root, "flick"); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->contentX(), 0.); QCOMPARE(obj->contentY(), 0.); QCOMPARE(obj->contentWidth(), 300.); @@ -818,14 +818,14 @@ void tst_qquickflickable::returnToBounds() window->setSource(testFileUrl("resize.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *obj = findItem<QQuickFlickable>(window->rootObject(), "flick"); QQuickTransition *rebound = window->rootObject()->findChild<QQuickTransition*>("rebound"); QVERIFY(rebound); QSignalSpy reboundSpy(rebound, SIGNAL(runningChanged())); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->contentX(), 0.); QCOMPARE(obj->contentY(), 0.); QCOMPARE(obj->contentWidth(), 300.); @@ -862,10 +862,10 @@ void tst_qquickflickable::wheel() window->setSource(testFileUrl("wheel.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flick"); - QVERIFY(flick != 0); + QVERIFY(flick != nullptr); QQuickFlickablePrivate *fp = QQuickFlickablePrivate::get(flick); QSignalSpy moveEndSpy(flick, SIGNAL(movementEnded())); @@ -916,10 +916,10 @@ void tst_qquickflickable::trackpad() window->setSource(testFileUrl("wheel.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flick"); - QVERIFY(flick != 0); + QVERIFY(flick != nullptr); QSignalSpy moveEndSpy(flick, SIGNAL(movementEnded())); QPoint pos(200, 200); @@ -993,10 +993,10 @@ void tst_qquickflickable::movingAndFlicking() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy vMoveSpy(flickable, SIGNAL(movingVerticallyChanged())); QSignalSpy hMoveSpy(flickable, SIGNAL(movingHorizontallyChanged())); @@ -1156,10 +1156,10 @@ void tst_qquickflickable::movingAndDragging() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy vDragSpy(flickable, SIGNAL(draggingVerticallyChanged())); QSignalSpy hDragSpy(flickable, SIGNAL(draggingHorizontallyChanged())); @@ -1201,7 +1201,7 @@ void tst_qquickflickable::movingAndDragging() QCOMPARE(moveStartSpy.count(), 1); QCOMPARE(dragStartSpy.count(), 1); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, moveFrom + moveByWithoutSnapBack*3); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, moveFrom + moveByWithoutSnapBack*3); QVERIFY(!flickable->isDragging()); QVERIFY(!flickable->isDraggingHorizontally()); @@ -1274,7 +1274,7 @@ void tst_qquickflickable::movingAndDragging() QCOMPARE(dragStartSpy.count(), 1); QCOMPARE(dragEndSpy.count(), 0); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, moveFrom + moveByWithSnapBack*3); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, moveFrom + moveByWithSnapBack*3); // should now start snapping back to bounds (moving but not dragging) QVERIFY(flickable->isMoving()); @@ -1325,10 +1325,10 @@ void tst_qquickflickable::flickOnRelease() window->setSource(testFileUrl("flickable03.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); // Vertical with a quick press-move-release: should cause a flick in release. QSignalSpy vFlickSpy(flickable, SIGNAL(flickingVerticallyChanged())); @@ -1339,7 +1339,7 @@ void tst_qquickflickable::flickOnRelease() // working even with small movements. moveAndPress(window.data(), QPoint(50, 300)); QTest::mouseMove(window.data(), QPoint(50, 10), 10); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10), 10); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 10), 10); QCOMPARE(vFlickSpy.count(), 1); @@ -1359,10 +1359,10 @@ void tst_qquickflickable::pressWhileFlicking() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy vMoveSpy(flickable, SIGNAL(movingVerticallyChanged())); QSignalSpy hMoveSpy(flickable, SIGNAL(movingHorizontallyChanged())); @@ -1388,13 +1388,13 @@ void tst_qquickflickable::pressWhileFlicking() QCOMPARE(hFlickSpy.count(), 0); QCOMPARE(flickSpy.count(), 1); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(20, 50)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(20, 50)); QTRY_VERIFY(!flickable->isFlicking()); QVERIFY(!flickable->isFlickingVertically()); QVERIFY(flickable->isMoving()); QVERIFY(flickable->isMovingVertically()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(20,50)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(20,50)); QVERIFY(!flickable->isFlicking()); QVERIFY(!flickable->isFlickingVertically()); QTRY_VERIFY(!flickable->isMoving()); @@ -1409,10 +1409,10 @@ void tst_qquickflickable::disabled() window->setSource(testFileUrl("disabled.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flickable"); - QVERIFY(flick != 0); + QVERIFY(flick != nullptr); moveAndPress(window.data(), QPoint(50, 90)); @@ -1422,11 +1422,11 @@ void tst_qquickflickable::disabled() QVERIFY(!flick->isMoving()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 60)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 60)); // verify that mouse clicks on other elements still work (QTBUG-20584) moveAndPress(window.data(), QPoint(50, 10)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 10)); QTRY_VERIFY(window->rootObject()->property("clicked").toBool()); } @@ -1440,10 +1440,10 @@ void tst_qquickflickable::flickVelocity() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); // flick up flick(window.data(), QPoint(20,190), QPoint(20, 50), 200); @@ -1488,7 +1488,7 @@ void tst_qquickflickable::margins() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); // starting state QCOMPARE(obj->contentX(), -40.); @@ -1567,10 +1567,10 @@ void tst_qquickflickable::cancelOnMouseGrab() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); moveAndPress(window.data(), QPoint(10, 10)); // drag out of bounds @@ -1605,20 +1605,20 @@ void tst_qquickflickable::clickAndDragWhenTransformed() QQuickViewTestUtil::moveMouseAway(view.data()); view->show(); QVERIFY(QTest::qWaitForWindowActive(view.data())); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); QQuickFlickable *flickable = view->rootObject()->findChild<QQuickFlickable*>("flickable"); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); // click outside child rect moveAndPress(view.data(), QPoint(190, 190)); QTRY_COMPARE(flickable->property("itemPressed").toBool(), false); - QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(190, 190)); + QTest::mouseRelease(view.data(), Qt::LeftButton, Qt::NoModifier, QPoint(190, 190)); // click inside child rect moveAndPress(view.data(), QPoint(200, 200)); QTRY_COMPARE(flickable->property("itemPressed").toBool(), true); - QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(200, 200)); + QTest::mouseRelease(view.data(), Qt::LeftButton, Qt::NoModifier, QPoint(200, 200)); const int threshold = qApp->styleHints()->startDragDistance(); @@ -1649,10 +1649,10 @@ void tst_qquickflickable::flickTwiceUsingTouches() QQuickViewTestUtil::centerOnScreen(window.data()); QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QCOMPARE(flickable->contentY(), 0.0f); flickWithTouch(window.data(), QPoint(100, 400), QPoint(100, 240)); @@ -1780,7 +1780,7 @@ void tst_qquickflickable::nestedStopAtBounds() QCOMPARE(outer->isMoving(), true); QCOMPARE(inner->isDragging(), false); QCOMPARE(inner->isMoving(), false); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!outer->isDragging()); QTRY_VERIFY(!outer->isMoving()); @@ -1802,7 +1802,7 @@ void tst_qquickflickable::nestedStopAtBounds() QCOMPARE(outer->isMoving(), false); QCOMPARE(inner->isDragging(), true); QCOMPARE(inner->isMoving(), true); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!inner->isDragging()); QTRY_VERIFY(!inner->isMoving()); @@ -1826,7 +1826,7 @@ void tst_qquickflickable::nestedStopAtBounds() QCOMPARE(outer->isMoving(), true); QCOMPARE(inner->isDragging(), false); QCOMPARE(inner->isMoving(), false); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!outer->isDragging()); QTRY_VERIFY(!outer->isMoving()); @@ -1850,7 +1850,7 @@ void tst_qquickflickable::nestedStopAtBounds() QCOMPARE(outer->isMoving(), true); QCOMPARE(inner->isDragging(), false); QCOMPARE(inner->isMoving(), false); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!outer->isDragging()); QTRY_VERIFY(!outer->isMoving()); @@ -1946,7 +1946,7 @@ void tst_qquickflickable::stopAtBounds() QCOMPARE(transpose ? flickable->contentY() : flickable->contentX(), 0.0); } - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); if (transpose) { flickable->setContentY(invert ? 100 : 0); @@ -1982,10 +1982,10 @@ void tst_qquickflickable::nestedMouseAreaUsingTouch() QQuickViewTestUtil::centerOnScreen(window.data()); QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QCOMPARE(flickable->contentY(), 50.0f); flickWithTouch(window.data(), QPoint(100, 300), QPoint(100, 200)); @@ -2028,7 +2028,7 @@ void tst_qquickflickable::nestedSliderUsingTouch() QQuickViewTestUtil::moveMouseAway(window); window->show(); QVERIFY(QTest::qWaitForWindowActive(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); QVERIFY(flickable); @@ -2067,11 +2067,11 @@ void tst_qquickflickable::pressDelayWithLoader() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); // do not crash moveAndPress(window.data(), QPoint(150, 150)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); } // QTBUG-34507 @@ -2086,7 +2086,7 @@ void tst_qquickflickable::movementFromProgrammaticFlick() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); // verify that the signals for movement and flicking are called in the right order flickable->flick(0, -1000); @@ -2141,7 +2141,7 @@ void tst_qquickflickable::ratios_smallContent() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); //doublecheck the item, as specified by contentWidth/Height, fits in the view //use tryCompare to allow a bit of stabilization in component's properties @@ -2198,7 +2198,7 @@ void tst_qquickflickable::keepGrab() QTest::mouseMove(window.data(), pos); QTest::qWait(10); } - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(310, 310)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(310, 310)); QTest::qWait(10); QCOMPARE(flickable->contentX(), 0.0); @@ -2213,7 +2213,7 @@ void tst_qquickflickable::keepGrab() QTest::mouseMove(window.data(), pos); QTest::qWait(10); } - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(310, 310)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(310, 310)); QTest::qWait(10); QVERIFY(flickable->contentX() != 0.0); @@ -2245,11 +2245,11 @@ void tst_qquickflickable::overshoot() flickable->setBoundsMovement(QQuickFlickable::BoundsMovement(boundsMovement)); // drag past the beginning - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10, 10)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10, 10)); QTest::mouseMove(window.data(), QPoint(20, 20)); QTest::mouseMove(window.data(), QPoint(30, 30)); QTest::mouseMove(window.data(), QPoint(40, 40)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) && (boundsBehavior & QQuickFlickable::DragOverBounds)) { QVERIFY(flickable->property("minContentX").toReal() < 0.0); @@ -2314,11 +2314,11 @@ void tst_qquickflickable::overshoot() QMetaObject::invokeMethod(flickable, "reset"); // drag past the end - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QTest::mouseMove(window.data(), QPoint(40, 40)); QTest::mouseMove(window.data(), QPoint(30, 30)); QTest::mouseMove(window.data(), QPoint(20, 20)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(10, 10)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10, 10)); if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) && (boundsBehavior & QQuickFlickable::DragOverBounds)) { QVERIFY(flickable->property("maxContentX").toReal() > 200.0); diff --git a/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp index 9c892488f4..b4082b3d34 100644 --- a/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp +++ b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp @@ -61,7 +61,7 @@ void tst_qquickflipable::create() QQmlComponent c(&engine, testFileUrl("test-flipable.qml")); QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); delete obj; } @@ -71,9 +71,9 @@ void tst_qquickflipable::checkFrontAndBack() QQmlComponent c(&engine, testFileUrl("test-flipable.qml")); QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->front() != 0); - QVERIFY(obj->back() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->front() != nullptr); + QVERIFY(obj->back() != nullptr); delete obj; } @@ -83,9 +83,9 @@ void tst_qquickflipable::setFrontAndBack() QQmlComponent c(&engine, testFileUrl("test-flipable.qml")); QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->front() != 0); - QVERIFY(obj->back() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->front() != nullptr); + QVERIFY(obj->back() != nullptr); QString message = c.url().toString() + ":3:1: QML Flipable: front is a write-once property"; QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); @@ -102,7 +102,7 @@ void tst_qquickflipable::flipFlipable() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("flip-flipable.qml")); QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->side(), QQuickFlipable::Front); obj->setProperty("flipped", QVariant(true)); QTRY_COMPARE(obj->side(), QQuickFlipable::Back); @@ -116,7 +116,7 @@ void tst_qquickflipable::QTBUG_9161_crash() QQuickView *window = new QQuickView; window->setSource(testFileUrl("crash.qml")); QQuickItem *root = window->rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); window->show(); delete window; } @@ -126,7 +126,7 @@ void tst_qquickflipable::QTBUG_8474_qgv_abort() QQuickView *window = new QQuickView; window->setSource(testFileUrl("flipable-abort.qml")); QQuickItem *root = window->rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); window->show(); delete window; } diff --git a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp index d1f5f8b8d6..e59bb7266c 100644 --- a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp +++ b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp @@ -67,10 +67,10 @@ void tst_qquickfocusscope::basic() QQuickRectangle *item1 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item1")); QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2")); QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3")); - QVERIFY(item0 != 0); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); + QVERIFY(item0 != nullptr); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); view->show(); view->requestActivate(); @@ -111,11 +111,11 @@ void tst_qquickfocusscope::nested() QQuickFocusScope *item3 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item3")); QQuickFocusScope *item4 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item4")); QQuickFocusScope *item5 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item5")); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); - QVERIFY(item4 != 0); - QVERIFY(item5 != 0); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); + QVERIFY(item4 != nullptr); + QVERIFY(item5 != nullptr); view->show(); view->requestActivate(); @@ -140,10 +140,10 @@ void tst_qquickfocusscope::noFocus() QQuickRectangle *item1 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item1")); QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2")); QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3")); - QVERIFY(item0 != 0); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); + QVERIFY(item0 != nullptr); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); view->show(); view->requestActivate(); @@ -179,10 +179,10 @@ void tst_qquickfocusscope::textEdit() QQuickTextEdit *item1 = findItem<QQuickTextEdit>(view->rootObject(), QLatin1String("item1")); QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2")); QQuickTextEdit *item3 = findItem<QQuickTextEdit>(view->rootObject(), QLatin1String("item3")); - QVERIFY(item0 != 0); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); + QVERIFY(item0 != nullptr); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); view->show(); view->requestActivate(); @@ -231,12 +231,12 @@ void tst_qquickfocusscope::forceFocus() QQuickFocusScope *item3 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item3")); QQuickRectangle *item4 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item4")); QQuickRectangle *item5 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item5")); - QVERIFY(item0 != 0); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); - QVERIFY(item4 != 0); - QVERIFY(item5 != 0); + QVERIFY(item0 != nullptr); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); + QVERIFY(item4 != nullptr); + QVERIFY(item5 != nullptr); view->show(); view->requestActivate(); @@ -298,10 +298,10 @@ void tst_qquickfocusscope::signalEmission() QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2")); QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3")); QQuickRectangle *item4 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item4")); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); - QVERIFY(item4 != 0); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); + QVERIFY(item4 != nullptr); view->show(); view->requestActivate(); diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp index a38b62eb16..87a5bd469a 100644 --- a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp +++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp @@ -77,7 +77,7 @@ void tst_qquickfontloader::noFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QCOMPARE(fontObject->name(), QString("")); QCOMPARE(fontObject->source(), QUrl("")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Null); @@ -92,7 +92,7 @@ void tst_qquickfontloader::namedFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QCOMPARE(fontObject->source(), QUrl("")); QCOMPARE(fontObject->name(), QString("Helvetica")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); @@ -105,7 +105,7 @@ void tst_qquickfontloader::localFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); @@ -119,7 +119,7 @@ void tst_qquickfontloader::failLocalFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Error); @@ -133,7 +133,7 @@ void tst_qquickfontloader::webFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); @@ -149,7 +149,7 @@ void tst_qquickfontloader::redirWebFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); @@ -164,7 +164,7 @@ void tst_qquickfontloader::failWebFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Error); @@ -179,7 +179,7 @@ void tst_qquickfontloader::changeFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QSignalSpy nameSpy(fontObject, SIGNAL(nameChanged())); QSignalSpy statusSpy(fontObject, SIGNAL(statusChanged())); @@ -218,7 +218,7 @@ void tst_qquickfontloader::changeFontSourceViaState() QCOMPARE(&window, qGuiApp->focusWindow()); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(qvariant_cast<QObject *>(window.rootObject()->property("fontloader"))); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index fea90e9284..915b9b43ea 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -287,7 +287,7 @@ private: if (m_view) { if (QString(QTest::currentTestFunction()) != testForView) { delete m_view; - m_view = 0; + m_view = nullptr; } else { m_view->setSource(QUrl()); return m_view; @@ -316,7 +316,7 @@ private: QString testForView; }; -tst_QQuickGridView::tst_QQuickGridView() : m_view(0) +tst_QQuickGridView::tst_QQuickGridView() : m_view(nullptr) { } @@ -326,7 +326,7 @@ void tst_QQuickGridView::init() if (m_view && QString(QTest::currentTestFunction()) != testForView) { testForView = QString(); delete m_view; - m_view = 0; + m_view = nullptr; } #endif } @@ -336,7 +336,7 @@ void tst_QQuickGridView::cleanupTestCase() #ifdef SHARE_VIEWS testForView = QString(); delete m_view; - m_view = 0; + m_view = nullptr; #endif } @@ -360,10 +360,10 @@ void tst_QQuickGridView::items() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(gridview->count(), model.count()); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); @@ -371,10 +371,10 @@ void tst_QQuickGridView::items() for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -408,17 +408,17 @@ void tst_QQuickGridView::changed() qApp->processEvents(); QQuickFlickable *gridview = findItem<QQuickFlickable>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); model.modifyItem(1, "Will", "9876"); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); delete window; @@ -439,10 +439,10 @@ void tst_QQuickGridView::inserted_basic() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); model.insertItem(1, "Will", "9876"); @@ -450,10 +450,10 @@ void tst_QQuickGridView::inserted_basic() QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); // Checks that onAdd is called @@ -472,10 +472,10 @@ void tst_QQuickGridView::inserted_basic() QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); QTRY_COMPARE(gridview->currentIndex(), 1); @@ -526,9 +526,9 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); if (flow == QQuickGridView::FlowTopToBottom) { insertIndex = insertIndex_ttb; @@ -571,7 +571,7 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); } @@ -716,9 +716,9 @@ void tst_QQuickGridView::insertBeforeVisible() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); gridview->setCacheBuffer(cacheBuffer); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); @@ -756,7 +756,7 @@ void tst_QQuickGridView::insertBeforeVisible() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), (i/3)*60.0 + itemsOffsetAfterMove); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -800,19 +800,19 @@ void tst_QQuickGridView::removed_basic() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); model.removeItem(1); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); @@ -834,10 +834,10 @@ void tst_QQuickGridView::removed_basic() QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); @@ -913,7 +913,7 @@ void tst_QQuickGridView::removed_basic() model.removeItem(20); QTRY_COMPARE(gridview->currentIndex(), 20); - QTRY_VERIFY(gridview->currentItem() != 0); + QTRY_VERIFY(gridview->currentItem() != nullptr); // remove item before current, but visible gridview->setCurrentIndex(8); @@ -956,9 +956,9 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow, qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); if (flow == QQuickGridView::FlowTopToBottom) { removeIndex = removeIndex_ttb; @@ -997,7 +997,7 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow, QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -1173,9 +1173,9 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible() window->setSource(testFileUrl("gridview1.qml")); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0); QTRY_COMPARE(name->text(), QString("Item0")); @@ -1251,9 +1251,9 @@ void tst_QQuickGridView::clear() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); model.clear(); @@ -1269,7 +1269,7 @@ void tst_QQuickGridView::clear() model.addItem("New", "1"); gridview->forceLayout(); QTRY_COMPARE(gridview->count(), 1); - QVERIFY(gridview->currentItem() != 0); + QVERIFY(gridview->currentItem() != nullptr); QCOMPARE(gridview->currentIndex(), 0); delete window; @@ -1304,13 +1304,13 @@ void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow, qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *currentItem = gridview->currentItem(); - QTRY_VERIFY(currentItem != 0); + QTRY_VERIFY(currentItem != nullptr); if (flow == QQuickGridView::FlowTopToBottom) { from = from_ttb; @@ -1345,7 +1345,7 @@ void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow, QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); // current index should have been updated @@ -1559,7 +1559,7 @@ void tst_QQuickGridView::multipleChanges(bool condensed) qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); for (int i=0; i<changes.count(); i++) { @@ -1600,16 +1600,16 @@ void tst_QQuickGridView::multipleChanges(bool condensed) QQuickText *name; QQuickText *number; QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -1804,7 +1804,7 @@ void tst_QQuickGridView::swapWithFirstItem() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); // ensure content position is stable gridview->setContentY(0); @@ -1820,7 +1820,7 @@ void tst_QQuickGridView::currentIndex() for (int i = 0; i < 60; i++) initModel.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); window->show(); @@ -1833,11 +1833,11 @@ void tst_QQuickGridView::currentIndex() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QTRY_VERIFY(!QQuickItemPrivate::get(gridview)->polishScheduled); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); // currentIndex is initialized to 35 // currentItem should be in view @@ -1921,7 +1921,7 @@ void tst_QQuickGridView::noCurrentIndex() for (int i = 0; i < 60; i++) model.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -1933,9 +1933,9 @@ void tst_QQuickGridView::noCurrentIndex() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // current index should be -1 @@ -1977,7 +1977,7 @@ void tst_QQuickGridView::keyNavigation() QVERIFY(QTest::qWaitForWindowActive(window)); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); @@ -2183,10 +2183,10 @@ void tst_QQuickGridView::changeFlow() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // Confirm items positioned correctly and indexes correct int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); @@ -2197,10 +2197,10 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(item->x(), qreal((i%3)*80)); QTRY_COMPARE(item->y(), qreal((i/3)*60)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -2215,10 +2215,10 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(item->x(), qreal((i/5)*80)); QTRY_COMPARE(item->y(), qreal((i%5)*60)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -2233,10 +2233,10 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(item->x(), qreal(-(i/5)*80 - item->width())); QTRY_COMPARE(item->y(), qreal((i%5)*60)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } gridview->setContentX(100); @@ -2253,10 +2253,10 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(item->x(), qreal(240 - (i%3+1)*80)); QTRY_COMPARE(item->y(), qreal((i/3)*60)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -2269,7 +2269,7 @@ void tst_QQuickGridView::defaultValues() QQmlComponent c(&engine, testFileUrl("gridview3.qml")); QQuickGridView *obj = qobject_cast<QQuickGridView*>(c.create()); - QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj != nullptr); QTRY_COMPARE(obj->model(), QVariant()); QTRY_VERIFY(!obj->delegate()); QTRY_COMPARE(obj->currentIndex(), -1); @@ -2296,14 +2296,14 @@ void tst_QQuickGridView::properties() QQmlComponent c(&engine, testFileUrl("gridview2.qml")); QQuickGridView *obj = qobject_cast<QQuickGridView*>(c.create()); - QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj != nullptr); QTRY_VERIFY(obj->model() != QVariant()); - QTRY_VERIFY(obj->delegate() != 0); + QTRY_VERIFY(obj->delegate() != nullptr); QTRY_COMPARE(obj->currentIndex(), 0); - QTRY_VERIFY(obj->currentItem() != 0); + QTRY_VERIFY(obj->currentItem() != nullptr); QTRY_COMPARE(obj->count(), 4); - QTRY_VERIFY(obj->highlight() != 0); - QTRY_VERIFY(obj->highlightItem() != 0); + QTRY_VERIFY(obj->highlight() != nullptr); + QTRY_VERIFY(obj->highlightItem() != nullptr); QTRY_COMPARE(obj->highlightFollowsCurrentItem(), false); QTRY_COMPARE(obj->flow(), QQuickGridView::FlowLeftToRight); QTRY_COMPARE(obj->isWrapEnabled(), true); @@ -2488,9 +2488,9 @@ void tst_QQuickGridView::positionViewAtBeginningEnd() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // positionViewAtBeginning @@ -2575,9 +2575,9 @@ void tst_QQuickGridView::positionViewAtIndex() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); window->rootObject()->setProperty("enforceRange", enforceRange); @@ -2687,7 +2687,7 @@ void tst_QQuickGridView::snapping() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setHeight(220); QCOMPARE(gridview->height(), 220.); @@ -2716,12 +2716,12 @@ void tst_QQuickGridView::mirroring() QQuickView *windowA = createView(); windowA->setSource(testFileUrl("mirroring.qml")); QQuickGridView *gridviewA = findItem<QQuickGridView>(windowA->rootObject(), "view"); - QTRY_VERIFY(gridviewA != 0); + QTRY_VERIFY(gridviewA != nullptr); QQuickView *windowB = createView(); windowB->setSource(testFileUrl("mirroring.qml")); QQuickGridView *gridviewB = findItem<QQuickGridView>(windowB->rootObject(), "view"); - QTRY_VERIFY(gridviewA != 0); + QTRY_VERIFY(gridviewA != nullptr); qApp->processEvents(); QList<QString> objectNames; @@ -2788,16 +2788,16 @@ void tst_QQuickGridView::resetModel() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QTRY_COMPARE(gridview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i); - QTRY_VERIFY(display != 0); + QTRY_VERIFY(display != nullptr); QTRY_COMPARE(display->text(), strings.at(i)); } @@ -2809,7 +2809,7 @@ void tst_QQuickGridView::resetModel() for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i); - QTRY_VERIFY(display != 0); + QTRY_VERIFY(display != nullptr); QTRY_COMPARE(display->text(), strings.at(i)); } @@ -2832,10 +2832,10 @@ void tst_QQuickGridView::enforceRange() window->setSource(testFileUrl("gridview-enforcerange.qml")); window->show(); qApp->processEvents(); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QTRY_COMPARE(gridview->preferredHighlightBegin(), 100.0); QTRY_COMPARE(gridview->preferredHighlightEnd(), 100.0); @@ -2843,7 +2843,7 @@ void tst_QQuickGridView::enforceRange() QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // view should be positioned at the top of the range. QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); @@ -2851,10 +2851,10 @@ void tst_QQuickGridView::enforceRange() QTRY_COMPARE(gridview->contentY(), -100.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when contentItem moves @@ -2890,17 +2890,17 @@ void tst_QQuickGridView::enforceRange_rightToLeft() window->setSource(testFileUrl("gridview-enforcerange.qml")); window->show(); QTRY_VERIFY(window->isExposed()); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QCOMPARE(gridview->preferredHighlightBegin(), 100.0); QCOMPARE(gridview->preferredHighlightEnd(), 100.0); QCOMPARE(gridview->highlightRangeMode(), QQuickGridView::StrictlyEnforceRange); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); // view should be positioned at the top of the range. QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); @@ -2909,10 +2909,10 @@ void tst_QQuickGridView::enforceRange_rightToLeft() QTRY_COMPARE(gridview->contentY(), 0.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when contentItem moves @@ -2941,7 +2941,7 @@ void tst_QQuickGridView::QTBUG_8456() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QTRY_COMPARE(gridview->currentIndex(), 0); @@ -2958,10 +2958,10 @@ void tst_QQuickGridView::manualHighlight() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(gridview->currentIndex(), 0); QTRY_COMPARE(gridview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0)); @@ -3019,14 +3019,14 @@ void tst_QQuickGridView::footer() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *footer = findItem<QQuickText>(contentItem, "footer"); QVERIFY(footer); @@ -3079,7 +3079,7 @@ void tst_QQuickGridView::footer() // if header is toggled, it shouldn't affect the footer position window->rootObject()->setProperty("showHeader", true); - QVERIFY(findItem<QQuickItem>(contentItem, "header") != 0); + QVERIFY(findItem<QQuickItem>(contentItem, "header") != nullptr); QTRY_COMPARE(footer->position(), posWhenNoItems); window->rootObject()->setProperty("showHeader", false); @@ -3216,9 +3216,9 @@ void tst_QQuickGridView::initialZValues() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QVERIFY(gridview->currentItem()); QTRY_COMPARE(gridview->currentItem()->z(), gridview->property("itemZ").toReal()); @@ -3268,14 +3268,14 @@ void tst_QQuickGridView::header() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *header = findItem<QQuickText>(contentItem, "header"); QVERIFY(header); @@ -3345,7 +3345,7 @@ void tst_QQuickGridView::header() qApp->processEvents(); gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); @@ -3490,14 +3490,14 @@ void tst_QQuickGridView::extents() qApp->processEvents(); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickItem *header = findItem<QQuickItem>(contentItem, "header"); QVERIFY(header); @@ -3606,10 +3606,10 @@ void tst_QQuickGridView::resetModel_headerFooter() qApp->processEvents(); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickItem *header = findItem<QQuickItem>(contentItem, "header"); QVERIFY(header); @@ -3652,9 +3652,9 @@ void tst_QQuickGridView::resizeViewAndRepaint() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // item at index 10 should not be currently visible @@ -3728,9 +3728,9 @@ void tst_QQuickGridView::resizeGrid() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // set the width to slightly larger than 3 items across, to test // items are aligned correctly in right-to-left @@ -3753,7 +3753,7 @@ void tst_QQuickGridView::resizeGrid() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); } @@ -3785,7 +3785,7 @@ void tst_QQuickGridView::resizeGrid() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); } @@ -3862,9 +3862,9 @@ void tst_QQuickGridView::changeColumnCount() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // a single column of 6 items are visible @@ -3939,14 +3939,14 @@ void tst_QQuickGridView::indexAt_itemAt() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(gridview->count(), model.count()); - QQuickItem *item = 0; + QQuickItem *item = nullptr; if (index >= 0) { item = findItem<QQuickItem>(contentItem, "wrapper", index); QVERIFY(item); @@ -4078,7 +4078,7 @@ void tst_QQuickGridView::attachedProperties_QTBUG_32836() qApp->processEvents(); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *header = gridview->headerItem(); QVERIFY(header); @@ -4136,9 +4136,9 @@ void tst_QQuickGridView::margins() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QCOMPARE(gridview->contentX(), -30.); @@ -4199,10 +4199,10 @@ void tst_QQuickGridView::margins() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(gridview->contentX(), -240+50.); QTRY_COMPARE(gridview->originX(), -100. * 10); @@ -4319,7 +4319,7 @@ void tst_QQuickGridView::snapToRow() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); @@ -4327,7 +4327,7 @@ void tst_QQuickGridView::snapToRow() QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); qreal origContentY = gridview->contentY(); qreal origContentX = gridview->contentX(); @@ -4340,7 +4340,7 @@ void tst_QQuickGridView::snapToRow() // click to stop it. Otherwise we wouldn't know how much further it will go. We don't want to it // to hit the endExtent, yet. - QTest::mouseClick(window, Qt::LeftButton, 0, flickEnd); + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, flickEnd); QTRY_VERIFY(gridview->isMoving() == false); // wait until it stops if (flow == QQuickGridView::FlowLeftToRight) @@ -4426,7 +4426,7 @@ void tst_QQuickGridView::snapOneRow() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); @@ -4434,7 +4434,7 @@ void tst_QQuickGridView::snapOneRow() QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QSignalSpy currentIndexSpy(gridview, SIGNAL(currentIndexChanged())); @@ -4507,10 +4507,10 @@ void tst_QQuickGridView::unaligned() qApp->processEvents(); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); for (int i = 0; i < 10; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -4523,7 +4523,7 @@ void tst_QQuickGridView::unaligned() // appending for (int i = 10; i < 18; ++i) { model.addItem("Item" + QString::number(i), ""); - QQuickItem *item = 0; + QQuickItem *item = nullptr; QTRY_VERIFY(item = findItem<QQuickItem>(contentItem, "wrapper", i)); QCOMPARE(item->x(), qreal((i%9)*gridview->cellWidth())); QCOMPARE(item->y(), qreal((i/9)*gridview->cellHeight())); @@ -4532,7 +4532,7 @@ void tst_QQuickGridView::unaligned() // inserting for (int i = 0; i < 10; ++i) { model.insertItem(i, "Item" + QString::number(i), ""); - QQuickItem *item = 0; + QQuickItem *item = nullptr; QTRY_VERIFY(item = findItem<QQuickItem>(contentItem, "wrapper", i)); QCOMPARE(item->x(), qreal((i%9)*gridview->cellWidth())); QCOMPARE(item->y(), qreal((i/9)*gridview->cellHeight())); @@ -4543,7 +4543,7 @@ void tst_QQuickGridView::unaligned() gridview->forceLayout(); QTRY_COMPARE(model.count(), gridview->count()); for (int i = 0; i < 18; ++i) { - QQuickItem *item = 0; + QQuickItem *item = nullptr; QTRY_VERIFY(item = findItem<QQuickItem>(contentItem, "wrapper", i)); QCOMPARE(item->x(), qreal(i%9)*gridview->cellWidth()); QCOMPARE(item->y(), qreal(i/9)*gridview->cellHeight()); @@ -4605,7 +4605,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -4641,7 +4641,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -4659,7 +4659,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -4714,9 +4714,9 @@ void tst_QQuickGridView::addTransitions() window->show(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); if (contentYRowOffset != 0) { @@ -4795,7 +4795,7 @@ void tst_QQuickGridView::addTransitions() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); } @@ -4919,9 +4919,9 @@ void tst_QQuickGridView::moveTransitions() window->show(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name; if (contentYRowOffset != 0) { @@ -4993,7 +4993,7 @@ void tst_QQuickGridView::moveTransitions() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), (i/3)*60.0 + pixelOffset); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5164,9 +5164,9 @@ void tst_QQuickGridView::removeTransitions() window->show(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); if (contentYRowOffset != 0) { @@ -5247,7 +5247,7 @@ void tst_QQuickGridView::removeTransitions() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), gridview->contentY() + ((i-firstVisibleIndex)/3) * 60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5382,9 +5382,9 @@ void tst_QQuickGridView::displacedTransitions() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); @@ -5466,7 +5466,7 @@ void tst_QQuickGridView::displacedTransitions() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5601,9 +5601,9 @@ void tst_QQuickGridView::multipleTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); if (contentY != 0) { @@ -5688,7 +5688,7 @@ void tst_QQuickGridView::multipleTransitions() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5771,9 +5771,9 @@ void tst_QQuickGridView::multipleDisplaced() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); model.moveItems(12, 8, 1); @@ -5795,7 +5795,7 @@ void tst_QQuickGridView::multipleDisplaced() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5823,7 +5823,7 @@ void tst_QQuickGridView::regression_QTBUG_57225() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); model.removeItems(removeIndex, removeCount); @@ -5875,11 +5875,11 @@ void tst_QQuickGridView::cacheBuffer() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); - QVERIFY(gridview->delegate() != 0); + QVERIFY(contentItem != nullptr); + QVERIFY(gridview->delegate() != nullptr); QVERIFY(gridview->model() != 0); // Confirm items positioned correctly @@ -5898,8 +5898,8 @@ void tst_QQuickGridView::cacheBuffer() // items will be created one at a time for (int i = itemCount; i < qMin(itemCount+9,model.count()); ++i) { - QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -5933,11 +5933,11 @@ void tst_QQuickGridView::cacheBuffer() QTRY_COMPARE(item->y(), (i/3)*60.0); } - QVERIFY(findItem<QQuickItem>(gridview, "wrapper", 34) == 0); + QVERIFY(findItem<QQuickItem>(gridview, "wrapper", 34) == nullptr); // ensure buffered items are created for (int i = 34; i < qMin(44,model.count()); ++i) { - QQuickItem *item = 0; + QQuickItem *item = nullptr; while (!item) { qGuiApp->processEvents(); // allow refill to happen bool b = false; @@ -5966,7 +5966,7 @@ void tst_QQuickGridView::asynchronous() QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject()); QVERIFY(rootObject); - QQuickGridView *gridview = 0; + QQuickGridView *gridview = nullptr; while (!gridview) { bool b = false; controller.incubateWhile(&b); @@ -5975,8 +5975,8 @@ void tst_QQuickGridView::asynchronous() // items will be created one at a time for (int i = 0; i < 12; ++i) { - QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -6007,7 +6007,7 @@ void tst_QQuickGridView::unrequestedVisibility() for (int i = 0; i < 30; i++) model.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -6021,16 +6021,16 @@ void tst_QQuickGridView::unrequestedVisibility() qApp->processEvents(); QQuickGridView *leftview = findItem<QQuickGridView>(window->rootObject(), "leftGrid"); - QTRY_VERIFY(leftview != 0); + QTRY_VERIFY(leftview != nullptr); QQuickGridView *rightview = findItem<QQuickGridView>(window->rootObject(), "rightGrid"); - QTRY_VERIFY(rightview != 0); + QTRY_VERIFY(rightview != nullptr); QQuickItem *leftContent = leftview->contentItem(); - QTRY_VERIFY(leftContent != 0); + QTRY_VERIFY(leftContent != nullptr); QQuickItem *rightContent = rightview->contentItem(); - QTRY_VERIFY(rightContent != 0); + QTRY_VERIFY(rightContent != nullptr); rightview->setCurrentIndex(12); @@ -6445,10 +6445,10 @@ void tst_QQuickGridView::displayMargin() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = window->rootObject()->findChild<QQuickGridView*>(); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *content = gridview->contentItem(); - QVERIFY(content != 0); + QVERIFY(content != nullptr); QQuickItem *item0; QQuickItem *item97; @@ -6461,7 +6461,7 @@ void tst_QQuickGridView::displayMargin() QCOMPARE(delegateVisible(item97), true); // GridView staggers item creation, so the 118th item should be outside the end margin. - QVERIFY(findItem<QQuickItem>(content, "delegate", 117) == 0); + QVERIFY(findItem<QQuickItem>(content, "delegate", 117) == nullptr); // the first delegate should still be within the begin margin gridview->positionViewAtIndex(20, QQuickGridView::Beginning); @@ -6484,13 +6484,13 @@ void tst_QQuickGridView::negativeDisplayMargin() QQuickItem *listview = window->rootObject(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QTRY_COMPARE(gridview->property("createdItems").toInt(), 11); QCOMPARE(gridview->property("destroyedItem").toInt(), 0); QQuickItem *content = gridview->contentItem(); - QVERIFY(content != 0); + QVERIFY(content != nullptr); QVERIFY(item = findItem<QQuickItem>(content, "delegate", 0)); QCOMPARE(delegateVisible(item), true); @@ -6589,7 +6589,7 @@ void tst_QQuickGridView::contentHeightWithDelayRemove() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = window->rootObject()->findChild<QQuickGridView*>(); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); const int initialCount(gridview->count()); const int eventualCount(initialCount + countDelta); @@ -6620,7 +6620,7 @@ void tst_QQuickGridView::QTBUG_45640() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QCOMPARE(gridview->contentY(), qreal(-50.0)); @@ -6640,7 +6640,7 @@ void tst_QQuickGridView::QTBUG_49218() QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject()); QQuickGridView *gridview = qobject_cast<QQuickGridView *>(rootItem->childItems().first()); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); auto processEventsAndForceLayout = [&gridview] () { for (int pass = 0; pass < 2; ++pass) { @@ -6739,7 +6739,7 @@ void tst_QQuickGridView::QTBUG_48870_fastModelUpdates() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickGridView *view = findItem<QQuickGridView>(window->rootObject(), "view"); - QTRY_VERIFY(view != 0); + QTRY_VERIFY(view != nullptr); QQuickItemViewPrivate *priv = QQuickItemViewPrivate::get(view); bool nonUnique; diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index ec0ec6c2b6..9a93bf8892 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -116,7 +116,7 @@ void tst_qquickimage::noSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->source(), QUrl()); QCOMPARE(obj->status(), QQuickImage::Null); QCOMPARE(obj->width(), 0.); @@ -203,7 +203,7 @@ void tst_qquickimage::imageSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); if (async) QVERIFY(obj->asynchronous()); @@ -241,7 +241,7 @@ void tst_qquickimage::clearSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickImage::Ready); QCOMPARE(obj->width(), 120.); QCOMPARE(obj->height(), 120.); @@ -263,7 +263,7 @@ void tst_qquickimage::resized() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->fillMode(), QQuickImage::Stretch); @@ -273,13 +273,13 @@ void tst_qquickimage::resized() void tst_qquickimage::preserveAspectRatio() { - QScopedPointer<QQuickView> window(new QQuickView(0)); + QScopedPointer<QQuickView> window(new QQuickView(nullptr)); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); window->setSource(testFileUrl("aspectratio.qml")); QQuickImage *image = qobject_cast<QQuickImage*>(window->rootObject()); - QVERIFY(image != 0); + QVERIFY(image != nullptr); image->setWidth(80.0); QCOMPARE(image->width(), 80.); QCOMPARE(image->height(), 80.); @@ -287,7 +287,7 @@ void tst_qquickimage::preserveAspectRatio() window->setSource(testFileUrl("aspectratio.qml")); image = qobject_cast<QQuickImage*>(window->rootObject()); image->setHeight(60.0); - QVERIFY(image != 0); + QVERIFY(image != nullptr); QCOMPARE(image->height(), 60.); QCOMPARE(image->width(), 60.); } @@ -298,7 +298,7 @@ void tst_qquickimage::smooth() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->smooth(), true); @@ -327,7 +327,7 @@ void tst_qquickimage::mirror() window->setSource(testFileUrl("mirror.qml")); QQuickImage *obj = window->rootObject()->findChild<QQuickImage*>("image"); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); obj->setFillMode(fillMode); obj->setProperty("mirror", true); @@ -411,7 +411,7 @@ void tst_qquickimage::svg() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.0); QCOMPARE(obj->height(), 300.0); obj->setSourceSize(QSize(200,200)); @@ -486,7 +486,7 @@ void tst_qquickimage::geometry() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), itemWidth); QCOMPARE(obj->paintedWidth(), paintedWidth); @@ -509,7 +509,7 @@ void tst_qquickimage::big() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 100.0); QCOMPARE(obj->height(), 256.0); @@ -530,7 +530,7 @@ void tst_qquickimage::tiling_QTBUG_6716() QQuickImage *tiling = findItem<QQuickImage>(view.rootObject(), "tiling"); - QVERIFY(tiling != 0); + QVERIFY(tiling != nullptr); QImage img = view.grabWindow(); for (int x = 0; x < tiling->width(); ++x) { for (int y = 0; y < tiling->height(); ++y) { @@ -561,7 +561,7 @@ void tst_qquickimage::noLoading() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickImage::Ready); QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(QUrl))); @@ -608,7 +608,7 @@ void tst_qquickimage::paintedWidthHeight() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 200.0); QCOMPARE(obj->height(), 25.0); QCOMPARE(obj->paintedWidth(), 25.0); @@ -623,7 +623,7 @@ void tst_qquickimage::paintedWidthHeight() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 26.0); QCOMPARE(obj->height(), 175.0); QCOMPARE(obj->paintedWidth(), 26.0); @@ -644,7 +644,7 @@ void tst_qquickimage::sourceSize_QTBUG_14303() QSignalSpy sourceSizeSpy(obj, SIGNAL(sourceSizeChanged())); - QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj != nullptr); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->sourceSize().width(), 200); @@ -666,7 +666,7 @@ void tst_qquickimage::sourceSize_QTBUG_14303() void tst_qquickimage::sourceSize_QTBUG_16389() { - QScopedPointer<QQuickView> window(new QQuickView(0)); + QScopedPointer<QQuickView> window(new QQuickView(nullptr)); window->setSource(testFileUrl("qtbug_16389.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); @@ -690,7 +690,7 @@ void tst_qquickimage::sourceSize_QTBUG_16389() // QTBUG-15690 void tst_qquickimage::nullPixmapPaint() { - QScopedPointer<QQuickView> window(new QQuickView(0)); + QScopedPointer<QQuickView> window(new QQuickView(nullptr)); window->setSource(testFileUrl("nullpixmap.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); @@ -700,7 +700,7 @@ void tst_qquickimage::nullPixmapPaint() server.serveDirectory(dataDirectory(), TestHTTPServer::Delay); QQuickImage *image = qobject_cast<QQuickImage*>(window->rootObject()); - QTRY_VERIFY(image != 0); + QTRY_VERIFY(image != nullptr); image->setSource(server.url("/no-such-file.png")); QQmlTestMessageHandler messageHandler; @@ -730,7 +730,7 @@ void tst_qquickimage::imageCrash_QTBUG_22125() // shouldn't crash when deleting cancelled QQmlPixmapReplys. server.sendDelayedItem(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } @@ -763,7 +763,7 @@ void tst_qquickimage::sourceSize() QFETCH(qreal, implicitWidth); QFETCH(qreal, implicitHeight); - QScopedPointer<QQuickView> window(new QQuickView(0)); + QScopedPointer<QQuickView> window(new QQuickView(nullptr)); QQmlContext *ctxt = window->rootContext(); ctxt->setContextProperty("srcWidth", sourceWidth); ctxt->setContextProperty("srcHeight", sourceHeight); @@ -794,7 +794,7 @@ void tst_qquickimage::sourceSizeChanges() QQmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", ""); QQuickImage *img = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(img != 0); + QVERIFY(img != nullptr); QSignalSpy sourceSizeSpy(img, SIGNAL(sourceSizeChanged())); @@ -860,7 +860,7 @@ void tst_qquickimage::progressAndStatusChanges() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); @@ -977,7 +977,7 @@ void tst_qquickimage::highdpi() ctxt->setContextProperty("srcImage", testFileUrl("heart-highdpi@2x.png")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 150.0); QCOMPARE(obj->height(), 150.0); diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp index 98f3972cef..4298bc198b 100644 --- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp +++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp @@ -76,7 +76,7 @@ private: class TestQImageProvider : public QQuickImageProvider { public: - TestQImageProvider(bool *deleteWatch = 0, bool forceAsync = false) + TestQImageProvider(bool *deleteWatch = nullptr, bool forceAsync = false) : QQuickImageProvider(Image, (forceAsync ? ForceAsynchronousImageLoading : Flags())) , deleteWatch(deleteWatch) { @@ -114,7 +114,7 @@ Q_DECLARE_METATYPE(TestQImageProvider*); class TestQPixmapProvider : public QQuickImageProvider { public: - TestQPixmapProvider(bool *deleteWatch = 0) + TestQPixmapProvider(bool *deleteWatch = nullptr) : QQuickImageProvider(Pixmap), deleteWatch(deleteWatch) { } @@ -217,7 +217,7 @@ void tst_qquickimageprovider::runTest(bool async, QQuickImageProvider *provider) QQmlEngine engine; engine.addImageProvider("test", provider); - QVERIFY(engine.imageProvider("test") != 0); + QVERIFY(engine.imageProvider("test") != nullptr); QString componentStr = "import QtQuick 2.0\nImage { source: \"" + source + "\"; " + (async ? "asynchronous: true; " : "") @@ -225,7 +225,7 @@ void tst_qquickimageprovider::runTest(bool async, QQuickImageProvider *provider) QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); // From this point on, treat forced async providers as async behaviour-wise if (engine.imageProvider(QUrl(source).host()) == provider) @@ -314,14 +314,14 @@ void tst_qquickimageprovider::requestPixmap_async() QQuickImageProvider *provider = new TestQPixmapProvider(); engine.addImageProvider("test", provider); - QVERIFY(engine.imageProvider("test") != 0); + QVERIFY(engine.imageProvider("test") != nullptr); // pixmaps are loaded synchronously regardless of 'asynchronous' value QString componentStr = "import QtQuick 2.0\nImage { asynchronous: true; source: \"image://test/pixmap-async-test.png\" }"; QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); delete obj; } @@ -341,14 +341,14 @@ void tst_qquickimageprovider::removeProvider() QQmlEngine engine; engine.addImageProvider("test", provider); - QVERIFY(engine.imageProvider("test") != 0); + QVERIFY(engine.imageProvider("test") != nullptr); // add provider, confirm it works QString componentStr = "import QtQuick 2.0\nImage { source: \"" + newImageFileName() + "\" }"; QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickImage::Ready); @@ -384,7 +384,7 @@ void tst_qquickimageprovider::imageProviderId() TestQImageProvider *provider = new TestQImageProvider(&deleteWatch); engine.addImageProvider(providerId, provider); - QVERIFY(engine.imageProvider(providerId) != 0); + QVERIFY(engine.imageProvider(providerId) != nullptr); engine.removeImageProvider(providerId); QVERIFY(deleteWatch); @@ -428,7 +428,7 @@ void tst_qquickimageprovider::threadTest() TestThreadProvider *provider = new TestThreadProvider; engine.addImageProvider("test_thread", provider); - QVERIFY(engine.imageProvider("test_thread") != 0); + QVERIFY(engine.imageProvider("test_thread") != nullptr); QString componentStr = "import QtQuick 2.0\nItem { \n" "Image { source: \"image://test_thread/blue\"; asynchronous: true; }\n" @@ -440,7 +440,7 @@ void tst_qquickimageprovider::threadTest() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QObject *obj = component.create(); //MUST not deadlock - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QList<QQuickImage *> images = obj->findChildren<QQuickImage *>(); QCOMPARE(images.count(), 4); QTest::qWait(100); @@ -459,7 +459,7 @@ class TestImageResponse : public QQuickImageResponse, public QRunnable { public: TestImageResponse(QMutex *lock, QWaitCondition *condition, bool *ok, const QString &id, const QSize &requestedSize) - : m_lock(lock), m_condition(condition), m_ok(ok), m_id(id), m_requestedSize(requestedSize), m_texture(0) + : m_lock(lock), m_condition(condition), m_ok(ok), m_id(id), m_requestedSize(requestedSize), m_texture(nullptr) { setAutoDelete(false); } @@ -523,7 +523,7 @@ void tst_qquickimageprovider::asyncTextureTest() TestAsyncProvider *provider = new TestAsyncProvider; engine.addImageProvider("test_async", provider); - QVERIFY(engine.imageProvider("test_async") != 0); + QVERIFY(engine.imageProvider("test_async") != nullptr); QString componentStr = "import QtQuick 2.0\nItem { \n" "Image { source: \"image://test_async/blue\"; }\n" @@ -535,7 +535,7 @@ void tst_qquickimageprovider::asyncTextureTest() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QObject *obj = component.create(); //MUST not deadlock - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QList<QQuickImage *> images = obj->findChildren<QQuickImage *>(); QCOMPARE(images.count(), 4); diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index c2ae667d2b..ee9d36560d 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -50,7 +50,7 @@ class TestItem : public QQuickItem { Q_OBJECT public: - TestItem(QQuickItem *parent = 0) + TestItem(QQuickItem *parent = nullptr) : QQuickItem(parent), focused(false), pressCount(0), releaseCount(0) , wheelCount(0), acceptIncomingTouchEvents(true) , touchEventReached(false), timestamp(0) @@ -105,7 +105,7 @@ class TestPolishItem : public QQuickItem { Q_OBJECT public: - TestPolishItem(QQuickItem *parent = 0) + TestPolishItem(QQuickItem *parent = nullptr) : QQuickItem(parent), wasPolished(false) { } @@ -127,7 +127,7 @@ class TestFocusScope : public QQuickFocusScope { Q_OBJECT public: - TestFocusScope(QQuickItem *parent = 0) : QQuickFocusScope(parent), focused(false) {} + TestFocusScope(QQuickItem *parent = nullptr) : QQuickFocusScope(parent), focused(false) {} bool focused; protected: @@ -264,7 +264,7 @@ struct FocusData { }; struct FocusState : public QHash<QQuickItem *, FocusData> { - FocusState() : activeFocusItem(0) {} + FocusState() : activeFocusItem(nullptr) {} FocusState &operator<<(QQuickItem *item) { insert(item, FocusData()); return *this; @@ -338,7 +338,7 @@ void tst_qquickitem::simpleFocus() l1c3->setFocus(false); focusState[l1c3].set(false, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); l2c1->setFocus(true); @@ -611,9 +611,9 @@ void tst_qquickitem::changeParent() focusState.active(child); FVERIFY(); - child->setParentItem(0); + child->setParentItem(nullptr); focusState[child].set(true, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); } @@ -658,7 +658,7 @@ void tst_qquickitem::changeParent() item->setParentItem(child2); focusState[item].set(true, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); } { @@ -675,7 +675,7 @@ void tst_qquickitem::changeParent() item->setFocus(true); focusState[item].set(true, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); item->setParentItem(child); @@ -728,10 +728,10 @@ void tst_qquickitem::changeParent() focusState.active(child); FVERIFY(); - item->setParentItem(0); + item->setParentItem(nullptr); focusState[child].set(true, false); focusState[item].set(true, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); focusState.remove(child); @@ -951,7 +951,7 @@ void tst_qquickitem::setParentItem() QCOMPARE(root->childItems().at(0), child1); QCOMPARE(root->childItems().at(1), child2); - child1->setParentItem(0); + child1->setParentItem(nullptr); QVERIFY(!child1->parent()); QVERIFY(!child1->parentItem()); QCOMPARE(root->childItems().count(), 1); @@ -1238,56 +1238,56 @@ void tst_qquickitem::mouseGrab() child2->setSize(QSizeF(200, 100)); child2->setParentItem(window.contentItem()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(100); QVERIFY2(window.mouseGrabberItem() == child1.data(), msgItem(window.mouseGrabberItem()).constData()); QTest::qWait(100); QCOMPARE(child1->pressCount, 1); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); - QVERIFY2(window.mouseGrabberItem() == 0, msgItem(window.mouseGrabberItem()).constData()); + QVERIFY2(window.mouseGrabberItem() == nullptr, msgItem(window.mouseGrabberItem()).constData()); QCOMPARE(child1->releaseCount, 1); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QVERIFY2(window.mouseGrabberItem() == child1.data(), msgItem(window.mouseGrabberItem()).constData()); QCOMPARE(child1->pressCount, 2); child1->setEnabled(false); - QVERIFY2(window.mouseGrabberItem() == 0, msgItem(window.mouseGrabberItem()).constData()); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QVERIFY2(window.mouseGrabberItem() == nullptr, msgItem(window.mouseGrabberItem()).constData()); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QCOMPARE(child1->releaseCount, 1); child1->setEnabled(true); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QVERIFY2(window.mouseGrabberItem() == child1.data(), msgItem(window.mouseGrabberItem()).constData()); QCOMPARE(child1->pressCount, 3); child1->setVisible(false); - QVERIFY2(window.mouseGrabberItem() == 0, msgItem(window.mouseGrabberItem())); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QVERIFY2(window.mouseGrabberItem() == nullptr, msgItem(window.mouseGrabberItem())); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QCOMPARE(child1->releaseCount, 1); child1->setVisible(true); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QVERIFY2(window.mouseGrabberItem() == child1.data(), msgItem(window.mouseGrabberItem()).constData()); QCOMPARE(child1->pressCount, 4); child2->grabMouse(); QVERIFY2(window.mouseGrabberItem() == child2.data(), msgItem(window.mouseGrabberItem()).constData()); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QCOMPARE(child1->releaseCount, 1); QCOMPARE(child2->releaseCount, 1); child2->grabMouse(); QVERIFY2(window.mouseGrabberItem() == child2.data(), msgItem(window.mouseGrabberItem()).constData()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QCOMPARE(child1->pressCount, 4); QCOMPARE(child2->pressCount, 1); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QCOMPARE(child1->releaseCount, 1); QCOMPARE(child2->releaseCount, 2); @@ -1315,7 +1315,7 @@ void tst_qquickitem::touchEventAcceptIgnore() item->setParentItem(window.contentItem()); item->acceptIncomingTouchEvents = itemSupportsTouch; - static QTouchDevice* device = 0; + static QTouchDevice* device = nullptr; if (!device) { device =new QTouchDevice; device->setType(QTouchDevice::TouchScreen); @@ -1483,7 +1483,7 @@ class HoverItem : public QQuickItem { Q_OBJECT public: - HoverItem(QQuickItem *parent = 0) + HoverItem(QQuickItem *parent = nullptr) : QQuickItem(parent), hoverEnterCount(0), hoverMoveCount(0), hoverLeaveCount(0) { } void resetCounters() { @@ -1529,7 +1529,7 @@ void tst_qquickitem::hoverEvent_data() // ### For some unknown reason QTest::mouseMove() isn't working correctly. static void sendMouseMove(QObject *object, const QPoint &position) { - QMouseEvent moveEvent(QEvent::MouseMove, position, Qt::NoButton, Qt::NoButton, 0); + QMouseEvent moveEvent(QEvent::MouseMove, position, Qt::NoButton, Qt::NoButton, nullptr); QGuiApplication::sendEvent(object, &moveEvent); } @@ -1745,54 +1745,54 @@ void tst_qquickitem::acceptedMouseButtons() item.setSize(QSizeF(200,100)); item.setParentItem(window.contentItem()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 0); QCOMPARE(item.releaseCount, 0); - QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 0); QCOMPARE(item.releaseCount, 0); - QTest::mousePress(&window, Qt::MiddleButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::MiddleButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 0); QCOMPARE(item.releaseCount, 0); item.setAcceptedMouseButtons(Qt::LeftButton); QCOMPARE(item.acceptedMouseButtons(), Qt::MouseButtons(Qt::LeftButton)); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); - QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); - QTest::mousePress(&window, Qt::MiddleButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::MiddleButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); item.setAcceptedMouseButtons(Qt::RightButton | Qt::MiddleButton); QCOMPARE(item.acceptedMouseButtons(), Qt::MouseButtons(Qt::RightButton | Qt::MiddleButton)); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); - QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 2); QCOMPARE(item.releaseCount, 2); - QTest::mousePress(&window, Qt::MiddleButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::MiddleButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 3); QCOMPARE(item.releaseCount, 3); } @@ -1800,7 +1800,7 @@ void tst_qquickitem::acceptedMouseButtons() static void gc(QQmlEngine &engine) { engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } @@ -1826,7 +1826,7 @@ void tst_qquickitem::visualParentOwnership() gc(engine); QVERIFY(!newItem.isNull()); - newItem->setParentItem(0); + newItem->setParentItem(nullptr); gc(engine); QVERIFY(newItem.isNull()); @@ -1883,7 +1883,7 @@ void tst_qquickitem::visualParentOwnershipWindow() gc(engine); QVERIFY(!newItem.isNull()); - newItem->setParentItem(0); + newItem->setParentItem(nullptr); gc(engine); QVERIFY(newItem.isNull()); @@ -2059,10 +2059,10 @@ void tst_qquickitem::ignoreButtonPressNotInAcceptedMouseButtons() item.setAcceptedMouseButtons(Qt::LeftButton); QCOMPARE(item.acceptedMouseButtons(), Qt::MouseButtons(Qt::LeftButton)); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50)); - QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50)); // ignored because it's not LeftButton - QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50)); // ignored because it didn't grab the RightButton press - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mousePress(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); // ignored because it's not LeftButton + QTest::mouseRelease(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); // ignored because it didn't grab the RightButton press + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); @@ -2131,9 +2131,9 @@ void tst_qquickitem::qtBug60123() auto activateWindowAndTestPress = [] (QQuickView* testWindow) { testWindow->requestActivate(); QTest::qWaitForWindowActive(testWindow); - QTest::mousePress(testWindow, Qt::LeftButton, 0, QPoint(10, 10)); + QTest::mousePress(testWindow, Qt::LeftButton, Qt::NoModifier, QPoint(10, 10)); QCOMPARE(testWindow->rootObject()->property("lastEvent").toString(), QString("pressed")); - QTest::mouseRelease(testWindow, Qt::LeftButton, 0, QPoint(10, 10)); + QTest::mouseRelease(testWindow, Qt::LeftButton, Qt::NoModifier, QPoint(10, 10)); QCOMPARE(testWindow->rootObject()->property("lastEvent").toString(), QString("released")); }; diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index af4ee41824..0f4850d4a7 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -193,7 +193,7 @@ class KeyTestItem : public QQuickItem { Q_OBJECT public: - KeyTestItem(QQuickItem *parent=0) : QQuickItem(parent), mKey(0) {} + KeyTestItem(QQuickItem *parent=nullptr) : QQuickItem(parent), mKey(0) {} protected: void keyPressEvent(QKeyEvent *e) { @@ -240,7 +240,7 @@ class HollowTestItem : public QQuickItem Q_PROPERTY(qreal holeRadius READ holeRadius WRITE setHoleRadius) public: - HollowTestItem(QQuickItem *parent = 0) + HollowTestItem(QQuickItem *parent = nullptr) : QQuickItem(parent), m_isPressed(false), m_isHovered(false), @@ -343,7 +343,7 @@ void tst_QQuickItem::initTestCase() void tst_QQuickItem::cleanup() { QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); - inputMethodPrivate->testContext = 0; + inputMethodPrivate->testContext = nullptr; } void tst_QQuickItem::activeFocusOnTab() @@ -351,7 +351,7 @@ void tst_QQuickItem::activeFocusOnTab() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab.qml")); @@ -463,7 +463,7 @@ void tst_QQuickItem::activeFocusOnTab2() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab.qml")); @@ -503,7 +503,7 @@ void tst_QQuickItem::activeFocusOnTab3() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab3.qml")); @@ -685,7 +685,7 @@ void tst_QQuickItem::activeFocusOnTab4() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab4.qml")); @@ -717,7 +717,7 @@ void tst_QQuickItem::activeFocusOnTab5() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab4.qml")); @@ -751,7 +751,7 @@ void tst_QQuickItem::activeFocusOnTab6() if (qt_tab_all_widgets()) QSKIP("This function doesn't support iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab6.qml")); @@ -809,7 +809,7 @@ void tst_QQuickItem::activeFocusOnTab7() if (qt_tab_all_widgets()) QSKIP("This function doesn't support iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300,300)); window->setSource(testFileUrl("activeFocusOnTab7.qml")); @@ -842,7 +842,7 @@ void tst_QQuickItem::activeFocusOnTab7() void tst_QQuickItem::activeFocusOnTab8() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300,300)); window->setSource(testFileUrl("activeFocusOnTab8.qml")); @@ -894,7 +894,7 @@ void tst_QQuickItem::activeFocusOnTab9() if (qt_tab_all_widgets()) QSKIP("This function doesn't support iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300,300)); window->setSource(testFileUrl("activeFocusOnTab9.qml")); @@ -945,7 +945,7 @@ void tst_QQuickItem::activeFocusOnTab10() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300,300)); window->setSource(testFileUrl("activeFocusOnTab9.qml")); @@ -1028,7 +1028,7 @@ void tst_QQuickItem::nextItemInFocusChain() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab.qml")); @@ -1104,7 +1104,7 @@ void tst_QQuickItem::nextItemInFocusChain2() if (qt_tab_all_widgets()) QSKIP("This function doesn't support iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab6.qml")); @@ -1149,7 +1149,7 @@ void tst_QQuickItem::nextItemInFocusChain2() void tst_QQuickItem::nextItemInFocusChain3() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("nextItemInFocusChain3.qml")); @@ -1177,7 +1177,7 @@ void verifyTabFocusChain(QQuickView *window, const char **focusChain, bool forwa void tst_QQuickItem::tabFence() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("tabFence.qml")); @@ -1216,7 +1216,7 @@ void tst_QQuickItem::tabFence() void tst_QQuickItem::qtbug_50516() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("qtbug_50516.qml")); @@ -1261,7 +1261,7 @@ void tst_QQuickItem::qtbug_50516_2() QFETCH(QString, item1); QFETCH(QString, item2); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl(filename)); @@ -1282,7 +1282,7 @@ void tst_QQuickItem::qtbug_50516_2() void tst_QQuickItem::keys() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); KeysTestObject *testObject = new KeysTestObject; @@ -1471,7 +1471,7 @@ void tst_QQuickItem::standardKeys() void tst_QQuickItem::keysProcessingOrder() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); KeysTestObject *testObject = new KeysTestObject; @@ -1532,7 +1532,7 @@ void tst_QQuickItem::keysim() QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); inputMethodPrivate->testContext = &platformInputContext; - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keysim.qml")); @@ -1650,7 +1650,7 @@ bool anchorsMirrored(QQuickItem *rootItem, const char * itemString) void tst_QQuickItem::layoutMirroring() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("layoutmirroring.qml")); window->show(); @@ -1801,7 +1801,7 @@ void tst_QQuickItem::layoutMirroringIllegalParent() component.setData("import QtQuick 2.0; QtObject { LayoutMirroring.enabled: true; LayoutMirroring.childrenInherit: true }", QUrl::fromLocalFile("")); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:1:21: QML QtObject: LayoutDirection attached property only works with Items and Windows"); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_QQuickItem::keyNavigation_data() @@ -1815,7 +1815,7 @@ void tst_QQuickItem::keyNavigation() { QFETCH(QString, source); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl(source)); @@ -1892,7 +1892,7 @@ void tst_QQuickItem::keyNavigation() void tst_QQuickItem::keyNavigation_RightToLeft() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keynavigationtest.qml")); @@ -1947,7 +1947,7 @@ void tst_QQuickItem::keyNavigation_RightToLeft() void tst_QQuickItem::keyNavigation_skipNotVisible() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keynavigationtest.qml")); @@ -2022,7 +2022,7 @@ void tst_QQuickItem::keyNavigation_skipNotVisible() void tst_QQuickItem::keyNavigation_implicitSetting() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keynavigationtest_implicit.qml")); @@ -2149,7 +2149,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting() void tst_QQuickItem::keyNavigation_focusReason() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); FocusEventFilter focusEventFilter; @@ -2210,7 +2210,7 @@ void tst_QQuickItem::keyNavigation_focusReason() void tst_QQuickItem::keyNavigation_loop() { // QTBUG-47229 - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keynavigationtest_loop.qml")); @@ -2325,18 +2325,18 @@ void tst_QQuickItem::mapCoordinates() QFETCH(int, x); QFETCH(int, y); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300, 300)); window->setSource(testFileUrl("mapCoordinates.qml")); window->show(); qApp->processEvents(); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickItem *a = findItem<QQuickItem>(window->rootObject(), "itemA"); - QVERIFY(a != 0); + QVERIFY(a != nullptr); QQuickItem *b = findItem<QQuickItem>(window->rootObject(), "itemB"); - QVERIFY(b != 0); + QVERIFY(b != nullptr); QVariant result; @@ -2396,18 +2396,18 @@ void tst_QQuickItem::mapCoordinatesRect() QFETCH(int, width); QFETCH(int, height); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300, 300)); window->setSource(testFileUrl("mapCoordinatesRect.qml")); window->show(); qApp->processEvents(); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickItem *a = findItem<QQuickItem>(window->rootObject(), "itemA"); - QVERIFY(a != 0); + QVERIFY(a != nullptr); QQuickItem *b = findItem<QQuickItem>(window->rootObject(), "itemB"); - QVERIFY(b != 0); + QVERIFY(b != nullptr); QVariant result; @@ -2478,7 +2478,7 @@ void tst_QQuickItem::transforms() component.setData("import QtQuick 2.3\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(item->itemTransform(0,0), transform); + QCOMPARE(item->itemTransform(nullptr,nullptr), transform); } void tst_QQuickItem::childrenProperty() @@ -2486,7 +2486,7 @@ void tst_QQuickItem::childrenProperty() QQmlComponent component(&engine, testFileUrl("childrenProperty.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); @@ -2501,7 +2501,7 @@ void tst_QQuickItem::resourcesProperty() QQmlComponent component(&engine, testFileUrl("resourcesProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlProperty property(object, "resources", component.creationContext()); @@ -2533,7 +2533,7 @@ void tst_QQuickItem::resourcesProperty() void tst_QQuickItem::propertyChanges() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300, 300)); window->setSource(testFileUrl("propertychanges.qml")); window->show(); @@ -2624,7 +2624,7 @@ void tst_QQuickItem::nonexistentPropertyConnection() void tst_QQuickItem::childrenRect() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("childrenRect.qml")); window->setBaseSize(QSize(240,320)); window->show(); @@ -2653,7 +2653,7 @@ void tst_QQuickItem::childrenRect() // QTBUG-11383 void tst_QQuickItem::childrenRectBug() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); QString warning = testFileUrl("childrenRectBug.qml").toString() + ":7:5: QML Item: Binding loop detected for property \"height\""; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); @@ -2674,7 +2674,7 @@ void tst_QQuickItem::childrenRectBug() // QTBUG-11465 void tst_QQuickItem::childrenRectBug2() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); QString warning1 = testFileUrl("childrenRectBug2.qml").toString() + ":7:5: QML Item: Binding loop detected for property \"width\""; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); @@ -2708,7 +2708,7 @@ void tst_QQuickItem::childrenRectBug2() // QTBUG-12722 void tst_QQuickItem::childrenRectBug3() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("childrenRectBug3.qml")); window->show(); @@ -2719,7 +2719,7 @@ void tst_QQuickItem::childrenRectBug3() // QTBUG-38732 void tst_QQuickItem::childrenRectBottomRightCorner() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("childrenRectBottomRightCorner.qml")); window->show(); @@ -2994,7 +2994,7 @@ void tst_QQuickItem::changeListener() // QTBUG-13893 void tst_QQuickItem::transformCrash() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("transformCrash.qml")); window->show(); @@ -3003,7 +3003,7 @@ void tst_QQuickItem::transformCrash() void tst_QQuickItem::implicitSize() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("implicitsize.qml")); window->show(); @@ -3076,14 +3076,14 @@ void tst_QQuickItem::qtbug_16871() { QQmlComponent component(&engine, testFileUrl("qtbug_16871.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; } void tst_QQuickItem::visibleChildren() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("visiblechildren.qml")); window->show(); @@ -3141,7 +3141,7 @@ void tst_QQuickItem::visibleChildren() void tst_QQuickItem::parentLoop() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); #if QT_CONFIG(regularexpression) QRegularExpression msgRegexp = QRegularExpression("QQuickItem::setParentItem: Parent QQuickItem\\(.*\\) is already part of the subtree of QQuickItem\\(.*\\)"); @@ -3231,7 +3231,7 @@ void tst_QQuickItem::contains() QFETCH(bool, insideTarget); QFETCH(QList<QPoint>, points); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->rootContext()->setContextProperty("circleShapeTest", circleTest); window->setBaseSize(QSize(400, 400)); window->setSource(testFileUrl("hollowTestItem.qml")); @@ -3253,12 +3253,12 @@ void tst_QQuickItem::contains() QCOMPARE(hollowItem->isHovered(), insideTarget); // check mouse press - QTest::mousePress(window, Qt::LeftButton, 0, point); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, point); QTest::qWait(10); QCOMPARE(hollowItem->isPressed(), insideTarget); // check mouse release - QTest::mouseRelease(window, Qt::LeftButton, 0, point); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, point); QTest::qWait(10); QCOMPARE(hollowItem->isPressed(), false); } @@ -3299,8 +3299,8 @@ void tst_QQuickItem::childAt() QCOMPARE(parent.childAt(75, 75), &child2); QCOMPARE(parent.childAt(149, 149), &child2); QCOMPARE(parent.childAt(25, 200), &child3); - QCOMPARE(parent.childAt(0, 150), static_cast<QQuickItem *>(0)); - QCOMPARE(parent.childAt(300, 300), static_cast<QQuickItem *>(0)); + QCOMPARE(parent.childAt(0, 150), static_cast<QQuickItem *>(nullptr)); + QCOMPARE(parent.childAt(300, 300), static_cast<QQuickItem *>(nullptr)); } void tst_QQuickItem::grab() diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 8118cf615a..8bc5575e34 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -294,7 +294,7 @@ private: if (m_view) { if (QString(QTest::currentTestFunction()) != testForView) { delete m_view; - m_view = 0; + m_view = nullptr; } else { m_view->setSource(QUrl()); return m_view; @@ -332,7 +332,7 @@ class TestObject : public QObject Q_PROPERTY(int cacheBuffer READ cacheBuffer NOTIFY changedCacheBuffer) public: - TestObject(QObject *parent = 0) + TestObject(QObject *parent = nullptr) : QObject(parent), mError(true), mAnimate(false), mInvalidHighlight(false) , mCacheBuffer(0) {} @@ -361,7 +361,7 @@ public: int mCacheBuffer; }; -tst_QQuickListView::tst_QQuickListView() : m_view(0) +tst_QQuickListView::tst_QQuickListView() : m_view(nullptr) { } @@ -371,7 +371,7 @@ void tst_QQuickListView::init() if (m_view && QString(QTest::currentTestFunction()) != testForView) { testForView = QString(); delete m_view; - m_view = 0; + m_view = nullptr; } #endif qmlRegisterType<QAbstractItemModel>(); @@ -384,7 +384,7 @@ void tst_QQuickListView::cleanupTestCase() #ifdef SHARE_VIEWS testForView = QString(); delete m_view; - m_view = 0; + m_view = nullptr; #endif } @@ -408,16 +408,16 @@ void tst_QQuickListView::items(const QUrl &source) qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->forceLayout(); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); QTRY_VERIFY(!testObject->error()); - QTRY_VERIFY(listview->highlightItem() != 0); + QTRY_VERIFY(listview->highlightItem() != nullptr); QTRY_COMPARE(listview->count(), model.count()); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); listview->forceLayout(); @@ -428,10 +428,10 @@ void tst_QQuickListView::items(const QUrl &source) for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -453,7 +453,7 @@ void tst_QQuickListView::items(const QUrl &source) QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); QTRY_VERIFY(!testObject->error()); QTRY_VERIFY(listview->currentItem()); - QTRY_VERIFY(listview->highlightItem() != 0); + QTRY_VERIFY(listview->highlightItem() != nullptr); // set an empty model and confirm that items are destroyed T model2; @@ -492,21 +492,21 @@ void tst_QQuickListView::changed(const QUrl &source) qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->forceLayout(); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // Force a layout, necessary if ListView is completed before VisualDataModel. listview->forceLayout(); model.modifyItem(1, "Will", "9876"); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); delete testObject; @@ -534,10 +534,10 @@ void tst_QQuickListView::inserted(const QUrl &source) qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); model.insertItem(1, "Will", "9876"); @@ -545,10 +545,10 @@ void tst_QQuickListView::inserted(const QUrl &source) QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly @@ -563,10 +563,10 @@ void tst_QQuickListView::inserted(const QUrl &source) QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); QTRY_COMPARE(listview->currentIndex(), 1); @@ -633,9 +633,9 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); if (verticalLayoutDirection == QQuickItemView::BottomToTop) { listview->setVerticalLayoutDirection(verticalLayoutDirection); @@ -706,10 +706,10 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v } QTRY_COMPARE(item->y(), pos); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -828,9 +828,9 @@ void tst_QQuickListView::insertBeforeVisible() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); listview->setCacheBuffer(cacheBuffer); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -872,7 +872,7 @@ void tst_QQuickListView::insertBeforeVisible() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->y(), i*20.0 + itemsOffsetAfterMove); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -941,19 +941,19 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); model.removeItem(1); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly @@ -970,10 +970,10 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); // Confirm items positioned correctly @@ -1041,7 +1041,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) model.removeItem(20); QTRY_COMPARE(listview->currentIndex(), 20); - QTRY_VERIFY(listview->currentItem() != 0); + QTRY_VERIFY(listview->currentItem() != nullptr); // remove item before current, but visible listview->setCurrentIndex(8); @@ -1125,9 +1125,9 @@ void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::Vertic QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); if (verticalLayoutDirection == QQuickItemView::BottomToTop) { listview->setVerticalLayoutDirection(verticalLayoutDirection); @@ -1173,10 +1173,10 @@ void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::Vertic pos = -item0->height() - pos; QTRY_COMPARE(item->y(), pos); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -1307,9 +1307,9 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); listview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -1331,7 +1331,7 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou model.addItem("New", "1"); listview->forceLayout(); QTRY_COMPARE(listview->count(), 1); - QVERIFY(listview->currentItem() != 0); + QVERIFY(listview->currentItem() != nullptr); QCOMPARE(listview->currentIndex(), 0); delete testObject; @@ -1365,9 +1365,9 @@ void tst_QQuickListView::moved(const QUrl &source, QQuickItemView::VerticalLayou QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // always need to wait for view to be painted before the first move() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -1405,10 +1405,10 @@ void tst_QQuickListView::moved(const QUrl &source, QQuickItemView::VerticalLayou pos = -item->height() - pos; QTRY_COMPARE(item->y(), pos); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); // current index should have been updated @@ -1595,7 +1595,7 @@ void tst_QQuickListView::multipleChanges(bool condensed) QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); for (int i=0; i<changes.count(); i++) { @@ -1636,16 +1636,16 @@ void tst_QQuickListView::multipleChanges(bool condensed) QQuickText *name; QQuickText *number; QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -1843,7 +1843,7 @@ void tst_QQuickListView::swapWithFirstItem() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // ensure content position is stable @@ -1870,7 +1870,7 @@ void tst_QQuickListView::enforceRange() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(listview->preferredHighlightBegin(), 100.0); QTRY_COMPARE(listview->preferredHighlightEnd(), 100.0); @@ -1878,7 +1878,7 @@ void tst_QQuickListView::enforceRange() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // view should be positioned at the top of the range. QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); @@ -1886,10 +1886,10 @@ void tst_QQuickListView::enforceRange() QTRY_COMPARE(listview->contentY(), -100.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when contentItem moves @@ -1929,7 +1929,7 @@ void tst_QQuickListView::enforceRange_withoutHighlight() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); qreal expectedPos = -100.0; @@ -1970,10 +1970,10 @@ void tst_QQuickListView::spacing() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Confirm items positioned correctly @@ -2028,10 +2028,10 @@ void tst_QQuickListView::sections(const QUrl &source) QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -2128,10 +2128,10 @@ void tst_QQuickListView::sectionsDelegate() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -2237,30 +2237,30 @@ void tst_QQuickListView::sectionsDragOutsideBounds() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setCacheBuffer(cacheBuffer); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // QTBUG-17769 // Drag view up beyond bounds - QTest::mousePress(window, Qt::LeftButton, 0, QPoint(20,20)); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(20,20)); QTest::mouseMove(window, QPoint(20,0)); QTest::mouseMove(window, QPoint(20,-50)); QTest::mouseMove(window, QPoint(20,-distance)); - QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(20,-distance)); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(20,-distance)); // view should settle back at 0 QTRY_COMPARE(listview->contentY(), 0.0); - QTest::mousePress(window, Qt::LeftButton, 0, QPoint(20,0)); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(20,0)); QTest::mouseMove(window, QPoint(20,20)); QTest::mouseMove(window, QPoint(20,70)); QTest::mouseMove(window, QPoint(20,distance)); - QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(20,distance)); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(20,distance)); // view should settle back at 0 QTRY_COMPARE(listview->contentY(), 0.0); @@ -2285,10 +2285,10 @@ void tst_QQuickListView::sectionsDelegate_headerVisibility() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // ensure section header is maintained in view @@ -2317,9 +2317,9 @@ void tst_QQuickListView::sectionsPositioning() window->rootObject()->setProperty("sectionPositioning", QVariant(int(QQuickViewSection::InlineLabels | QQuickViewSection::CurrentLabelAtStart | QQuickViewSection::NextLabelAtEnd))); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); for (int i = 0; i < 3; ++i) { @@ -2475,10 +2475,10 @@ void tst_QQuickListView::sectionPropertyChange() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -2539,10 +2539,10 @@ void tst_QQuickListView::sectionDelegateChange() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQUICK_VERIFY_POLISH(listview); @@ -2585,9 +2585,9 @@ void tst_QQuickListView::sectionsItemInsertion() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); for (int i = 0; i < 3; ++i) { @@ -2643,9 +2643,9 @@ void tst_QQuickListView::currentIndex_delayedItemCreation() qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QSignalSpy spy(listview, SIGNAL(currentItemChanged())); //QCOMPARE(listview->currentIndex(), 0); @@ -2670,7 +2670,7 @@ void tst_QQuickListView::currentIndex() for (int i = 0; i < 30; i++) initModel.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -2683,9 +2683,9 @@ void tst_QQuickListView::currentIndex() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // currentIndex is initialized to 20 @@ -2774,7 +2774,7 @@ void tst_QQuickListView::noCurrentIndex() for (int i = 0; i < 30; i++) model.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -2786,9 +2786,9 @@ void tst_QQuickListView::noCurrentIndex() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // current index should be -1 at startup @@ -2829,7 +2829,7 @@ void tst_QQuickListView::keyNavigation() QVERIFY(QTest::qWaitForWindowActive(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); @@ -2939,13 +2939,13 @@ void tst_QQuickListView::itemList() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel"); - QTRY_VERIFY(model != 0); + QTRY_VERIFY(model != nullptr); QTRY_COMPARE(model->count(), 3); QTRY_COMPARE(listview->currentIndex(), 0); @@ -2978,13 +2978,13 @@ void tst_QQuickListView::itemListFlicker() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel"); - QTRY_VERIFY(model != 0); + QTRY_VERIFY(model != nullptr); QTRY_COMPARE(model->count(), 3); QTRY_COMPARE(listview->currentIndex(), 0); @@ -3043,13 +3043,13 @@ void tst_QQuickListView::cacheBuffer() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); - QTRY_VERIFY(listview->delegate() != 0); + QTRY_VERIFY(contentItem != nullptr); + QTRY_VERIFY(listview->delegate() != nullptr); QTRY_VERIFY(listview->model() != 0); - QTRY_VERIFY(listview->highlight() != 0); + QTRY_VERIFY(listview->highlight() != nullptr); // Confirm items positioned correctly int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); @@ -3068,8 +3068,8 @@ void tst_QQuickListView::cacheBuffer() // items will be created one at a time for (int i = itemCount; i < qMin(itemCount+10,model.count()); ++i) { - QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -3103,11 +3103,11 @@ void tst_QQuickListView::cacheBuffer() QCOMPARE(item->y(), qreal(i*20)); } - QVERIFY(findItem<QQuickItem>(listview, "wrapper", 32) == 0); + QVERIFY(findItem<QQuickItem>(listview, "wrapper", 32) == nullptr); // ensure buffered items are created for (int i = 32; i < qMin(41,model.count()); ++i) { - QQuickItem *item = 0; + QQuickItem *item = nullptr; while (!item) { qGuiApp->processEvents(); // allow refill to happen bool b = false; @@ -3146,9 +3146,9 @@ void tst_QQuickListView::positionViewAtBeginningEnd() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); listview->setContentY(100); @@ -3206,9 +3206,9 @@ void tst_QQuickListView::positionViewAtIndex() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); window->rootObject()->setProperty("enforceRange", enforceRange); @@ -3286,16 +3286,16 @@ void tst_QQuickListView::resetModel() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QTRY_COMPARE(listview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i); - QTRY_VERIFY(display != 0); + QTRY_VERIFY(display != nullptr); QTRY_COMPARE(display->text(), strings.at(i)); } @@ -3308,7 +3308,7 @@ void tst_QQuickListView::resetModel() for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i); - QTRY_VERIFY(display != 0); + QTRY_VERIFY(display != nullptr); QTRY_COMPARE(display->text(), strings.at(i)); } } @@ -3455,11 +3455,11 @@ void tst_QQuickListView::QTBUG_9791() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); - QTRY_VERIFY(listview->delegate() != 0); + QTRY_VERIFY(contentItem != nullptr); + QTRY_VERIFY(listview->delegate() != nullptr); QTRY_VERIFY(listview->model() != 0); QMetaObject::invokeMethod(listview, "fillModel"); @@ -3488,7 +3488,7 @@ void tst_QQuickListView::QTBUG_33568() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); // we want to verify that the change animates smoothly, rather than jumping into place QSignalSpy spy(listview, SIGNAL(contentYChanged())); @@ -3505,7 +3505,7 @@ void tst_QQuickListView::QTBUG_33568() void tst_QQuickListView::manualHighlight() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QString filename(testFile("manual-highlight.qml")); @@ -3514,10 +3514,10 @@ void tst_QQuickListView::manualHighlight() qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(listview->currentIndex(), 0); QTRY_COMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0)); @@ -3557,9 +3557,9 @@ void tst_QQuickListView::QTBUG_11105() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Confirm items positioned correctly @@ -3594,9 +3594,9 @@ void tst_QQuickListView::initialZValues() qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QVERIFY(listview->currentItem()); QTRY_COMPARE(listview->currentItem()->z(), listview->property("itemZ").toReal()); @@ -3610,7 +3610,7 @@ void tst_QQuickListView::initialZValues() QVERIFY(listview->highlightItem()); QTRY_COMPARE(listview->highlightItem()->z(), listview->property("highlightZ").toReal()); - QQuickText *sectionItem = 0; + QQuickText *sectionItem = nullptr; QTRY_VERIFY(sectionItem = findItem<QQuickText>(contentItem, "section")); QTRY_COMPARE(sectionItem->z(), listview->property("sectionZ").toReal()); } @@ -3648,16 +3648,16 @@ void tst_QQuickListView::header() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); listview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); - QQuickText *header = 0; + QQuickText *header = nullptr; QTRY_VERIFY(header = findItem<QQuickText>(contentItem, "header")); QCOMPARE(header, listview->headerItem()); @@ -3727,7 +3727,7 @@ void tst_QQuickListView::header() QVERIFY(QTest::qWaitForWindowExposed(window)); listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); listview->setVerticalLayoutDirection(verticalLayoutDirection); @@ -3814,10 +3814,10 @@ void tst_QQuickListView::header_delayItemCreation() qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *header = findItem<QQuickText>(contentItem, "header"); QVERIFY(header); @@ -3837,13 +3837,13 @@ void tst_QQuickListView::headerChangesViewport() window->setSource(testFileUrl("headerchangesviewport.qml")); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); - QQuickText *header = 0; + QQuickText *header = nullptr; QTRY_VERIFY(header = findItem<QQuickText>(contentItem, "header")); QCOMPARE(header, listview->headerItem()); @@ -3884,14 +3884,14 @@ void tst_QQuickListView::footer() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); listview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *footer = findItem<QQuickText>(contentItem, "footer"); QVERIFY(footer); @@ -4073,14 +4073,14 @@ void tst_QQuickListView::extents() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); listview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickItem *header = findItem<QQuickItem>(contentItem, "header"); QVERIFY(header); @@ -4171,10 +4171,10 @@ void tst_QQuickListView::resetModel_headerFooter() qApp->processEvents(); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickItem *header = findItem<QQuickItem>(contentItem, "header"); QVERIFY(header); @@ -4214,9 +4214,9 @@ void tst_QQuickListView::resizeView() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Confirm items positioned correctly @@ -4291,9 +4291,9 @@ void tst_QQuickListView::resizeViewAndRepaint() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // item at index 10 should not be currently visible @@ -4326,9 +4326,9 @@ void tst_QQuickListView::sizeLessThan1() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Confirm items positioned correctly @@ -4350,10 +4350,10 @@ void tst_QQuickListView::QTBUG_14821() qApp->processEvents(); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); listview->decrementCurrentIndex(); QCOMPARE(listview->currentIndex(), 99); @@ -4378,9 +4378,9 @@ void tst_QQuickListView::resizeDelegate() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QCOMPARE(listview->count(), model.rowCount()); @@ -4391,7 +4391,7 @@ void tst_QQuickListView::resizeDelegate() for (int i = 0; i < 16; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->y(), i*20.0); } @@ -4403,7 +4403,7 @@ void tst_QQuickListView::resizeDelegate() for (int i = 0; i < 11; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QTRY_COMPARE(item->y(), i*30.0); } @@ -4417,7 +4417,7 @@ void tst_QQuickListView::resizeDelegate() for (int i = 5; i < 16; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->y(), i*30.0); } @@ -4429,7 +4429,7 @@ void tst_QQuickListView::resizeDelegate() for (int i = 5; i < 11; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QTRY_COMPARE(item->y(), 150 + (i-5)*20.0); } @@ -4459,15 +4459,15 @@ void tst_QQuickListView::resizeFirstDelegate() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); - QQuickItem *item = 0; + QQuickItem *item = nullptr; for (int i = 0; i < model.count(); ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->y(), i*20.0); } @@ -4482,7 +4482,7 @@ void tst_QQuickListView::resizeFirstDelegate() for (int i = 1; i < model.count(); ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QTRY_COMPARE(item->y(), (i-1)*20.0); } @@ -4531,7 +4531,7 @@ void tst_QQuickListView::repositionResizedDelegate() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *positioner = findItem<QQuickItem>(window->rootObject(), "positioner"); @@ -4623,7 +4623,7 @@ void tst_QQuickListView::QTBUG_16037() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "listview"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QVERIFY(listview->contentHeight() <= 0.0); @@ -4668,13 +4668,13 @@ void tst_QQuickListView::indexAt_itemAt() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); - QQuickItem *item = 0; + QQuickItem *item = nullptr; if (index >= 0) { item = findItem<QQuickItem>(contentItem, "wrapper", index); QVERIFY(item); @@ -4699,10 +4699,10 @@ void tst_QQuickListView::incrementalModel() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(listview->count(), 35); listview->positionViewAtIndex(10, QQuickListView::Beginning); @@ -4823,17 +4823,17 @@ void tst_QQuickListView::rightToLeft() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel"); - QTRY_VERIFY(model != 0); + QTRY_VERIFY(model != nullptr); QTRY_COMPARE(model->count(), 3); QTRY_COMPARE(listview->currentIndex(), 0); @@ -4872,12 +4872,12 @@ void tst_QQuickListView::test_mirroring() QScopedPointer<QQuickView> windowA(createView()); windowA->setSource(testFileUrl("rightToLeft.qml")); QQuickListView *listviewA = findItem<QQuickListView>(windowA->rootObject(), "view"); - QTRY_VERIFY(listviewA != 0); + QTRY_VERIFY(listviewA != nullptr); QScopedPointer<QQuickView> windowB(createView()); windowB->setSource(testFileUrl("rightToLeft.qml")); QQuickListView *listviewB = findItem<QQuickListView>(windowB->rootObject(), "view"); - QTRY_VERIFY(listviewA != 0); + QTRY_VERIFY(listviewA != nullptr); qApp->processEvents(); QList<QString> objectNames; @@ -4940,9 +4940,9 @@ void tst_QQuickListView::margins() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QCOMPARE(listview->contentY(), -30.); @@ -5011,7 +5011,7 @@ void tst_QQuickListView::marginsResize() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "listview"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); @@ -5150,7 +5150,7 @@ void tst_QQuickListView::snapToItem() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); @@ -5159,7 +5159,7 @@ void tst_QQuickListView::snapToItem() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // confirm that a flick hits an item boundary flick(window, flickStart, flickEnd, 180); @@ -5210,7 +5210,7 @@ void tst_QQuickListView::snapOneItemResize_QTBUG_43555() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QSignalSpy currentIndexSpy(listview, SIGNAL(currentIndexChanged())); @@ -5413,7 +5413,7 @@ void tst_QQuickListView::asynchronous() QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject()); QVERIFY(rootObject); - QQuickListView *listview = 0; + QQuickListView *listview = nullptr; while (!listview) { bool b = false; controller.incubateWhile(&b); @@ -5422,8 +5422,8 @@ void tst_QQuickListView::asynchronous() // items will be created one at a time for (int i = 0; i < 8; ++i) { - QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -5510,7 +5510,7 @@ void tst_QQuickListView::snapOneItem() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); @@ -5519,7 +5519,7 @@ void tst_QQuickListView::snapOneItem() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QSignalSpy currentIndexSpy(listview, SIGNAL(currentIndexChanged())); @@ -5583,7 +5583,7 @@ void tst_QQuickListView::snapOneItemCurrentIndexRemoveAnimation() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QTRY_COMPARE(listview->currentIndex(), 0); @@ -5606,7 +5606,7 @@ void tst_QQuickListView::attachedProperties_QTBUG_32836() qApp->processEvents(); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *header = listview->headerItem(); QVERIFY(header); @@ -5635,7 +5635,7 @@ void tst_QQuickListView::unrequestedVisibility() for (int i = 0; i < 30; i++) model.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -5889,7 +5889,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5924,7 +5924,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5942,7 +5942,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5987,7 +5987,7 @@ void tst_QQuickListView::sizeTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // the following will start the transition @@ -6050,9 +6050,9 @@ void tst_QQuickListView::addTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); if (contentY != 0) { @@ -6131,7 +6131,7 @@ void tst_QQuickListView::addTransitions() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -6246,9 +6246,9 @@ void tst_QQuickListView::moveTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name; if (contentY != 0) { @@ -6316,7 +6316,7 @@ void tst_QQuickListView::moveTransitions() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->y(), i*20.0 + itemsOffsetAfterMove); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -6449,9 +6449,9 @@ void tst_QQuickListView::removeTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); if (contentY != 0) { @@ -6530,7 +6530,7 @@ void tst_QQuickListView::removeTransitions() QCOMPARE(item->x(), 0.0); QCOMPARE(item->y(), contentY + (i-firstVisibleIndex) * 20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -6661,9 +6661,9 @@ void tst_QQuickListView::displacedTransitions() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); @@ -6745,7 +6745,7 @@ void tst_QQuickListView::displacedTransitions() QCOMPARE(item->x(), 0.0); QCOMPARE(item->y(), i * 20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -6881,9 +6881,9 @@ void tst_QQuickListView::multipleTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); if (contentY != 0) { @@ -6953,7 +6953,7 @@ void tst_QQuickListView::multipleTransitions() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -7038,9 +7038,9 @@ void tst_QQuickListView::multipleDisplaced() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); model.moveItems(12, 8, 1); @@ -7062,7 +7062,7 @@ void tst_QQuickListView::multipleDisplaced() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -7131,10 +7131,10 @@ void tst_QQuickListView::flickBeyondBounds() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Flick view up beyond bounds @@ -7243,10 +7243,10 @@ void tst_QQuickListView::destroyItemOnCreation() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QCOMPARE(window->rootObject()->property("createdIndex").toInt(), -1); @@ -7267,10 +7267,10 @@ void tst_QQuickListView::parentBinding() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); @@ -7300,7 +7300,7 @@ void tst_QQuickListView::accessEmptyCurrentItem_QTBUG_30227() window->setSource(testFileUrl("emptymodel.qml")); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->forceLayout(); QMetaObject::invokeMethod(window->rootObject(), "remove"); @@ -7316,7 +7316,7 @@ void tst_QQuickListView::delayedChanges_QTBUG_30555() window->setSource(testFileUrl("delayedChanges.qml")); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QCOMPARE(listview->count(), 10); @@ -7335,7 +7335,7 @@ void tst_QQuickListView::outsideViewportChangeNotAffectingView() window->setSource(testFileUrl("outsideViewportChangeNotAffectingView.qml")); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); @@ -7369,7 +7369,7 @@ void tst_QQuickListView::testProxyModelChangedAfterMove() window->setSource(testFileUrl("proxytest.qml")); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); @@ -7389,7 +7389,7 @@ void tst_QQuickListView::typedModel() QCOMPARE(listview->count(), 6); - QQmlListModel *listModel = 0; + QQmlListModel *listModel = nullptr; listview->setModel(QVariant::fromValue(listModel)); QCOMPARE(listview->count(), 0); @@ -7403,10 +7403,10 @@ void tst_QQuickListView::displayMargin() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *content = listview->contentItem(); - QVERIFY(content != 0); + QVERIFY(content != nullptr); QQuickItem *item0 = findItem<QQuickItem>(content, "delegate", 0); QVERIFY(item0); @@ -7419,7 +7419,7 @@ void tst_QQuickListView::displayMargin() QCOMPARE(delegateVisible(item14), true); // the 15th item should be outside the end margin - QVERIFY(findItem<QQuickItem>(content, "delegate", 14) == 0); + QVERIFY(findItem<QQuickItem>(content, "delegate", 14) == nullptr); // the first delegate should still be within the begin margin listview->positionViewAtIndex(3, QQuickListView::Beginning); @@ -7439,13 +7439,13 @@ void tst_QQuickListView::negativeDisplayMargin() QQuickItem *listview = window->rootObject(); QQuickListView *innerList = findItem<QQuickListView>(window->rootObject(), "innerList"); - QVERIFY(innerList != 0); + QVERIFY(innerList != nullptr); QTRY_COMPARE(innerList->property("createdItems").toInt(), 11); QCOMPARE(innerList->property("destroyedItem").toInt(), 0); QQuickItem *content = innerList->contentItem(); - QVERIFY(content != 0); + QVERIFY(content != nullptr); QQuickItem *item = findItem<QQuickItem>(content, "delegate", 0); QVERIFY(item); @@ -7512,7 +7512,7 @@ void tst_QQuickListView::QTBUG_35920() QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject()); QVERIFY(listview); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,0)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10,0)); for (int i = 0; i < 100; ++i) { QTest::mouseMove(window.data(), QPoint(10,i)); if (listview->isMoving()) { @@ -7529,7 +7529,7 @@ void tst_QQuickListView::QTBUG_35920() QCOMPARE(listview->contentY(), contentY); } } - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(10,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10,100)); } Q_DECLARE_METATYPE(Qt::Orientation) @@ -7963,12 +7963,12 @@ void tst_QQuickListView::roundingErrors() // QTBUG-37339: drag an item and verify that it doesn't // get prematurely released due to rounding errors - QTest::mousePress(window.data(), Qt::LeftButton, 0, viewPos); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, viewPos); for (int i = 0; i < 150; i += 5) { QTest::mouseMove(window.data(), viewPos - QPoint(i, 0)); QVERIFY(item); } - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(0, 36)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(0, 36)); // maintain position relative to the right edge listview->setLayoutDirection(Qt::RightToLeft); @@ -8349,7 +8349,7 @@ void tst_QQuickListView::contentHeightWithDelayRemove() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); const int initialCount(listview->count()); const int eventualCount(initialCount + countDelta); @@ -8378,7 +8378,7 @@ void tst_QQuickListView::QTBUG_48044_currentItemNotVisibleAfterTransition() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); // Expand 2nd header listview->setProperty("transitionsDone", QVariant(false)); @@ -8527,7 +8527,7 @@ void tst_QQuickListView::QTBUG_48870_fastModelUpdates() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItemViewPrivate *priv = QQuickItemViewPrivate::get(listview); bool nonUnique; @@ -8570,7 +8570,7 @@ void tst_QQuickListView::QTBUG_50097_stickyHeader_positionViewAtIndex() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QTRY_COMPARE(listview->contentY(), -100.0); // the header size, since the header is overlaid listview->setProperty("currentPage", 2); QTRY_COMPARE(listview->contentY(), 400.0); // a full page of items down, sans the original negative header position @@ -8586,7 +8586,7 @@ void tst_QQuickListView::QTBUG_63974_stickyHeader_positionViewAtIndex_Contain() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); const qreal headerSize = 20; const qreal footerSize = 20; @@ -8663,7 +8663,7 @@ void tst_QQuickListView::releaseItems() void tst_QQuickListView::QTBUG_34576_velocityZero() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -8694,8 +8694,8 @@ void tst_QQuickListView::QTBUG_34576_velocityZero() QSignalSpy currentIndexChangedSpy(listview, SIGNAL(currentIndexChanged())); // click button which increases currentIndex - QTest::mousePress(window, Qt::LeftButton, 0, QPoint(295,215)); - QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(295,215)); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(295,215)); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(295,215)); // verify that currentIndexChanged is triggered QTRY_VERIFY(currentIndexChangedSpy.count() > 0); @@ -8745,10 +8745,10 @@ void tst_QQuickListView::addOnCompleted() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); qreal y = -1; for (char name = 'a'; name <= 'j'; ++name) { diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index 613d500746..5c11628e97 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -167,8 +167,8 @@ void tst_QQuickLoader::sourceOrComponent() , dataDirectoryUrl()); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); - QCOMPARE(loader->item() == 0, error); + QVERIFY(loader != nullptr); + QCOMPARE(loader->item() == nullptr, error); QCOMPARE(loader->source(), sourceUrl); QCOMPARE(loader->progress(), 1.0); @@ -231,7 +231,7 @@ void tst_QQuickLoader::clear() " }") , dataDirectoryUrl()); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); @@ -252,7 +252,7 @@ void tst_QQuickLoader::clear() QCOMPARE(loader->progress(), 1.0); QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); - loader->setSourceComponent(0); + loader->setSourceComponent(nullptr); QVERIFY(!loader->item()); QCOMPARE(loader->progress(), 0.0); @@ -293,7 +293,7 @@ void tst_QQuickLoader::urlToComponent() , dataDirectoryUrl()); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); QTest::qWait(200); - QTRY_VERIFY(loader != 0); + QTRY_VERIFY(loader != nullptr); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); @@ -327,12 +327,12 @@ void tst_QQuickLoader::anchoredLoader() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/AnchoredLoader.qml")); QScopedPointer<QQuickItem> rootItem(qobject_cast<QQuickItem*>(component.create())); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QQuickItem *loader = rootItem->findChild<QQuickItem*>("loader"); QQuickItem *sourceElement = rootItem->findChild<QQuickItem*>("sourceElement"); - QVERIFY(loader != 0); - QVERIFY(sourceElement != 0); + QVERIFY(loader != nullptr); + QVERIFY(sourceElement != nullptr); QCOMPARE(rootItem->width(), 300.0); QCOMPARE(rootItem->height(), 200.0); @@ -349,7 +349,7 @@ void tst_QQuickLoader::sizeLoaderToItem() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/SizeToItem.qml")); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QCOMPARE(loader->width(), 120.0); QCOMPARE(loader->height(), 60.0); @@ -389,7 +389,7 @@ void tst_QQuickLoader::sizeItemToLoader() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/SizeToLoader.qml")); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QCOMPARE(loader->width(), 200.0); QCOMPARE(loader->height(), 80.0); @@ -424,7 +424,7 @@ void tst_QQuickLoader::noResize() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/NoResize.qml")); QScopedPointer<QQuickItem> item(qobject_cast<QQuickItem*>(component.create())); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->width(), 200.0); QCOMPARE(item->height(), 80.0); } @@ -440,7 +440,7 @@ void tst_QQuickLoader::networkRequestUrl() if (component.isError()) qDebug() << component.errors(); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QTRY_COMPARE(loader->status(), QQuickLoader::Ready); @@ -494,7 +494,7 @@ void tst_QQuickLoader::failNetworkRequest() component.setData(qml.toUtf8(), server.url("/dummy.qml")); QTRY_COMPARE(component.status(), QQmlComponent::Ready); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QTRY_COMPARE(loader->status(), QQuickLoader::Error); @@ -512,7 +512,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.1.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == false); // set manually to false @@ -522,14 +522,14 @@ void tst_QQuickLoader::active() QMetaObject::invokeMethod(object.data(), "doSetSource"); QVERIFY(!loader->item()); QMetaObject::invokeMethod(object.data(), "doSetActive"); - QVERIFY(loader->item() != 0); + QVERIFY(loader->item() != nullptr); } // check that the status is Null if active is set to false { QQmlComponent component(&engine, testFileUrl("active.2.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default @@ -544,7 +544,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.3.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default @@ -559,14 +559,14 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.4.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default - QVERIFY(loader->sourceComponent() != 0); + QVERIFY(loader->sourceComponent() != nullptr); int currSourceComponentChangedCount = loader->property("sourceComponentChangedCount").toInt(); QMetaObject::invokeMethod(object.data(), "doSetInactive"); - QVERIFY(loader->sourceComponent() != 0); + QVERIFY(loader->sourceComponent() != nullptr); QCOMPARE(loader->property("sourceComponentChangedCount").toInt(), currSourceComponentChangedCount); } @@ -574,11 +574,11 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.5.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default - QVERIFY(loader->item() != 0); + QVERIFY(loader->item() != nullptr); int currItemChangedCount = loader->property("itemChangedCount").toInt(); QMetaObject::invokeMethod(object.data(), "doSetInactive"); QVERIFY(!loader->item()); @@ -589,7 +589,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.6.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default @@ -617,7 +617,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.7.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } @@ -625,7 +625,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.8.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } } @@ -693,7 +693,7 @@ void tst_QQuickLoader::initialPropertyValues() QQmlEngine engine; QQmlComponent component(&engine, qmlFile); QScopedPointer<QObject> object(component.beginCreate(engine.rootContext())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); const int serverBaseUrlPropertyIndex = object->metaObject()->indexOfProperty("serverBaseUrl"); if (serverBaseUrlPropertyIndex != -1) { @@ -716,7 +716,7 @@ void tst_QQuickLoader::initialPropertyValuesBinding() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("initialPropertyValues.binding.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->setProperty("bindable", QVariant(8))); QCOMPARE(object->property("canaryValue").toInt(), 8); @@ -752,9 +752,9 @@ void tst_QQuickLoader::initialPropertyValuesError() QQmlEngine engine; QQmlComponent component(&engine, qmlFile); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QVERIFY(!loader->item()); } @@ -774,7 +774,7 @@ void tst_QQuickLoader::deleteComponentCrash() QCOMPARE(loader->item()->objectName(), QLatin1String("blue")); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QTRY_COMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); QCOMPARE(loader->source(), testFileUrl("BlueRect.qml")); @@ -815,7 +815,7 @@ void tst_QQuickLoader::creationContext() QQmlComponent component(&engine, testFileUrl("creationContext.qml")); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); } @@ -1136,7 +1136,7 @@ void tst_QQuickLoader::sizeBound() QScopedPointer<QQuickItem> root(qobject_cast<QQuickItem*>(component.create())); QVERIFY(root); QQuickLoader *loader = root->findChild<QQuickLoader*>("loader"); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QVERIFY(loader->item()); @@ -1154,7 +1154,7 @@ void tst_QQuickLoader::QTBUG_30183() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/QTBUG_30183.qml")); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QCOMPARE(loader->width(), 240.0); QCOMPARE(loader->height(), 120.0); @@ -1254,7 +1254,7 @@ void tst_QQuickLoader::sourceComponentGarbageCollection() QMetaObject::invokeMethod(obj.data(), "setSourceComponent"); engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QSignalSpy spy(obj.data(), SIGNAL(loaded())); diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 76038d013b..ea55c25761 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -220,19 +220,19 @@ void tst_QQuickMouseArea::dragProperties() QVERIFY2(initView(window, testFileUrl("dragproperties.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QQuickItem *rootItem = qobject_cast<QQuickItem*>(window.rootObject()); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(drag, SIGNAL(targetChanged())); drag->setTarget(rootItem); QCOMPARE(targetSpy.count(),1); @@ -318,21 +318,21 @@ void tst_QQuickMouseArea::resetDrag() QVERIFY2(initView(window, testFileUrl("dragreset.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QQuickItem *rootItem = qobject_cast<QQuickItem*>(window.rootObject()); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(drag, SIGNAL(targetChanged())); - QVERIFY(drag->target() != 0); + QVERIFY(drag->target() != nullptr); window.rootContext()->setContextProperty("haveTarget", QVariant(false)); QCOMPARE(targetSpy.count(),1); QVERIFY(!drag->target()); @@ -349,24 +349,24 @@ void tst_QQuickMouseArea::dragging() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); mouseRegion->setAcceptedButtons(acceptedButtons); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); QPoint p = QPoint(100,100); - QTest::mousePress(&window, button, 0, p); + QTest::mousePress(&window, button, Qt::NoModifier, p); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -400,7 +400,7 @@ void tst_QQuickMouseArea::dragging() QTRY_COMPARE(blackRect->x(), 61.0); QCOMPARE(blackRect->y(), 61.0); - QTest::mouseRelease(&window, button, 0, p); + QTest::mouseRelease(&window, button, Qt::NoModifier, p); QTRY_VERIFY(!drag->active()); QTRY_COMPARE(blackRect->x(), 61.0); QCOMPARE(blackRect->y(), 61.0); @@ -414,7 +414,7 @@ void tst_QQuickMouseArea::dragSmoothed() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); @@ -422,17 +422,17 @@ void tst_QQuickMouseArea::dragSmoothed() mouseRegion->setAcceptedButtons(Qt::LeftButton); QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QVERIFY(!drag->active()); QTest::mouseMove(&window, QPoint(100, 102), 50); QTest::mouseMove(&window, QPoint(100, 106), 50); QTest::mouseMove(&window, QPoint(100, 122), 50); QTRY_COMPARE(blackRect->x(), 50.0); QTRY_COMPARE(blackRect->y(), 66.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100,122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,122)); // reset rect position blackRect->setX(50.0); @@ -441,14 +441,14 @@ void tst_QQuickMouseArea::dragSmoothed() // now try with smoothed disabled drag->setSmoothed(false); QVERIFY(!drag->active()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QVERIFY(!drag->active()); QTest::mouseMove(&window, QPoint(100, 102), 50); QTest::mouseMove(&window, QPoint(100, 106), 50); QTest::mouseMove(&window, QPoint(100, 122), 50); QTRY_COMPARE(blackRect->x(), 50.0); QTRY_COMPARE(blackRect->y(), 72.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 122)); } void tst_QQuickMouseArea::dragThreshold_data() @@ -468,7 +468,7 @@ void tst_QQuickMouseArea::dragThreshold() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); mouseRegion->setPreventStealing(preventStealing); @@ -478,10 +478,10 @@ void tst_QQuickMouseArea::dragThreshold() mouseRegion->setAcceptedButtons(Qt::LeftButton); QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); QCOMPARE(blackRect->y(), 50.0); @@ -500,18 +500,18 @@ void tst_QQuickMouseArea::dragThreshold() QTRY_VERIFY(drag->active()); QTRY_COMPARE(blackRect->x(), 50.0); QTRY_COMPARE(blackRect->y(), 66.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(122,122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(122,122)); QTRY_VERIFY(!drag->active()); // Immediate drag threshold drag->setThreshold(0); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::mouseMove(&window, QPoint(100, 122), 50); QVERIFY(!drag->active()); QTest::mouseMove(&window, QPoint(100, 123), 50); QVERIFY(drag->active()); QTest::mouseMove(&window, QPoint(100, 124), 50); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 124)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 124)); QTRY_VERIFY(!drag->active()); drag->resetThreshold(); } @@ -525,23 +525,23 @@ void tst_QQuickMouseArea::invalidDrag() QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); mouseRegion->setAcceptedButtons(acceptedButtons); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); - QTest::mousePress(&window, button, 0, QPoint(100,100)); + QTest::mousePress(&window, button, Qt::NoModifier, QPoint(100,100)); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -559,7 +559,7 @@ void tst_QQuickMouseArea::invalidDrag() QCOMPARE(blackRect->x(), 50.0); QCOMPARE(blackRect->y(), 50.0); - QTest::mouseRelease(&window, button, 0, QPoint(122,122)); + QTest::mouseRelease(&window, button, Qt::NoModifier, QPoint(122,122)); QTest::qWait(50); QVERIFY(!drag->active()); @@ -575,24 +575,24 @@ void tst_QQuickMouseArea::cancelDragging() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); mouseRegion->setAcceptedButtons(Qt::LeftButton); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); QPoint p = QPoint(100,100); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -618,7 +618,7 @@ void tst_QQuickMouseArea::cancelDragging() QCOMPARE(blackRect->x(), 61.0); QCOMPARE(blackRect->y(), 61.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(122,122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(122,122)); } // QTBUG-58347 @@ -637,14 +637,14 @@ void tst_QQuickMouseArea::availableDistanceLessThanDragThreshold() QVERIFY(mouseArea); QPoint position(100, 100); - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); position.setX(301); QTest::mouseMove(&view, position); position.setX(501); QTest::mouseMove(&view, position); QVERIFY(mouseArea->drag()->active()); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!mouseArea->drag()->active()); QCOMPARE(mouseArea->x(), 200.0); @@ -657,7 +657,7 @@ void tst_QQuickMouseArea::setDragOnPressed() QVERIFY2(initView(window, testFileUrl("setDragOnPressed.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea *>(window.rootObject()); QVERIFY(mouseArea); @@ -667,7 +667,7 @@ void tst_QQuickMouseArea::setDragOnPressed() QVERIFY(target); QPoint p = QPoint(100, 100); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QQuickDrag *drag = mouseArea->drag(); QVERIFY(drag); @@ -688,7 +688,7 @@ void tst_QQuickMouseArea::setDragOnPressed() QTRY_COMPARE(target->x(), 61.0); QCOMPARE(target->y(), 50.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_VERIFY(!drag->active()); QCOMPARE(target->x(), 61.0); QCOMPARE(target->y(), 50.0); @@ -701,18 +701,18 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnClick() QVERIFY2(initView(window, testFileUrl("updateMousePosOnClick.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); - QVERIFY(mouseRegion != 0); + QVERIFY(mouseRegion != nullptr); QQuickRectangle *rect = window.rootObject()->findChild<QQuickRectangle*>("ball"); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(mouseRegion->mouseX(), rect->x()); QCOMPARE(mouseRegion->mouseY(), rect->y()); - QMouseEvent event(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent event(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &event); QCOMPARE(mouseRegion->mouseX(), 100.0); @@ -729,18 +729,18 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnResize() QVERIFY2(initView(window, testFileUrl("updateMousePosOnResize.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); - QVERIFY(mouseRegion != 0); + QVERIFY(mouseRegion != nullptr); QQuickRectangle *rect = window.rootObject()->findChild<QQuickRectangle*>("brother"); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(mouseRegion->mouseX(), 0.0); QCOMPARE(mouseRegion->mouseY(), 0.0); - QMouseEvent event(QEvent::MouseButtonPress, rect->position().toPoint(), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent event(QEvent::MouseButtonPress, rect->position().toPoint(), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &event); QVERIFY(!mouseRegion->property("emitPositionChanged").toBool()); @@ -765,11 +765,11 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() QVERIFY2(initView(window, testFileUrl("clickandhold.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea*>(window.rootObject()->children().first()); QVERIFY(mouseArea); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QCOMPARE(mouseArea->pressedButtons(), Qt::LeftButton); @@ -783,7 +783,7 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() QVERIFY(!window.rootObject()->property("clicked").toBool()); QVERIFY(window.rootObject()->property("held").toBool()); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QTRY_VERIFY(window.rootObject()->property("held").toBool()); @@ -797,16 +797,16 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() QVERIFY2(initView(window, testFileUrl("noclickandhold.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QVERIFY(!window.rootObject()->property("clicked").toBool()); QTest::qWait(1000); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QVERIFY(window.rootObject()->property("clicked").toBool()); @@ -820,7 +820,7 @@ void tst_QQuickMouseArea::onMousePressRejected() QVERIFY2(initView(window, testFileUrl("rejectEvent.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QVERIFY(window.rootObject()->property("enabled").toBool()); QVERIFY(!window.rootObject()->property("mr1_pressed").toBool()); @@ -830,7 +830,7 @@ void tst_QQuickMouseArea::onMousePressRejected() QVERIFY(!window.rootObject()->property("mr2_released").toBool()); QVERIFY(!window.rootObject()->property("mr2_canceled").toBool()); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QVERIFY(window.rootObject()->property("mr1_pressed").toBool()); @@ -842,7 +842,7 @@ void tst_QQuickMouseArea::onMousePressRejected() QTest::qWait(200); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QVERIFY(window.rootObject()->property("mr1_released").toBool()); @@ -867,7 +867,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QVERIFY2(initView(window, testFileUrl("pressedCanceled.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QVERIFY(!window.rootObject()->property("pressed").toBool()); QVERIFY(!window.rootObject()->property("canceled").toBool()); @@ -877,8 +877,8 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QCOMPARE(window.rootObject()->property("clicked").toInt(), expectedClicks); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); @@ -895,7 +895,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QCOMPARE(window.rootObject()->property("clicked").toInt(), ++expectedClicks); QGuiApplication::sendEvent(&window, &pressEvent); - QMouseEvent pressEvent2(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent2(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent2); QTRY_VERIFY(window.rootObject()->property("pressed").toBool()); @@ -940,7 +940,7 @@ void tst_QQuickMouseArea::doubleClick() QVERIFY2(initView(window, testFileUrl("doubleclick.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea *>("mousearea"); QVERIFY(mouseArea); @@ -948,16 +948,16 @@ void tst_QQuickMouseArea::doubleClick() // The sequence for a double click is: // press, release, (click), press, double click, release - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QCOMPARE(window.rootObject()->property("released").toInt(), 1); QGuiApplication::sendEvent(&window, &pressEvent); - pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, 0); + pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QGuiApplication::sendEvent(&window, &releaseEvent); @@ -977,16 +977,16 @@ void tst_QQuickMouseArea::clickTwice() QVERIFY2(initView(window, testFileUrl("clicktwice.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea *>("mousearea"); QVERIFY(mouseArea); mouseArea->setAcceptedButtons(acceptedButtons); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QCOMPARE(window.rootObject()->property("pressed").toInt(), 1); @@ -994,7 +994,7 @@ void tst_QQuickMouseArea::clickTwice() QCOMPARE(window.rootObject()->property("clicked").toInt(), 1); QGuiApplication::sendEvent(&window, &pressEvent); - pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, 0); + pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QGuiApplication::sendEvent(&window, &releaseEvent); @@ -1013,7 +1013,7 @@ void tst_QQuickMouseArea::invalidClick() QVERIFY2(initView(window, testFileUrl("doubleclick.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea *>("mousearea"); QVERIFY(mouseArea); @@ -1021,16 +1021,16 @@ void tst_QQuickMouseArea::invalidClick() // The sequence for a double click is: // press, release, (click), press, double click, release - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QCOMPARE(window.rootObject()->property("released").toInt(), 0); QGuiApplication::sendEvent(&window, &pressEvent); - pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, 0); + pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QGuiApplication::sendEvent(&window, &releaseEvent); @@ -1046,16 +1046,16 @@ void tst_QQuickMouseArea::pressedOrdering() QVERIFY2(initView(window, testFileUrl("pressedOrdering.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QCOMPARE(window.rootObject()->property("value").toString(), QLatin1String("base")); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QCOMPARE(window.rootObject()->property("value").toString(), QLatin1String("pressed")); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QCOMPARE(window.rootObject()->property("value").toString(), QLatin1String("toggled")); @@ -1072,18 +1072,18 @@ void tst_QQuickMouseArea::preventStealing() QVERIFY2(initView(window, testFileUrl("preventstealing.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window.rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mousearea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QSignalSpy mousePositionSpy(mouseArea, SIGNAL(positionChanged(QQuickMouseEvent*))); QPoint p = QPoint(80, 80); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); // Without preventStealing, mouse movement over MouseArea would // cause the Flickable to steal mouse and trigger content movement. @@ -1106,13 +1106,13 @@ void tst_QQuickMouseArea::preventStealing() QCOMPARE(flickable->contentX(), 0.); QCOMPARE(flickable->contentY(), 0.); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); // Now allow stealing and confirm Flickable does its thing. window.rootObject()->setProperty("stealing", false); p = QPoint(80, 80); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); // Without preventStealing, mouse movement over MouseArea would // cause the Flickable to steal mouse and trigger content movement. @@ -1135,7 +1135,7 @@ void tst_QQuickMouseArea::preventStealing() QTRY_COMPARE(flickable->contentX(), 20.); QCOMPARE(flickable->contentY(), 20.); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); } void tst_QQuickMouseArea::clickThrough() @@ -1146,27 +1146,27 @@ void tst_QQuickMouseArea::clickThrough() QVERIFY2(initView(*window.data(), testFileUrl("clickThrough.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); // to avoid generating a double click. const int doubleClickInterval = qApp->styleHints()->mouseDoubleClickInterval() + 10; - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTRY_COMPARE(window->rootObject()->property("presses").toInt(), 0); QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 1); QCOMPARE(window->rootObject()->property("doubleClicks").toInt(), 0); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); QTest::qWait(1000); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTRY_COMPARE(window->rootObject()->property("presses").toInt(), 0); QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 1); QTRY_COMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1); - QTest::mouseDClick(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseDClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); @@ -1180,24 +1180,24 @@ void tst_QQuickMouseArea::clickThrough() QVERIFY2(initView(*window.data(), testFileUrl("clickThrough2.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); QCOMPARE(window->rootObject()->property("clicks").toInt(), 0); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); QTest::qWait(1000); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); QCOMPARE(window->rootObject()->property("clicks").toInt(), 0); QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 0); - QTest::mouseDClick(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseDClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); @@ -1207,22 +1207,22 @@ void tst_QQuickMouseArea::clickThrough() window->rootObject()->setProperty("letThrough", QVariant(true)); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 1); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); QTest::qWait(1000); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); QCOMPARE(window->rootObject()->property("clicks").toInt(), 1); QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1); - QTest::mouseDClick(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseDClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); @@ -1232,15 +1232,15 @@ void tst_QQuickMouseArea::clickThrough() window->rootObject()->setProperty("noPropagation", QVariant(true)); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); QTest::qWait(1000); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); - QTest::mouseDClick(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseDClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); @@ -1254,18 +1254,18 @@ void tst_QQuickMouseArea::clickThrough() QVERIFY2(initView(*window.data(), testFileUrl("qtbug34368.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window->rootObject()->property("clicksEnabled").toInt(), 1); QCOMPARE(window->rootObject()->property("clicksDisabled").toInt(), 1); //Not disabled yet window->rootObject()->setProperty("disableLower", QVariant(true)); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window->rootObject()->property("clicksEnabled").toInt(), 2); QCOMPARE(window->rootObject()->property("clicksDisabled").toInt(), 1); //disabled, shouldn't increment @@ -1276,12 +1276,12 @@ void tst_QQuickMouseArea::clickThrough() QVERIFY2(initView(*window.data(), testFileUrl("qtbug49100.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } void tst_QQuickMouseArea::hoverPosition() @@ -1290,7 +1290,7 @@ void tst_QQuickMouseArea::hoverPosition() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("hoverPosition.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QCOMPARE(root->property("mouseX").toReal(), qreal(0)); QCOMPARE(root->property("mouseY").toReal(), qreal(0)); @@ -1309,18 +1309,18 @@ void tst_QQuickMouseArea::hoverPropagation() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("hoverPropagation.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QCOMPARE(root->property("point1").toBool(), false); QCOMPARE(root->property("point2").toBool(), false); - QMouseEvent moveEvent(QEvent::MouseMove, QPoint(32, 32), Qt::NoButton, Qt::NoButton, 0); + QMouseEvent moveEvent(QEvent::MouseMove, QPoint(32, 32), Qt::NoButton, Qt::NoButton, nullptr); QGuiApplication::sendEvent(&window, &moveEvent); QCOMPARE(root->property("point1").toBool(), true); QCOMPARE(root->property("point2").toBool(), false); - QMouseEvent moveEvent2(QEvent::MouseMove, QPoint(232, 32), Qt::NoButton, Qt::NoButton, 0); + QMouseEvent moveEvent2(QEvent::MouseMove, QPoint(232, 32), Qt::NoButton, Qt::NoButton, nullptr); QGuiApplication::sendEvent(&window, &moveEvent2); QCOMPARE(root->property("point1").toBool(), false); QCOMPARE(root->property("point2").toBool(), true); @@ -1336,10 +1336,10 @@ void tst_QQuickMouseArea::hoverVisible() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("hoverVisible.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseTracker = window.rootObject()->findChild<QQuickMouseArea*>("mousetracker"); - QVERIFY(mouseTracker != 0); + QVERIFY(mouseTracker != nullptr); QSignalSpy enteredSpy(mouseTracker, SIGNAL(entered())); @@ -1364,10 +1364,10 @@ void tst_QQuickMouseArea::hoverAfterPress() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("hoverAfterPress.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mouseArea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QTest::mouseMove(&window, QPoint(22,33)); QCOMPARE(mouseArea->hovered(), false); QTest::mouseMove(&window, QPoint(200,200)); @@ -1390,11 +1390,11 @@ void tst_QQuickMouseArea::subtreeHoverEnabled() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("qtbug54019.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea = root->findChild<QQuickMouseArea*>(); QQuickItemPrivate *rootPrivate = QQuickItemPrivate::get(root); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QTest::mouseMove(&window, QPoint(10, 160)); QCOMPARE(mouseArea->hovered(), false); QVERIFY(rootPrivate->subtreeHoverEnabled); @@ -1411,12 +1411,12 @@ void tst_QQuickMouseArea::disableAfterPress() QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseArea->drag(); - QVERIFY(mouseArea != 0); - QVERIFY(drag != 0); + QVERIFY(mouseArea != nullptr); + QVERIFY(drag != nullptr); QSignalSpy mousePositionSpy(mouseArea, SIGNAL(positionChanged(QQuickMouseEvent*))); QSignalSpy mousePressSpy(mouseArea, SIGNAL(pressed(QQuickMouseEvent*))); @@ -1424,12 +1424,12 @@ void tst_QQuickMouseArea::disableAfterPress() // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); QPoint p = QPoint(100,100); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_COMPARE(mousePressSpy.count(), 1); QVERIFY(!drag->active()); @@ -1467,7 +1467,7 @@ void tst_QQuickMouseArea::disableAfterPress() QVERIFY(mouseArea->pressed()); QVERIFY(mouseArea->hovered()); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_COMPARE(mouseReleaseSpy.count(), 1); @@ -1486,7 +1486,7 @@ void tst_QQuickMouseArea::disableAfterPress() mousePositionSpy.clear(); mouseReleaseSpy.clear(); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(50); QCOMPARE(mousePressSpy.count(), 0); @@ -1501,7 +1501,7 @@ void tst_QQuickMouseArea::disableAfterPress() QCOMPARE(blackRect->x(), 50.0); QCOMPARE(blackRect->y(), 50.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(122,122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(122,122)); QTest::qWait(50); QCOMPARE(mouseReleaseSpy.count(), 0); @@ -1513,7 +1513,7 @@ void tst_QQuickMouseArea::onWheel() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("wheel.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QWheelEvent wheelEvent(QPoint(10, 32), QPoint(10, 32), QPoint(60, 20), QPoint(0, 120), 0, Qt::Vertical,Qt::NoButton, Qt::ControlModifier); @@ -1558,10 +1558,10 @@ void tst_QQuickMouseArea::transformedMouseArea() QVERIFY2(initView(window, testFileUrl("transformedMouseArea.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea *>("mouseArea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); foreach (const QPoint &point, points) { // check hover @@ -1569,11 +1569,11 @@ void tst_QQuickMouseArea::transformedMouseArea() QTRY_COMPARE(mouseArea->property("containsMouse").toBool(), insideTarget); // check mouse press - QTest::mousePress(&window, Qt::LeftButton, 0, point); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, point); QTRY_COMPARE(mouseArea->property("pressed").toBool(), insideTarget); // check mouse release - QTest::mouseRelease(&window, Qt::LeftButton, 0, point); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, point); QTRY_COMPARE(mouseArea->property("pressed").toBool(), false); } } @@ -1592,7 +1592,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() buttons << Qt::LeftButton << (Qt::LeftButton | Qt::RightButton) << Qt::LeftButton - << 0; + << nullptr; pressed << true << true << true @@ -1600,7 +1600,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() pressedButtons << Qt::LeftButton << Qt::LeftButton << Qt::LeftButton - << 0; + << nullptr; QTest::newRow("Accept Left - Press left, Press Right, Release Right") << Qt::MouseButtons(Qt::LeftButton) << buttons << pressed << pressedButtons << 2; @@ -1610,15 +1610,15 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() buttons << Qt::LeftButton << (Qt::LeftButton | Qt::RightButton) << Qt::RightButton - << 0; + << nullptr; pressed << true << true << false << false; pressedButtons << Qt::LeftButton << Qt::LeftButton - << 0 - << 0; + << nullptr + << nullptr; QTest::newRow("Accept Left - Press left, Press Right, Release Left") << Qt::MouseButtons(Qt::LeftButton) << buttons << pressed << pressedButtons << 2; @@ -1628,7 +1628,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() buttons << Qt::LeftButton << (Qt::LeftButton | Qt::RightButton) << Qt::LeftButton - << 0; + << nullptr; pressed << true << true << true @@ -1636,7 +1636,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() pressedButtons << Qt::LeftButton << (Qt::LeftButton | Qt::RightButton) << Qt::LeftButton - << 0; + << nullptr; QTest::newRow("Accept Left|Right - Press left, Press Right, Release Right") << (Qt::LeftButton | Qt::RightButton) << buttons << pressed << pressedButtons << 4; @@ -1646,15 +1646,15 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() buttons << Qt::RightButton << (Qt::LeftButton | Qt::RightButton) << Qt::LeftButton - << 0; + << nullptr; pressed << true << true << false << false; pressedButtons << Qt::RightButton << Qt::RightButton - << 0 - << 0; + << nullptr + << nullptr; QTest::newRow("Accept Right - Press Right, Press Left, Release Right") << Qt::MouseButtons(Qt::RightButton) << buttons << pressed << pressedButtons << 2; } @@ -1672,10 +1672,10 @@ void tst_QQuickMouseArea::pressedMultipleButtons() QVERIFY2(initView(view, testFileUrl("simple.qml"), true, &errorMessage), errorMessage.constData()); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QVERIFY(view.rootObject() != 0); + QVERIFY(view.rootObject() != nullptr); QQuickMouseArea *mouseArea = view.rootObject()->findChild<QQuickMouseArea *>("mousearea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QSignalSpy pressedSpy(mouseArea, SIGNAL(pressedChanged())); QSignalSpy pressedButtonsSpy(mouseArea, SIGNAL(pressedButtonsChanged())); @@ -1687,13 +1687,13 @@ void tst_QQuickMouseArea::pressedMultipleButtons() int btns = buttons.at(i); // The windowsysteminterface takes care of sending releases - QTest::mousePress(&view, (Qt::MouseButton)btns, 0, point); + QTest::mousePress(&view, (Qt::MouseButton)btns, Qt::NoModifier, point); QCOMPARE(mouseArea->pressed(), pressed.at(i)); QCOMPARE(mouseArea->pressedButtons(), pressedButtons.at(i)); } - QTest::mousePress(&view, Qt::NoButton, 0, point); + QTest::mousePress(&view, Qt::NoButton, Qt::NoModifier, point); QCOMPARE(mouseArea->pressed(), false); QCOMPARE(pressedSpy.count(), 2); @@ -1707,25 +1707,25 @@ void tst_QQuickMouseArea::changeAxis() QVERIFY2(initView(view, testFileUrl("changeAxis.qml"), true, &errorMessage), errorMessage.constData()); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTRY_VERIFY(view.rootObject() != 0); + QTRY_VERIFY(view.rootObject() != nullptr); QQuickMouseArea *mouseRegion = view.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); mouseRegion->setAcceptedButtons(Qt::LeftButton); // target QQuickItem *blackRect = view.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); // Start a diagonal drag QPoint p = QPoint(100, 100); - QTest::mousePress(&view, Qt::LeftButton, 0, p); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, p); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -1756,7 +1756,7 @@ void tst_QQuickMouseArea::changeAxis() QTRY_COMPARE(blackRect->y(), 94.0); QCOMPARE(blackRect->x(), 83.0); - QTest::mouseRelease(&view, Qt::LeftButton, 0, p); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, p); QTRY_VERIFY(!drag->active()); QCOMPARE(blackRect->x(), 83.0); @@ -1804,7 +1804,7 @@ void tst_QQuickMouseArea::moveAndReleaseWithoutPress() QObject *root = window.rootObject(); QVERIFY(root); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); // the press was not accepted, make sure there is no move or release event QTest::mouseMove(&window, QPoint(110,110), 50); @@ -1814,7 +1814,7 @@ void tst_QQuickMouseArea::moveAndReleaseWithoutPress() QTest::qWait(100); QCOMPARE(root->property("hadMove").toBool(), false); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(110,110)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(110,110)); QTest::qWait(100); QCOMPARE(root->property("hadRelease").toBool(), false); } @@ -1858,7 +1858,7 @@ void tst_QQuickMouseArea::nestedStopAtBounds() int &axis = transpose ? position.ry() : position.rx(); // drag toward the aligned boundary. Outer mouse area dragged. - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); axis += invert ? threshold * 2 : -threshold * 2; QTest::mouseMove(&view, position); @@ -1866,7 +1866,7 @@ void tst_QQuickMouseArea::nestedStopAtBounds() QTest::mouseMove(&view, position); QCOMPARE(outer->drag()->active(), true); QCOMPARE(inner->drag()->active(), false); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!outer->drag()->active()); @@ -1875,7 +1875,7 @@ void tst_QQuickMouseArea::nestedStopAtBounds() outer->setY(50); // drag away from the aligned boundary. Inner mouse area dragged. - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); axis += invert ? -threshold * 2 : threshold * 2; QTest::mouseMove(&view, position); @@ -1883,7 +1883,7 @@ void tst_QQuickMouseArea::nestedStopAtBounds() QTest::mouseMove(&view, position); QTRY_COMPARE(outer->drag()->active(), false); QTRY_COMPARE(inner->drag()->active(), true); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); } void tst_QQuickMouseArea::nestedFlickableStopAtBounds() @@ -1908,7 +1908,7 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() int &pos = position.ry(); // Drag up - should move the Flickable to end - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); pos -= threshold * 2; QTest::mouseMove(&view, position); @@ -1920,7 +1920,7 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() QVERIFY(flickable->isDragging()); QVERIFY(!mouseArea->drag()->active()); QCOMPARE(flickable->isAtYEnd(), true); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QTRY_VERIFY(!flickable->isMoving()); @@ -1928,7 +1928,7 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() // Drag up again - should activate MouseArea drag QVERIFY(!mouseArea->drag()->active()); - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); pos -= threshold * 2; QTest::mouseMove(&view, position); @@ -1940,12 +1940,12 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() QVERIFY(mouseArea->drag()->active()); QCOMPARE(flickable->isAtYEnd(), true); QVERIFY(!flickable->isDragging()); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); // Drag to the top and verify that the MouseArea doesn't steal the grab when we drag back (QTBUG-56036) pos = 50; - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); pos += threshold; QTest::mouseMove(&view, position); @@ -1957,14 +1957,14 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() QVERIFY(flickable->isDragging()); QVERIFY(!mouseArea->drag()->active()); QCOMPARE(flickable->isAtYBeginning(), true); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QTRY_VERIFY(!flickable->isMoving()); pos = 280; // Drag up again - should not activate MouseArea drag - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); pos -= threshold; QTest::mouseMove(&view, position); @@ -1975,7 +1975,7 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() QTest::mouseMove(&view, position); QVERIFY(flickable->isDragging()); QVERIFY(!mouseArea->drag()->active()); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); } void tst_QQuickMouseArea::containsPress_data() @@ -1997,10 +1997,10 @@ void tst_QQuickMouseArea::containsPress() window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mouseArea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QSignalSpy containsPressSpy(mouseArea, SIGNAL(containsPressChanged())); @@ -2061,7 +2061,7 @@ void tst_QQuickMouseArea::ignoreBySource() // MouseArea should grab the press because it's interested in non-synthesized mouse events QPoint p = QPoint(80, 80); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QCOMPARE(window.mouseGrabberItem(), mouseArea); // That was a real mouse event QCOMPARE(root->property("lastEventSource").toInt(), int(Qt::MouseEventNotSynthesized)); @@ -2076,7 +2076,7 @@ void tst_QQuickMouseArea::ignoreBySource() QCOMPARE(flickable->contentX(), 0.); QCOMPARE(flickable->contentY(), 0.); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); QCOMPARE(window.mouseGrabberItem(), nullptr); // Now try touch events and confirm that MouseArea ignores them, while Flickable does its thing @@ -2112,7 +2112,7 @@ void tst_QQuickMouseArea::ignoreBySource() // MouseArea should ignore the press because it's interested in synthesized mouse events p = QPoint(80, 80); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QVERIFY(window.mouseGrabberItem() != mouseArea); // That was a real mouse event QVERIFY(root->property("lastEventSource").toInt() == Qt::MouseEventNotSynthesized); @@ -2127,7 +2127,7 @@ void tst_QQuickMouseArea::ignoreBySource() QTRY_VERIFY(flickable->contentX() > 1); QVERIFY(flickable->contentY() > 1); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(47, 47)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(47, 47)); flickable->setContentX(0); flickable->setContentY(0); @@ -2191,10 +2191,10 @@ void tst_QQuickMouseArea::pressAndHold() window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mouseArea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QSignalSpy pressAndHoldSpy(mouseArea, &QQuickMouseArea::pressAndHold); @@ -2289,19 +2289,19 @@ void tst_QQuickMouseArea::mask() window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); // click inside the mask, and verify it registers - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window.rootObject()->property("pressed").toInt(), 1); QCOMPARE(window.rootObject()->property("released").toInt(), 1); QCOMPARE(window.rootObject()->property("clicked").toInt(), 1); // click outside the mask (but inside the MouseArea), and verify it doesn't register - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(10,10)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(10,10)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(10,10)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(10,10)); QCOMPARE(window.rootObject()->property("pressed").toInt(), 1); QCOMPARE(window.rootObject()->property("released").toInt(), 1); diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 87acd67f6a..056b1fc020 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -41,7 +41,7 @@ class tst_QQuickMultiPointTouchArea : public QQmlDataTest { Q_OBJECT public: - tst_QQuickMultiPointTouchArea() : device(0) { } + tst_QQuickMultiPointTouchArea() : device(nullptr) { } private slots: void initTestCase() { @@ -79,10 +79,10 @@ private: void tst_QQuickMultiPointTouchArea::properties() { QScopedPointer<QQuickView> window(createAndShowView("properties.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject()); - QVERIFY(area != 0); + QVERIFY(area != nullptr); QCOMPARE(area->minimumTouchPoints(), 2); QCOMPARE(area->maximumTouchPoints(), 4); @@ -94,10 +94,10 @@ void tst_QQuickMultiPointTouchArea::properties() void tst_QQuickMultiPointTouchArea::signalTest() { QScopedPointer<QQuickView> window(createAndShowView("signalTest.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject()); - QVERIFY(area != 0); + QVERIFY(area != nullptr); QPoint p1(20,100); QPoint p2(40,100); @@ -161,7 +161,7 @@ void tst_QQuickMultiPointTouchArea::signalTest() void tst_QQuickMultiPointTouchArea::release() { QScopedPointer<QQuickView> window(createAndShowView("basic.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTouchPoint *point1 = window->rootObject()->findChild<QQuickTouchPoint*>("point1"); @@ -197,7 +197,7 @@ void tst_QQuickMultiPointTouchArea::release() void tst_QQuickMultiPointTouchArea::reuse() { QScopedPointer<QQuickView> window(createAndShowView("basic.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTouchPoint *point1 = window->rootObject()->findChild<QQuickTouchPoint*>("point1"); QQuickTouchPoint *point2 = window->rootObject()->findChild<QQuickTouchPoint*>("point2"); @@ -264,7 +264,7 @@ void tst_QQuickMultiPointTouchArea::reuse() void tst_QQuickMultiPointTouchArea::nonOverlapping() { QScopedPointer<QQuickView> window(createAndShowView("nonOverlapping.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point11"); QQuickTouchPoint *point12 = window->rootObject()->findChild<QQuickTouchPoint*>("point12"); @@ -378,7 +378,7 @@ void tst_QQuickMultiPointTouchArea::nonOverlapping() void tst_QQuickMultiPointTouchArea::nested() { QScopedPointer<QQuickView> window(createAndShowView("nested.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point11"); QQuickTouchPoint *point12 = window->rootObject()->findChild<QQuickTouchPoint*>("point12"); @@ -574,13 +574,13 @@ void tst_QQuickMultiPointTouchArea::nested() void tst_QQuickMultiPointTouchArea::inFlickable() { QScopedPointer<QQuickView> window(createAndShowView("inFlickable.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QQuickMultiPointTouchArea *mpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>(); - QVERIFY(mpta != 0); + QVERIFY(mpta != nullptr); QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point1"); QQuickTouchPoint *point12 = window->rootObject()->findChild<QQuickTouchPoint*>("point2"); @@ -623,7 +623,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable() //moving two points vertically p1 = QPoint(20,100); QTest::touchEvent(window.data(), device).press(0, p1).press(1, p2); - QTest::mousePress(window.data(), Qt::LeftButton, 0, p1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QQuickTouchUtils::flush(window.data()); QCOMPARE(point11->pressed(), true); @@ -658,7 +658,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QCOMPARE(flickable->property("touchCount").toInt(), 0); QTest::touchEvent(window.data(), device).release(0, p1).release(1, p2); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, p1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QQuickTouchUtils::flush(window.data()); QTRY_VERIFY(!flickable->isMoving()); @@ -670,7 +670,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QQuickTouchUtils::flush(window.data()); // ensure that mouse events do not fall through to the Flickable mpta->setMaximumTouchPoints(3); - QTest::mousePress(window.data(), Qt::LeftButton, 0, p1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(point11->pressed(), true); QCOMPARE(point12->pressed(), true); @@ -720,7 +720,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QCOMPARE(point12->pressed(), true); QTest::touchEvent(window.data(), device).release(0, p1).release(1, p2); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, p1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QQuickTouchUtils::flush(window.data()); } @@ -728,10 +728,10 @@ void tst_QQuickMultiPointTouchArea::inFlickable() void tst_QQuickMultiPointTouchArea::inFlickable2() { QScopedPointer<QQuickView> window(createAndShowView("inFlickable2.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable"); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point1"); QVERIFY(point11); @@ -743,7 +743,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable2() // move point horizontally, out of Flickable area QTest::touchEvent(window.data(), device).press(0, p1); QQuickTouchUtils::flush(window.data()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, p1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1); p1 += QPoint(15,0); QTest::touchEvent(window.data(), device).move(0, p1); @@ -770,7 +770,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable2() QTest::touchEvent(window.data(), device).release(0, p1); QQuickTouchUtils::flush(window.data()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, p1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QTest::qWait(50); QTRY_VERIFY(!flickable->isMoving()); @@ -813,13 +813,13 @@ void tst_QQuickMultiPointTouchArea::inFlickable2() void tst_QQuickMultiPointTouchArea::inMouseArea() { QScopedPointer<QQuickView> window(createAndShowView("inMouseArea.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea *>(window->rootObject()); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QQuickMultiPointTouchArea *mpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>("mpta"); - QVERIFY(mpta != 0); + QVERIFY(mpta != nullptr); QPoint innerPoint(40,100); QPoint outerPoint(10,100); @@ -829,15 +829,15 @@ void tst_QQuickMultiPointTouchArea::inMouseArea() QTest::touchEvent(window.data(), device).release(0, innerPoint); QVERIFY(!mpta->property("pressed").toBool()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, outerPoint); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, outerPoint); QVERIFY(mouseArea->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, outerPoint); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, outerPoint); QVERIFY(!mouseArea->property("pressed").toBool()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, innerPoint); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, innerPoint); QVERIFY(mpta->property("pressed").toBool()); QVERIFY(!mouseArea->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, innerPoint); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, innerPoint); QVERIFY(!mpta->property("pressed").toBool()); QVERIFY(!mouseArea->property("pressed").toBool()); @@ -854,10 +854,10 @@ void tst_QQuickMultiPointTouchArea::inMouseArea() QVERIFY(!mpta->property("pressed").toBool()); // Right click should pass through - QTest::mousePress(window.data(), Qt::RightButton, 0, innerPoint); + QTest::mousePress(window.data(), Qt::RightButton, Qt::NoModifier, innerPoint); QVERIFY(mouseArea->property("pressed").toBool()); QVERIFY(!mpta->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::RightButton, 0, innerPoint); + QTest::mouseRelease(window.data(), Qt::RightButton, Qt::NoModifier, innerPoint); mpta->setProperty("mouseEnabled", false); @@ -868,15 +868,15 @@ void tst_QQuickMultiPointTouchArea::inMouseArea() QVERIFY(!mpta->property("pressed").toBool()); QVERIFY(!mouseArea->property("pressed").toBool()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, outerPoint); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, outerPoint); QVERIFY(mouseArea->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, outerPoint); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, outerPoint); QVERIFY(!mouseArea->property("pressed").toBool()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, innerPoint); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, innerPoint); QVERIFY(!mpta->property("pressed").toBool()); QVERIFY(mouseArea->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, innerPoint); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, innerPoint); QVERIFY(!mpta->property("pressed").toBool()); QVERIFY(!mouseArea->property("pressed").toBool()); @@ -896,10 +896,10 @@ void tst_QQuickMultiPointTouchArea::inMouseArea() void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() { QScopedPointer<QQuickView> window(createAndShowView("dualGestures.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *dualmpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>("dualTouchArea"); - QVERIFY(dualmpta != 0); + QVERIFY(dualmpta != nullptr); QQuickItem *touch1rect = window->rootObject()->findChild<QQuickItem*>("touch1rect"); QQuickItem *touch2rect = window->rootObject()->findChild<QQuickItem*>("touch2rect"); @@ -923,18 +923,18 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QCOMPARE(touch2rect->property("y").toInt(), touch2.y()); QTest::touchEvent(window.data(), device).release(1, touch1).move(2, touch2); touch1.setY(20); - QTest::mousePress(window.data(), Qt::LeftButton, 0, touch1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, touch1); QQuickTouchUtils::flush(window.data()); QCOMPARE(touch1rect->property("x").toInt(), touch1.x()); QCOMPARE(touch1rect->property("y").toInt(), touch1.y()); QCOMPARE(touch2rect->property("x").toInt(), touch2.x()); QCOMPARE(touch2rect->property("y").toInt(), touch2.y()); QTest::touchEvent(window.data(), device).release(2, touch2); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, touch1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, touch1); QQuickTouchUtils::flush(window.data()); // Start with mouse, move it, touch second point, move it - QTest::mousePress(window.data(), Qt::LeftButton, 0, touch1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, touch1); touch1.setX(60); QTest::mouseMove(window.data(), touch1); QCOMPARE(touch1rect->property("x").toInt(), touch1.x()); @@ -963,7 +963,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QCOMPARE(touch2rect->property("y").toInt(), touch2.y()); // Release all - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, touch1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, touch1); QTest::touchEvent(window.data(), device).release(3, touch2); QQuickTouchUtils::flush(window.data()); QTest::touchEvent(window.data(), device).release(4, touch3); @@ -982,7 +982,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QPoint touch3(340,100); QPoint touch4(540,10); - QTest::mousePress(window.data(), Qt::LeftButton, 0, mouse1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, mouse1); QCOMPARE(touch1rect->property("x").toInt(), mouse1.x()); QCOMPARE(touch1rect->property("y").toInt(), mouse1.y()); QTest::touchEvent(window.data(), device).press(1, touch1); @@ -1006,7 +1006,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QCOMPARE(touch5rect->property("y").toInt(), touch4.y()); // Release all - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, mouse1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, mouse1); QTest::touchEvent(window.data(), device).release(1, touch1).release(2, touch2).release(3, touch3).release(4, touch4); QQuickTouchUtils::flush(window.data()); } @@ -1024,7 +1024,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() // Start with mouse, move it, touch a point, move it, touch another. // Mouse is ignored, both touch points are heeded. - QTest::mousePress(window.data(), Qt::LeftButton, 0, mouse1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, mouse1); mouse1.setX(60); QTest::mouseMove(window.data(), mouse1); QCOMPARE(touch1rect->property("x").toInt(), 10); @@ -1047,7 +1047,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QCOMPARE(touch2rect->property("y").toInt(), touch2.y()); // Release all - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, mouse1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, mouse1); QTest::touchEvent(window.data(), device).release(1, touch1); QQuickTouchUtils::flush(window.data()); QTest::touchEvent(window.data(), device).release(2, touch2); @@ -1063,10 +1063,10 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() void tst_QQuickMultiPointTouchArea::invisible() { QScopedPointer<QQuickView> window(createAndShowView("signalTest.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject()); - QVERIFY(area != 0); + QVERIFY(area != nullptr); area->setVisible(false); @@ -1124,10 +1124,10 @@ void tst_QQuickMultiPointTouchArea::transformedTouchArea() QScopedPointer<QQuickView> view(createAndShowView("transformedMultiPointTouchArea.qml")); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); QQuickMultiPointTouchArea *area = view->rootObject()->findChild<QQuickMultiPointTouchArea *>("touchArea"); - QVERIFY(area != 0); + QVERIFY(area != nullptr); QTest::QTouchEventSequence sequence = QTest::touchEvent(view.data(), device); @@ -1143,7 +1143,7 @@ void tst_QQuickMultiPointTouchArea::transformedTouchArea() QQuickView *tst_QQuickMultiPointTouchArea::createAndShowView(const QString &file) { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl(file)); const QRect screenGeometry = window->screen()->availableGeometry(); const QSize size = window->size(); @@ -1171,16 +1171,16 @@ void tst_QQuickMultiPointTouchArea::mouseInteraction() QFETCH(int, accept); QScopedPointer<QQuickView> view(createAndShowView("mouse.qml")); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(view->rootObject()); - QVERIFY(area != 0); + QVERIFY(area != nullptr); QQuickTouchPoint *point1 = view->rootObject()->findChild<QQuickTouchPoint*>("point1"); QCOMPARE(point1->pressed(), false); QCOMPARE(area->property("touchCount").toInt(), 0); QPoint p1 = QPoint(100, 100); - QTest::mousePress(view.data(), (Qt::MouseButton) buttons, 0, p1); + QTest::mousePress(view.data(), (Qt::MouseButton) buttons, Qt::NoModifier, p1); QCOMPARE(area->property("touchCount").toInt(), accept); QCOMPARE(point1->pressed(), accept != 0); p1 += QPoint(10, 10); @@ -1199,7 +1199,7 @@ void tst_QQuickMultiPointTouchArea::mouseInteraction() void tst_QQuickMultiPointTouchArea::cancel() { QScopedPointer<QQuickView> window(createAndShowView("cancel.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject()); QTest::QTouchEventSequence sequence = QTest::touchEvent(window.data(), device); diff --git a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp index 1716bdeafb..2661762669 100644 --- a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp +++ b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp @@ -61,9 +61,9 @@ class TestPaintedItem : public QQuickPaintedItem { Q_OBJECT public: - TestPaintedItem(QQuickItem *parent = 0) + TestPaintedItem(QQuickItem *parent = nullptr) : QQuickPaintedItem(parent) - , paintNode(0) + , paintNode(nullptr) , paintRequests(0) { } diff --git a/tests/auto/quick/qquickpath/tst_qquickpath.cpp b/tests/auto/quick/qquickpath/tst_qquickpath.cpp index 106d7afd85..12a8c673b0 100644 --- a/tests/auto/quick/qquickpath/tst_qquickpath.cpp +++ b/tests/auto/quick/qquickpath/tst_qquickpath.cpp @@ -53,7 +53,7 @@ void tst_QuickPath::arc() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("arc.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 0.); QCOMPARE(obj->startY(), 0.); @@ -62,7 +62,7 @@ void tst_QuickPath::arc() QCOMPARE(list.count(), 1); QQuickPathArc* arc = qobject_cast<QQuickPathArc*>(list.at(0)); - QVERIFY(arc != 0); + QVERIFY(arc != nullptr); QCOMPARE(arc->x(), 100.); QCOMPARE(arc->y(), 100.); QCOMPARE(arc->radiusX(), 100.); @@ -88,13 +88,13 @@ void tst_QuickPath::angleArc() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("anglearc.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QQmlListReference list(obj, "pathElements"); QCOMPARE(list.count(), 1); QQuickPathAngleArc* arc = qobject_cast<QQuickPathAngleArc*>(list.at(0)); - QVERIFY(arc != 0); + QVERIFY(arc != nullptr); QCOMPARE(arc->centerX(), 100.); QCOMPARE(arc->centerY(), 100.); QCOMPARE(arc->radiusX(), 50.); @@ -127,7 +127,7 @@ void tst_QuickPath::catmullromCurve() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("curve.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 0.); QCOMPARE(obj->startY(), 0.); @@ -136,12 +136,12 @@ void tst_QuickPath::catmullromCurve() QCOMPARE(list.count(), 3); QQuickPathCatmullRomCurve* curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(0)); - QVERIFY(curve != 0); + QVERIFY(curve != nullptr); QCOMPARE(curve->x(), 100.); QCOMPARE(curve->y(), 50.); curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(2)); - QVERIFY(curve != 0); + QVERIFY(curve != nullptr); QCOMPARE(curve->x(), 100.); QCOMPARE(curve->y(), 150.); @@ -163,7 +163,7 @@ void tst_QuickPath::closedCatmullromCurve() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("closedcurve.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 50.); QCOMPARE(obj->startY(), 50.); @@ -172,7 +172,7 @@ void tst_QuickPath::closedCatmullromCurve() QCOMPARE(list.count(), 3); QQuickPathCatmullRomCurve* curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(2)); - QVERIFY(curve != 0); + QVERIFY(curve != nullptr); QCOMPARE(curve->x(), 50.); QCOMPARE(curve->y(), 50.); @@ -196,7 +196,7 @@ void tst_QuickPath::svg() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("svg.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 0.); QCOMPARE(obj->startY(), 0.); @@ -205,7 +205,7 @@ void tst_QuickPath::svg() QCOMPARE(list.count(), 1); QQuickPathSvg* svg = qobject_cast<QQuickPathSvg*>(list.at(0)); - QVERIFY(svg != 0); + QVERIFY(svg != nullptr); QCOMPARE(svg->path(), QLatin1String("M200,300 Q400,50 600,300 T1000,300")); QPainterPath path = obj->path(); diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 061f71aeb0..5f7f35b5d7 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -186,7 +186,7 @@ void tst_QQuickPathView::initValues() QQmlComponent c(&engine, testFileUrl("pathview1.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(!obj->path()); QVERIFY(!obj->delegate()); QCOMPARE(obj->model(), QVariant()); @@ -217,7 +217,7 @@ void tst_QQuickPathView::items() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QCOMPARE(pathview->count(), model.count()); QCOMPARE(window->rootObject()->property("count").toInt(), model.count()); @@ -225,10 +225,10 @@ void tst_QQuickPathView::items() for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(pathview, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(pathview, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QCOMPARE(number->text(), model.number(i)); } @@ -259,7 +259,7 @@ void tst_QQuickPathView::initialCurrentItem() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QVERIFY(pathview->currentIndex() != -1); QVERIFY(!window->rootObject()->property("currentItemIsNull").toBool()); } @@ -270,9 +270,9 @@ void tst_QQuickPathView::pathview2() QQmlComponent c(&engine, testFileUrl("pathview2.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->path() != 0); - QVERIFY(obj->delegate() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->path() != nullptr); + QVERIFY(obj->delegate() != nullptr); QVERIFY(obj->model() != QVariant()); QCOMPARE(obj->currentIndex(), 0); QCOMPARE(obj->offset(), 0.); @@ -290,9 +290,9 @@ void tst_QQuickPathView::pathview3() QQmlComponent c(&engine, testFileUrl("pathview3.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->path() != 0); - QVERIFY(obj->delegate() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->path() != nullptr); + QVERIFY(obj->delegate() != nullptr); QVERIFY(obj->model() != QVariant()); QCOMPARE(obj->currentIndex(), 7); QCOMPARE(obj->offset(), 1.0); @@ -310,9 +310,9 @@ void tst_QQuickPathView::initialCurrentIndex() QQmlComponent c(&engine, testFileUrl("initialCurrentIndex.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->path() != 0); - QVERIFY(obj->delegate() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->path() != nullptr); + QVERIFY(obj->delegate() != nullptr); QVERIFY(obj->model() != QVariant()); QCOMPARE(obj->currentIndex(), 3); QCOMPARE(obj->offset(), 5.0); @@ -392,7 +392,7 @@ void tst_QQuickPathView::insertModel() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setHighlightRangeMode((QQuickPathView::HighlightRangeMode)mode); @@ -485,7 +485,7 @@ void tst_QQuickPathView::removeModel() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setHighlightRangeMode((QQuickPathView::HighlightRangeMode)mode); @@ -578,7 +578,7 @@ void tst_QQuickPathView::moveModel() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setHighlightRangeMode((QQuickPathView::HighlightRangeMode)mode); @@ -677,7 +677,7 @@ void tst_QQuickPathView::consecutiveModelChanges() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setHighlightRangeMode(mode); @@ -729,7 +729,7 @@ void tst_QQuickPathView::path() QQmlComponent c(&engine, testFileUrl("pathtest.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 120.); QCOMPARE(obj->startY(), 100.); QVERIFY(obj->path() != QPainterPath()); @@ -738,28 +738,28 @@ void tst_QQuickPathView::path() QCOMPARE(list.count(), 5); QQuickPathAttribute* attr = qobject_cast<QQuickPathAttribute*>(list.at(0)); - QVERIFY(attr != 0); + QVERIFY(attr != nullptr); QCOMPARE(attr->name(), QString("scale")); QCOMPARE(attr->value(), 1.0); QQuickPathQuad* quad = qobject_cast<QQuickPathQuad*>(list.at(1)); - QVERIFY(quad != 0); + QVERIFY(quad != nullptr); QCOMPARE(quad->x(), 120.); QCOMPARE(quad->y(), 25.); QCOMPARE(quad->controlX(), 260.); QCOMPARE(quad->controlY(), 75.); QQuickPathPercent* perc = qobject_cast<QQuickPathPercent*>(list.at(2)); - QVERIFY(perc != 0); + QVERIFY(perc != nullptr); QCOMPARE(perc->value(), 0.3); QQuickPathLine* line = qobject_cast<QQuickPathLine*>(list.at(3)); - QVERIFY(line != 0); + QVERIFY(line != nullptr); QCOMPARE(line->x(), 120.); QCOMPARE(line->y(), 100.); QQuickPathCubic* cubic = qobject_cast<QQuickPathCubic*>(list.at(4)); - QVERIFY(cubic != 0); + QVERIFY(cubic != nullptr); QCOMPARE(cubic->x(), 180.); QCOMPARE(cubic->y(), 0.); QCOMPARE(cubic->control1X(), -10.); @@ -800,7 +800,7 @@ void tst_QQuickPathView::dataModel() qApp->processEvents(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); QVERIFY(!testObject->error()); @@ -837,7 +837,7 @@ void tst_QQuickPathView::dataModel() QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); QQuickRectangle *testItem = findItem<QQuickRectangle>(pathview, "wrapper", 4); - QVERIFY(testItem != 0); + QVERIFY(testItem != nullptr); testItem = findItem<QQuickRectangle>(pathview, "wrapper", 5); QVERIFY(!testItem); @@ -900,7 +900,7 @@ void tst_QQuickPathView::pathMoved() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QQuickRectangle *firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0); QVERIFY(firstItem); @@ -988,7 +988,7 @@ void tst_QQuickPathView::setCurrentIndex() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QQuickRectangle *firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0); QVERIFY(firstItem); @@ -1141,13 +1141,13 @@ void tst_QQuickPathView::resetModel() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QCOMPARE(pathview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(pathview, "displayText", i); - QVERIFY(display != 0); + QVERIFY(display != nullptr); QCOMPARE(display->text(), strings.at(i)); } @@ -1159,7 +1159,7 @@ void tst_QQuickPathView::resetModel() for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(pathview, "displayText", i); - QVERIFY(display != 0); + QVERIFY(display != nullptr); QCOMPARE(display->text(), strings.at(i)); } @@ -1380,7 +1380,7 @@ void tst_QQuickPathView::emptyModel() qApp->processEvents(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QCOMPARE(pathview->offset(), qreal(0.0)); @@ -1394,7 +1394,7 @@ void tst_QQuickPathView::emptyPath() qApp->processEvents(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); delete window; } @@ -1442,7 +1442,7 @@ void tst_QQuickPathView::visualDataModel() QQmlComponent c(&engine, testFileUrl("vdm.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->count(), 3); @@ -1465,7 +1465,7 @@ void tst_QQuickPathView::undefinedPath() QQmlComponent c(&engine, testFileUrl("undefinedpath.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->count(), 3); @@ -1483,7 +1483,7 @@ void tst_QQuickPathView::mouseDrag() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QSignalSpy movingSpy(pathview, SIGNAL(movingChanged())); QSignalSpy moveStartedSpy(pathview, SIGNAL(movementStarted())); @@ -1494,7 +1494,7 @@ void tst_QQuickPathView::mouseDrag() int current = pathview->currentIndex(); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10,100)); QTest::qWait(100); { @@ -1531,7 +1531,7 @@ void tst_QQuickPathView::mouseDrag() QVERIFY(pathview->currentIndex() != current); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(40,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(40,100)); QVERIFY(!pathview->isDragging()); QCOMPARE(draggingSpy.count(), 2); QCOMPARE(dragStartedSpy.count(), 1); @@ -1554,7 +1554,7 @@ void tst_QQuickPathView::nestedMouseAreaDrag() QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); // Dragging the child mouse area should move it and not animate the PathView flick(window.data(), QPoint(200,200), QPoint(400,200), 200); @@ -1577,7 +1577,7 @@ void tst_QQuickPathView::treeModel() window->setSource(testFileUrl("treemodel.qml")); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QCOMPARE(pathview->count(), 3); QQuickText *item = findItem<QQuickText>(pathview, "wrapper", 0); @@ -1603,7 +1603,7 @@ void tst_QQuickPathView::changePreferredHighlight() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); int current = pathview->currentIndex(); QCOMPARE(current, 0); @@ -1656,7 +1656,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setPreferredHighlightBegin(0.5); pathview->setPreferredHighlightEnd(0.5); @@ -1667,7 +1667,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() QCOMPARE(pathview->count(), model.count()); - QQuickRectangle *item = 0; + QQuickRectangle *item = nullptr; QTRY_VERIFY(item = findItem<QQuickRectangle>(pathview, "wrapper", 0)); QQuickPath *path = qobject_cast<QQuickPath*>(pathview->path()); @@ -1734,7 +1734,7 @@ void tst_QQuickPathView::asynchronous() QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject()); QVERIFY(rootObject); - QQuickPathView *pathview = 0; + QQuickPathView *pathview = nullptr; while (!pathview) { bool b = false; controller.incubateWhile(&b); @@ -1743,8 +1743,8 @@ void tst_QQuickPathView::asynchronous() // items will be created one at a time for (int i = 0; i < 5; ++i) { - QVERIFY(findItem<QQuickItem>(pathview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(pathview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -1806,14 +1806,14 @@ void tst_QQuickPathView::cancelDrag() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QSignalSpy draggingSpy(pathview, SIGNAL(draggingChanged())); QSignalSpy dragStartedSpy(pathview, SIGNAL(dragStarted())); QSignalSpy dragEndedSpy(pathview, SIGNAL(dragEnded())); // drag between snap points - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10,100)); QTest::qWait(100); QTest::mouseMove(window.data(), QPoint(80, 100)); QTest::mouseMove(window.data(), QPoint(130, 100)); @@ -1837,7 +1837,7 @@ void tst_QQuickPathView::cancelDrag() QCOMPARE(dragStartedSpy.count(), 1); QCOMPARE(dragEndedSpy.count(), 1); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(40,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(40,100)); } @@ -1852,7 +1852,7 @@ void tst_QQuickPathView::maximumFlickVelocity() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setMaximumFlickVelocity(700); flick(window.data(), QPoint(200,10), QPoint(10,10), 180); @@ -1899,7 +1899,7 @@ void tst_QQuickPathView::snapToItem() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); window->rootObject()->setProperty("enforceRange", enforceRange); QTRY_VERIFY(!pathview->isMoving()); // ensure stable @@ -1943,7 +1943,7 @@ void tst_QQuickPathView::snapOneItem() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); window->rootObject()->setProperty("enforceRange", enforceRange); @@ -1996,7 +1996,7 @@ void tst_QQuickPathView::positionViewAtIndex() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); window->rootObject()->setProperty("enforceRange", enforceRange); if (pathItemCount == -1) @@ -2059,9 +2059,9 @@ void tst_QQuickPathView::indexAt_itemAt() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); - QQuickItem *item = 0; + QQuickItem *item = nullptr; if (index >= 0) { item = findItem<QQuickItem>(pathview, "wrapper", index); QVERIFY(item); @@ -2093,7 +2093,7 @@ void tst_QQuickPathView::cacheItemCount() qApp->processEvents(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QMetaObject::invokeMethod(pathview, "addColor", Q_ARG(QVariant, QString("orange"))); QMetaObject::invokeMethod(pathview, "addColor", Q_ARG(QVariant, QString("lightsteelblue"))); @@ -2119,8 +2119,8 @@ void tst_QQuickPathView::cacheItemCount() int i = 0; while (cached[i] >= 0) { // items will be created one at a time - QVERIFY(findItem<QQuickItem>(pathview, "wrapper", cached[i]) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(pathview, "wrapper", cached[i]) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -2147,8 +2147,8 @@ void tst_QQuickPathView::cacheItemCount() QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 11)); // one item prepended async. - QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 5) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 5) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -2184,7 +2184,7 @@ void tst_QQuickPathView::changePathDuringRefill() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathView = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathView != 0); + QVERIFY(pathView != nullptr); testCurrentIndexChange(pathView, QStringList() << "delegateC" << "delegateA" << "delegateB"); @@ -2212,10 +2212,10 @@ void tst_QQuickPathView::nestedinFlickable() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "pathView"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy movingSpy(pathview, SIGNAL(movingChanged())); QSignalSpy moveStartedSpy(pathview, SIGNAL(movementStarted())); @@ -2227,7 +2227,7 @@ void tst_QQuickPathView::nestedinFlickable() int waitInterval = 5; - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(23,218)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(23,218)); QTest::mouseMove(window.data(), QPoint(25,218), waitInterval); QTest::mouseMove(window.data(), QPoint(26,218), waitInterval); @@ -2246,7 +2246,7 @@ void tst_QQuickPathView::nestedinFlickable() QCOMPARE(fflickEndedSpy.count(), 0); // no further moves after the initial move beyond threshold - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(73,219)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(73,219)); QTRY_COMPARE(movingSpy.count(), 2); QTRY_COMPARE(moveEndedSpy.count(), 1); QCOMPARE(moveStartedSpy.count(), 1); @@ -2267,10 +2267,10 @@ void tst_QQuickPathView::flickableDelegate() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(pathview->currentItem()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy movingSpy(pathview, SIGNAL(movingChanged())); QSignalSpy moveStartedSpy(pathview, SIGNAL(movementStarted())); @@ -2282,7 +2282,7 @@ void tst_QQuickPathView::flickableDelegate() int waitInterval = 5; - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(23,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(23,100)); QTest::mouseMove(window.data(), QPoint(25,100), waitInterval); QTest::mouseMove(window.data(), QPoint(26,100), waitInterval); @@ -2301,7 +2301,7 @@ void tst_QQuickPathView::flickableDelegate() QCOMPARE(fflickEndedSpy.count(), 0); // no further moves after the initial move beyond threshold - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(53,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(53,100)); QTRY_COMPARE(fflickingSpy.count(), 2); QTRY_COMPARE(fflickStartedSpy.count(), 1); QCOMPARE(fflickEndedSpy.count(), 1); @@ -2379,7 +2379,7 @@ void tst_QQuickPathView::qtbug42716() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathView = findItem<QQuickPathView>(window->rootObject(), "pathView"); - QVERIFY(pathView != 0); + QVERIFY(pathView != nullptr); int order1[] = {5,6,7,0,1,2,3}; int missing1 = 4; @@ -2498,7 +2498,7 @@ void tst_QQuickPathView::movementDirection() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QVERIFY(pathview->offset() == 0.0); QVERIFY(pathview->currentIndex() == 0); pathview->setMovementDirection(movementdirection); @@ -2514,7 +2514,7 @@ void tst_QQuickPathView::removePath() window->show(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QVERIFY(QMetaObject::invokeMethod(pathview, "removePath")); QVERIFY(QMetaObject::invokeMethod(pathview, "setPath")); diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp index c1a51fd659..fd81c0a67c 100644 --- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp +++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp @@ -41,7 +41,7 @@ class tst_QQuickPinchArea: public QQmlDataTest { Q_OBJECT public: - tst_QQuickPinchArea() : device(0) { } + tst_QQuickPinchArea() : device(nullptr) { } private slots: void initTestCase(); void cleanupTestCase(); @@ -76,19 +76,19 @@ void tst_QQuickPinchArea::pinchProperties() QScopedPointer<QQuickView> window(createView()); window->setSource(testFileUrl("pinchproperties.qml")); window->show(); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, pinch->target()); QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(pinch, SIGNAL(targetChanged())); pinch->setTarget(rootItem); QCOMPARE(targetSpy.count(),1); @@ -201,20 +201,20 @@ void tst_QQuickPinchArea::scale() window->setSource(testFileUrl("pinchproperties.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QPoint p1(80, 80); QPoint p2(100, 100); @@ -268,20 +268,20 @@ void tst_QQuickPinchArea::pan() window->setSource(testFileUrl("pinchproperties.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QPoint p1(80, 80); QPoint p2(100, 100); @@ -374,23 +374,23 @@ void tst_QQuickPinchArea::retouch() window->setSource(testFileUrl("pinchproperties.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QSignalSpy startedSpy(pinchArea, SIGNAL(pinchStarted(QQuickPinchEvent*))); QSignalSpy finishedSpy(pinchArea, SIGNAL(pinchFinished(QQuickPinchEvent*))); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QPoint p1(80, 80); QPoint p2(100, 100); @@ -465,20 +465,20 @@ void tst_QQuickPinchArea::cancel() window->setSource(testFileUrl("pinchproperties.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QPoint p1(80, 80); QPoint p2(100, 100); @@ -558,11 +558,11 @@ void tst_QQuickPinchArea::transformedPinchArea() view->setSource(testFileUrl("transformedPinchArea.qml")); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = view->rootObject()->findChild<QQuickPinchArea*>("pinchArea"); - QVERIFY(pinchArea != 0); + QVERIFY(pinchArea != nullptr); const int threshold = qApp->styleHints()->startDragDistance(); @@ -588,7 +588,7 @@ void tst_QQuickPinchArea::transformedPinchArea() QQuickView *tst_QQuickPinchArea::createView() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); return window; diff --git a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp index e854a109a1..bffaaf7c6e 100644 --- a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp +++ b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp @@ -431,7 +431,7 @@ void tst_qquickpixmapcache::uncached() QUrl url("image://mypixmaps/mypix"); { QQuickPixmap p; - p.load(&engine, url, 0); + p.load(&engine, url, nullptr); QImage img = p.image(); QCOMPARE(img.pixel(0,0), qRgb(255, 0, 0)); } @@ -440,7 +440,7 @@ void tst_qquickpixmapcache::uncached() MyPixmapProvider::fillColor = qRgb(0, 255, 0); { QQuickPixmap p; - p.load(&engine, url, 0); + p.load(&engine, url, nullptr); QImage img = p.image(); QCOMPARE(img.pixel(0,0), qRgb(0, 255, 0)); } @@ -458,7 +458,7 @@ void tst_qquickpixmapcache::uncached() MyPixmapProvider::fillColor = qRgb(255, 0, 255); { QQuickPixmap p; - p.load(&engine, url, 0); + p.load(&engine, url, nullptr); QImage img = p.image(); QCOMPARE(img.pixel(0,0), qRgb(255, 0, 255)); } diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp index 25e34b980b..0395b08f10 100644 --- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp +++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp @@ -313,13 +313,13 @@ void tst_qquickpositioners::test_horizontal() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -357,13 +357,13 @@ void tst_qquickpositioners::test_horizontal_padding() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -377,7 +377,7 @@ void tst_qquickpositioners::test_horizontal_padding() QCOMPARE(row->height(), 50.0); QQuickRow *obj = qobject_cast<QQuickRow*>(row); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(row->property("padding").toDouble(), 0.0); QCOMPARE(row->property("topPadding").toDouble(), 0.0); @@ -519,13 +519,13 @@ void tst_qquickpositioners::test_horizontal_rtl() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 60.0); QCOMPARE(one->y(), 0.0); @@ -598,13 +598,13 @@ void tst_qquickpositioners::test_horizontal_spacing() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -642,13 +642,13 @@ void tst_qquickpositioners::test_horizontal_spacing_rightToLeft() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 80.0); QCOMPARE(one->y(), 0.0); @@ -686,13 +686,13 @@ void tst_qquickpositioners::test_horizontal_animated() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); //Note that they animate in QCOMPARE(one->x(), -100.0); @@ -739,13 +739,13 @@ void tst_qquickpositioners::test_horizontal_animated_padding() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); //Note that they animate in QCOMPARE(one->x(), -100.0); @@ -803,13 +803,13 @@ void tst_qquickpositioners::test_horizontal_animated_rightToLeft() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); //Note that they animate in QCOMPARE(one->x(), -100.0); @@ -858,13 +858,13 @@ void tst_qquickpositioners::test_horizontal_animated_rightToLeft_padding() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); //Note that they animate in QCOMPARE(one->x(), -100.0); @@ -922,13 +922,13 @@ void tst_qquickpositioners::test_horizontal_animated_disabled() QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated-disabled.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row"); QVERIFY(row); @@ -970,13 +970,13 @@ void tst_qquickpositioners::test_horizontal_animated_disabled_padding() QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated-disabled.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row"); QVERIFY(row); @@ -1390,7 +1390,7 @@ void tst_qquickpositioners::checkItemPositions(QQuickItem *positioner, QaimModel QVERIFY2(false, "Unknown positioner type"); } QQuickText *name = findItem<QQuickText>(positioner, "name", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model->name(i)); padding += i * incrementalSize; @@ -1403,13 +1403,13 @@ void tst_qquickpositioners::test_vertical() QScopedPointer<QQuickView> window(createView(testFile("vertical.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1446,13 +1446,13 @@ void tst_qquickpositioners::test_vertical_padding() QScopedPointer<QQuickView> window(createView(testFile("vertical.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1467,7 +1467,7 @@ void tst_qquickpositioners::test_vertical_padding() QCOMPARE(column->width(), 50.0); QQuickColumn *obj = qobject_cast<QQuickColumn*>(column); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(column->property("padding").toDouble(), 0.0); QCOMPARE(column->property("topPadding").toDouble(), 0.0); @@ -1607,13 +1607,13 @@ void tst_qquickpositioners::test_vertical_spacing() QScopedPointer<QQuickView> window(createView(testFile("vertical-spacing.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1650,15 +1650,15 @@ void tst_qquickpositioners::test_vertical_animated() //Note that they animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->y(), -100.0); QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn @@ -1699,15 +1699,15 @@ void tst_qquickpositioners::test_vertical_animated_padding() //Note that they animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->y(), -100.0); QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn @@ -1758,15 +1758,15 @@ void tst_qquickpositioners::test_grid() QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1811,15 +1811,15 @@ void tst_qquickpositioners::test_grid_padding() QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1999,15 +1999,15 @@ void tst_qquickpositioners::test_grid_topToBottom() QScopedPointer<QQuickView> window(createView(testFile("grid-toptobottom.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2054,15 +2054,15 @@ void tst_qquickpositioners::test_grid_rightToLeft() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 50.0); QCOMPARE(one->y(), 0.0); @@ -2154,15 +2154,15 @@ void tst_qquickpositioners::test_grid_spacing() QScopedPointer<QQuickView> window(createView(testFile("grid-spacing.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2206,15 +2206,15 @@ void tst_qquickpositioners::test_grid_row_column_spacing() QScopedPointer<QQuickView> window(createView(testFile("grid-row-column-spacing.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2261,27 +2261,27 @@ void tst_qquickpositioners::test_grid_animated() //Note that all animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->x(), -100.0); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->x(), -100.0); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->x(), -100.0); QCOMPARE(three->y(), -100.0); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QCOMPARE(four->x(), -100.0); QCOMPARE(four->y(), -100.0); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); @@ -2345,27 +2345,27 @@ void tst_qquickpositioners::test_grid_animated_padding() //Note that all animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->x(), -100.0); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->x(), -100.0); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->x(), -100.0); QCOMPARE(three->y(), -100.0); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QCOMPARE(four->x(), -100.0); QCOMPARE(four->y(), -100.0); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); @@ -2439,27 +2439,27 @@ void tst_qquickpositioners::test_grid_animated_rightToLeft() //Note that all animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->x(), -100.0); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->x(), -100.0); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->x(), -100.0); QCOMPARE(three->y(), -100.0); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QCOMPARE(four->x(), -100.0); QCOMPARE(four->y(), -100.0); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); @@ -2523,27 +2523,27 @@ void tst_qquickpositioners::test_grid_animated_rightToLeft_padding() //Note that all animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->x(), -100.0); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->x(), -100.0); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->x(), -100.0); QCOMPARE(three->y(), -100.0); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QCOMPARE(four->x(), -100.0); QCOMPARE(four->y(), -100.0); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); @@ -2614,15 +2614,15 @@ void tst_qquickpositioners::test_grid_zero_columns() QScopedPointer<QQuickView> window(createView(testFile("gridzerocolumns.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2668,15 +2668,15 @@ void tst_qquickpositioners::test_grid_H_alignment() window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignHCenter); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2747,15 +2747,15 @@ void tst_qquickpositioners::test_grid_H_alignment_padding() window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignHCenter); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2836,15 +2836,15 @@ void tst_qquickpositioners::test_grid_V_alignment() window->rootObject()->setProperty("testVAlignment", QQuickGrid::AlignVCenter); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2879,15 +2879,15 @@ void tst_qquickpositioners::test_grid_V_alignment_padding() window->rootObject()->setProperty("testVAlignment", QQuickGrid::AlignVCenter); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid"); QCOMPARE(grid->width(), 100.0); @@ -2934,7 +2934,7 @@ void tst_qquickpositioners::test_propertychanges() QScopedPointer<QQuickView> window(createView(testFile("propertychangestest.qml"))); QQuickGrid *grid = qobject_cast<QQuickGrid*>(window->rootObject()); - QVERIFY(grid != 0); + QVERIFY(grid != nullptr); QQuickTransition *rowTransition = window->rootObject()->findChild<QQuickTransition*>("rowTransition"); QQuickTransition *columnTransition = window->rootObject()->findChild<QQuickTransition*>("columnTransition"); @@ -2963,8 +2963,8 @@ void tst_qquickpositioners::test_propertychanges() QCOMPARE(addSpy.count(),1); QCOMPARE(moveSpy.count(),1); - grid->setAdd(0); - grid->setMove(0); + grid->setAdd(nullptr); + grid->setMove(nullptr); QCOMPARE(addSpy.count(),2); QCOMPARE(moveSpy.count(),2); @@ -2992,13 +2992,13 @@ void tst_qquickpositioners::test_repeater() QScopedPointer<QQuickView> window(createView(testFile("repeatertest.qml"))); QQuickRectangle *one = findItem<QQuickRectangle>(window->contentItem(), "one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = findItem<QQuickRectangle>(window->contentItem(), "two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = findItem<QQuickRectangle>(window->contentItem(), "three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3014,13 +3014,13 @@ void tst_qquickpositioners::test_repeater_padding() QScopedPointer<QQuickView> window(createView(testFile("repeatertest-padding.qml"))); QQuickRectangle *one = findItem<QQuickRectangle>(window->contentItem(), "one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = findItem<QQuickRectangle>(window->contentItem(), "two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = findItem<QQuickRectangle>(window->contentItem(), "three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 3.0); QCOMPARE(one->y(), 2.0); @@ -3038,15 +3038,15 @@ void tst_qquickpositioners::test_flow() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3093,15 +3093,15 @@ void tst_qquickpositioners::test_flow_padding() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3120,7 +3120,7 @@ void tst_qquickpositioners::test_flow_padding() QCOMPARE(flow->height(), 120.0); QQuickFlow *obj = qobject_cast<QQuickFlow*>(flow); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(flow->property("padding").toDouble(), 0.0); QCOMPARE(flow->property("topPadding").toDouble(), 0.0); @@ -3286,15 +3286,15 @@ void tst_qquickpositioners::test_flow_rightToLeft() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 40.0); QCOMPARE(one->y(), 0.0); @@ -3341,15 +3341,15 @@ void tst_qquickpositioners::test_flow_topToBottom() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3393,15 +3393,15 @@ void tst_qquickpositioners::test_flow_topToBottom_padding() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3469,15 +3469,15 @@ void tst_qquickpositioners::test_flow_resize() root->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QTRY_COMPARE(one->x(), 0.0); QTRY_COMPARE(one->y(), 0.0); @@ -3502,15 +3502,15 @@ void tst_qquickpositioners::test_flow_resize_padding() root->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QTRY_COMPARE(one->x(), 3.0); QTRY_COMPARE(one->y(), 2.0); @@ -3535,15 +3535,15 @@ void tst_qquickpositioners::test_flow_resize_rightToLeft() root->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QTRY_VERIFY(one != 0); + QTRY_VERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 75.0); QCOMPARE(one->y(), 0.0); @@ -3568,15 +3568,15 @@ void tst_qquickpositioners::test_flow_resize_rightToLeft_padding() root->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QTRY_VERIFY(one != 0); + QTRY_VERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 71.0); QCOMPARE(one->y(), 2.0); @@ -3594,10 +3594,10 @@ void tst_qquickpositioners::test_flow_resize_rightToLeft_padding() void tst_qquickpositioners::test_flow_implicit_resize() { QScopedPointer<QQuickView> window(createView(testFile("flow-testimplicitsize.qml"))); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlow *flow = window->rootObject()->findChild<QQuickFlow*>("flow"); - QVERIFY(flow != 0); + QVERIFY(flow != nullptr); QCOMPARE(flow->width(), 100.0); QCOMPARE(flow->height(), 120.0); @@ -3622,10 +3622,10 @@ void tst_qquickpositioners::test_flow_implicit_resize() void tst_qquickpositioners::test_flow_implicit_resize_padding() { QScopedPointer<QQuickView> window(createView(testFile("flow-testimplicitsize.qml"))); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlow *flow = window->rootObject()->findChild<QQuickFlow*>("flow"); - QVERIFY(flow != 0); + QVERIFY(flow != nullptr); QCOMPARE(flow->width(), 100.0); QCOMPARE(flow->height(), 120.0); @@ -3841,7 +3841,7 @@ void tst_qquickpositioners::test_allInvisible() QVERIFY(root); QQuickRow *row = window->rootObject()->findChild<QQuickRow*>("row"); - QVERIFY(row != 0); + QVERIFY(row != nullptr); QCOMPARE(row->width(), qreal(0)); QCOMPARE(row->height(), qreal(0)); @@ -3856,7 +3856,7 @@ void tst_qquickpositioners::test_allInvisible() QCOMPARE(row->width(), 7.0); QQuickColumn *column = window->rootObject()->findChild<QQuickColumn*>("column"); - QVERIFY(column != 0); + QVERIFY(column != nullptr); QCOMPARE(column->width(), qreal(0)); QCOMPARE(column->height(), qreal(0)); @@ -3871,7 +3871,7 @@ void tst_qquickpositioners::test_allInvisible() QCOMPARE(column->width(), 7.0); QQuickGrid *grid = window->rootObject()->findChild<QQuickGrid*>("grid"); - QVERIFY(grid != 0); + QVERIFY(grid != nullptr); QCOMPARE(grid->width(), qreal(0)); QCOMPARE(grid->height(), qreal(0)); @@ -3886,7 +3886,7 @@ void tst_qquickpositioners::test_allInvisible() QCOMPARE(grid->width(), 7.0); QQuickFlow *flow = window->rootObject()->findChild<QQuickFlow*>("flow"); - QVERIFY(flow != 0); + QVERIFY(flow != nullptr); QCOMPARE(flow->width(), qreal(0)); QCOMPARE(flow->height(), qreal(0)); @@ -3906,10 +3906,10 @@ void tst_qquickpositioners::test_attachedproperties() QFETCH(QString, filename); QScopedPointer<QQuickView> window(createView(filename)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickRectangle *greenRect = window->rootObject()->findChild<QQuickRectangle *>("greenRect"); - QVERIFY(greenRect != 0); + QVERIFY(greenRect != nullptr); int posIndex = greenRect->property("posIndex").toInt(); QCOMPARE(posIndex, 0); @@ -3919,7 +3919,7 @@ void tst_qquickpositioners::test_attachedproperties() QVERIFY(!isLast); QQuickRectangle *yellowRect = window->rootObject()->findChild<QQuickRectangle *>("yellowRect"); - QVERIFY(yellowRect != 0); + QVERIFY(yellowRect != nullptr); posIndex = yellowRect->property("posIndex").toInt(); QCOMPARE(posIndex, -1); @@ -3952,13 +3952,13 @@ void tst_qquickpositioners::test_attachedproperties_data() void tst_qquickpositioners::test_attachedproperties_dynamic() { QScopedPointer<QQuickView> window(createView(testFile("attachedproperties-dynamic.qml"))); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickRow *row = window->rootObject()->findChild<QQuickRow *>("pos"); - QVERIFY(row != 0); + QVERIFY(row != nullptr); QQuickRectangle *rect0 = window->rootObject()->findChild<QQuickRectangle *>("rect0"); - QVERIFY(rect0 != 0); + QVERIFY(rect0 != nullptr); int posIndex = rect0->property("index").toInt(); QCOMPARE(posIndex, 0); @@ -3968,7 +3968,7 @@ void tst_qquickpositioners::test_attachedproperties_dynamic() QVERIFY(!isLast); QQuickRectangle *rect1 = window->rootObject()->findChild<QQuickRectangle *>("rect1"); - QVERIFY(rect1 != 0); + QVERIFY(rect1 != nullptr); posIndex = rect1->property("index").toInt(); QCOMPARE(posIndex, 1); @@ -3984,7 +3984,7 @@ void tst_qquickpositioners::test_attachedproperties_dynamic() QTRY_VERIFY(!rect1->property("lastItem").toBool()); QQuickRectangle *rect2 = window->rootObject()->findChild<QQuickRectangle *>("rect2"); - QVERIFY(rect2 != 0); + QVERIFY(rect2 != nullptr); posIndex = rect2->property("index").toInt(); QCOMPARE(posIndex, 2); @@ -3995,7 +3995,7 @@ void tst_qquickpositioners::test_attachedproperties_dynamic() row->metaObject()->invokeMethod(row, "destroySubRect"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QTRY_COMPARE(rect1->property("index").toInt(), 1); @@ -4006,7 +4006,7 @@ void tst_qquickpositioners::test_attachedproperties_dynamic() QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait) { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); qDebug() << "1"; window->setSource(QUrl::fromLocalFile(filename)); diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp index 3519c53cb7..0499e2f9a6 100644 --- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp +++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp @@ -119,7 +119,7 @@ void tst_QQuickRepeater::numberModel() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QCOMPARE(repeater->parentItem()->childItems().count(), 5+1); QVERIFY(!repeater->itemAt(-1)); @@ -160,7 +160,7 @@ void tst_QQuickRepeater::objectList() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QCOMPARE(repeater->property("errors").toInt(), 0);//If this fails either they are out of order or can't find the object's data QCOMPARE(repeater->property("instantiated").toInt(), 100); @@ -201,10 +201,10 @@ void tst_QQuickRepeater::stringList() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->childItems().count(), data.count() + 3); @@ -213,7 +213,7 @@ void tst_QQuickRepeater::stringList() if (i == 0) { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), QLatin1String("Zero")); } else if (i == container->childItems().count() - 2) { // The repeater itself @@ -223,11 +223,11 @@ void tst_QQuickRepeater::stringList() continue; } else if (i == container->childItems().count() - 1) { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), QLatin1String("Last")); } else { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), data.at(i-1)); } } @@ -249,9 +249,9 @@ void tst_QQuickRepeater::dataModel_adding() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QVERIFY(!repeater->itemAt(0)); @@ -331,9 +331,9 @@ void tst_QQuickRepeater::dataModel_removing() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->childItems().count(), repeater->count()+1); QSignalSpy countSpy(repeater, SIGNAL(countChanged())); @@ -397,9 +397,9 @@ void tst_QQuickRepeater::dataModel_changes() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->childItems().count(), repeater->count()+1); // Check that model changes are propagated @@ -431,10 +431,10 @@ void tst_QQuickRepeater::itemModel() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->childItems().count(), 1); @@ -474,9 +474,9 @@ void tst_QQuickRepeater::resetModel() window->setSource(testFileUrl("repeater1.qml")); qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(repeater->count(), dataA.count()); for (int i=0; i<repeater->count(); i++) @@ -567,9 +567,9 @@ void tst_QQuickRepeater::modelReset() QVERIFY(rootItem); QQuickRepeater *repeater = findItem<QQuickRepeater>(rootItem, "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(rootItem, "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(repeater->count(), 0); @@ -701,7 +701,7 @@ void tst_QQuickRepeater::asynchronous() container = findItem<QQuickItem>(rootObject, "container"); } - QQuickRepeater *repeater = 0; + QQuickRepeater *repeater = nullptr; while (!repeater) { bool b = false; controller.incubateWhile(&b); @@ -713,8 +713,8 @@ void tst_QQuickRepeater::asynchronous() for (int i = 9; i >= 0; --i) { QString name("delegate"); name += QString::number(i); - QVERIFY(findItem<QQuickItem>(container, name) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(container, name) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -804,7 +804,7 @@ void tst_QQuickRepeater::invalidContextCrash() // deleted first and then the repeater. During deletion the QML context // has been deleted already and is invalid. model->setParent(root.data()); - repeater->setParent(0); + repeater->setParent(nullptr); repeater->setParent(root.data()); QCOMPARE(root->children().count(), 2); @@ -813,7 +813,7 @@ void tst_QQuickRepeater::invalidContextCrash() // Delete the root object, which will invalidate/delete the QML context // and then delete the child QObjects, which may try to access the context. - root.reset(0); + root.reset(nullptr); } void tst_QQuickRepeater::jsArrayChange() diff --git a/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp b/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp index 1731253da6..f601f520bb 100644 --- a/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp +++ b/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp @@ -280,7 +280,7 @@ void tst_qquickshadereffect::lookThroughShaderCode() void tst_qquickshadereffect::deleteSourceItem() { // purely to ensure that deleting the sourceItem of a shader doesn't cause a crash - QQuickView *view = new QQuickView(0); + QQuickView *view = new QQuickView(nullptr); view->setSource(QUrl::fromLocalFile(testFile("deleteSourceItem.qml"))); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -295,7 +295,7 @@ void tst_qquickshadereffect::deleteSourceItem() void tst_qquickshadereffect::deleteShaderEffectSource() { // purely to ensure that deleting the sourceItem of a shader doesn't cause a crash - QQuickView *view = new QQuickView(0); + QQuickView *view = new QQuickView(nullptr); view->setSource(QUrl::fromLocalFile(testFile("deleteShaderEffectSource.qml"))); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -310,7 +310,7 @@ void tst_qquickshadereffect::deleteShaderEffectSource() void tst_qquickshadereffect::twoImagesOneShaderEffect() { // purely to ensure that deleting the sourceItem of a shader doesn't cause a crash - QQuickView *view = new QQuickView(0); + QQuickView *view = new QQuickView(nullptr); view->setSource(QUrl::fromLocalFile(testFile("twoImagesOneShaderEffect.qml"))); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); diff --git a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp index d78a38a662..14d2e858e8 100644 --- a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp +++ b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp @@ -64,7 +64,7 @@ void tst_qquicksmoothedanimation::defaultValues() QQmlComponent c(&engine, testFileUrl("smoothedanimation1.qml")); QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 0.); QCOMPARE(obj->velocity(), 200.); @@ -81,7 +81,7 @@ void tst_qquicksmoothedanimation::values() QQmlComponent c(&engine, testFileUrl("smoothedanimation2.qml")); QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 10.); QCOMPARE(obj->velocity(), 200.); @@ -98,7 +98,7 @@ void tst_qquicksmoothedanimation::disabled() QQmlComponent c(&engine, testFileUrl("smoothedanimation3.qml")); QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 10.); QCOMPARE(obj->velocity(), 250.); @@ -259,7 +259,7 @@ void tst_qquicksmoothedanimation::noStart() QQmlComponent c(&engine, testFileUrl("smoothedanimation1.qml")); QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); obj->start(); QCOMPARE(obj->isRunning(), false); diff --git a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp index b4184ba1d3..9042e94c75 100644 --- a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp +++ b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp @@ -59,7 +59,7 @@ void tst_qquickspringanimation::defaultValues() QQmlComponent c(&engine, testFileUrl("springanimation1.qml")); QQuickSpringAnimation *obj = qobject_cast<QQuickSpringAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 0.); QCOMPARE(obj->velocity(), 0.); @@ -81,7 +81,7 @@ void tst_qquickspringanimation::values() QQuickSpringAnimation *obj = root->findChild<QQuickSpringAnimation*>(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 1.44); QCOMPARE(obj->velocity(), 0.9); @@ -103,7 +103,7 @@ void tst_qquickspringanimation::disabled() QQmlComponent c(&engine, testFileUrl("springanimation3.qml")); QQuickSpringAnimation *obj = qobject_cast<QQuickSpringAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 1.44); QCOMPARE(obj->velocity(), 0.9); diff --git a/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp b/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp index 08674c528a..e5d55a6871 100644 --- a/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp +++ b/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp @@ -47,7 +47,7 @@ private slots: void tst_qquickspritesequence::test_properties() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("basic.qml")); window->show(); @@ -75,7 +75,7 @@ void tst_qquickspritesequence::test_huge() The large allocations of memory involved and separate codepath does make a doesn't crash test worthwhile. */ - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("huge.qml")); window->show(); @@ -90,7 +90,7 @@ void tst_qquickspritesequence::test_huge() void tst_qquickspritesequence::test_framerateAdvance() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("advance.qml")); window->show(); @@ -106,7 +106,7 @@ void tst_qquickspritesequence::test_framerateAdvance() void tst_qquickspritesequence::test_jumpToCrash() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("crashonstart.qml")); window->show(); @@ -118,7 +118,7 @@ void tst_qquickspritesequence::test_jumpToCrash() void tst_qquickspritesequence::test_spriteBeforeGoal() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("spritebeforegoal.qml")); window->show(); @@ -130,7 +130,7 @@ void tst_qquickspritesequence::test_spriteBeforeGoal() void tst_qquickspritesequence::test_spriteAfterGoal() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("spriteaftergoal.qml")); window->show(); diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp index 9b152b0676..073fe33e20 100644 --- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp +++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp @@ -158,7 +158,7 @@ void tst_qquickstates::basicChanges() QQmlComponent rectComponent(&engine, testFileUrl("basicChanges.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -173,7 +173,7 @@ void tst_qquickstates::basicChanges() QQmlComponent rectComponent(&engine, testFileUrl("basicChanges2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -194,7 +194,7 @@ void tst_qquickstates::basicChanges() QQmlComponent rectComponent(&engine, testFileUrl("basicChanges3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),1.0); @@ -231,7 +231,7 @@ void tst_qquickstates::basicChanges() QVERIFY(component.isReady()); MyRect *rect = qobject_cast<MyRect*>(component.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QMetaProperty prop = rect->metaObject()->property(rect->metaObject()->indexOfProperty("propertyWithNotify")); QVERIFY(prop.hasNotifySignal()); @@ -253,7 +253,7 @@ void tst_qquickstates::attachedPropertyChanges() QVERIFY(component.isReady()); QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->width(), 50.0); // Ensure attached property has been changed @@ -274,7 +274,7 @@ void tst_qquickstates::basicExtension() QQmlComponent rectComponent(&engine, testFileUrl("basicExtension.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),1.0); @@ -308,7 +308,7 @@ void tst_qquickstates::basicExtension() QQmlComponent rectComponent(&engine, testFileUrl("fakeExtension.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -340,7 +340,7 @@ void tst_qquickstates::basicBinding() QQmlComponent rectComponent(&engine, testFileUrl("basicBinding.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -368,7 +368,7 @@ void tst_qquickstates::basicBinding() QQmlComponent rectComponent(&engine, testFileUrl("basicBinding2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -399,7 +399,7 @@ void tst_qquickstates::basicBinding() QQmlComponent rectComponent(&engine, testFileUrl("basicBinding3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); rect->setProperty("sourceColor", QColor("green")); @@ -424,7 +424,7 @@ void tst_qquickstates::basicBinding() QQmlComponent rectComponent(&engine, testFileUrl("basicBinding4.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -456,7 +456,7 @@ void tst_qquickstates::signalOverride() { QQmlComponent rectComponent(&engine, testFileUrl("signalOverride.qml")); MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); rect->doSomething(); @@ -472,7 +472,7 @@ void tst_qquickstates::signalOverride() { QQmlComponent rectComponent(&engine, testFileUrl("signalOverride2.qml")); MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("white")); rect->doSomething(); @@ -495,7 +495,7 @@ void tst_qquickstates::signalOverrideCrash() QQmlComponent rectComponent(&engine, testFileUrl("signalOverrideCrash.qml")); MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate::get(rect)->setState("overridden"); rect->doSomething(); @@ -507,7 +507,7 @@ void tst_qquickstates::signalOverrideCrash2() QQmlComponent rectComponent(&engine, testFileUrl("signalOverrideCrash2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate::get(rect)->setState("state1"); QQuickItemPrivate::get(rect)->setState("state2"); @@ -522,7 +522,7 @@ void tst_qquickstates::signalOverrideCrash3() QQmlComponent rectComponent(&engine, testFileUrl("signalOverrideCrash3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate::get(rect)->setState("state1"); QQuickItemPrivate::get(rect)->setState(""); @@ -537,7 +537,7 @@ void tst_qquickstates::signalOverrideCrash4() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("signalOverrideCrash4.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); @@ -557,20 +557,20 @@ void tst_qquickstates::parentChange() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange1.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickParentChange *pChange = qobject_cast<QQuickParentChange*>(state->operationAt(0)); - QVERIFY(pChange != 0); + QVERIFY(pChange != nullptr); QQuickItem *nParent = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("NewParent")); - QVERIFY(nParent != 0); + QVERIFY(nParent != nullptr); QCOMPARE(pChange->parent(), nParent); @@ -584,10 +584,10 @@ void tst_qquickstates::parentChange() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); rectPrivate->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(15)); @@ -599,10 +599,10 @@ void tst_qquickstates::parentChange() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); rectPrivate->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(-37)); @@ -621,10 +621,10 @@ void tst_qquickstates::parentChange() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange6.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQuickItemPrivate::get(rect)->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(180)); @@ -641,10 +641,10 @@ void tst_qquickstates::parentChangeErrors() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange4.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale"); QQuickItemPrivate::get(rect)->setState("reparented"); @@ -657,10 +657,10 @@ void tst_qquickstates::parentChangeErrors() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange5.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform"); QQuickItemPrivate::get(rect)->setState("reparented"); @@ -677,19 +677,19 @@ void tst_qquickstates::anchorChanges() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges1.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); QCOMPARE(aChanges->anchors()->left().isUndefinedLiteral(), true); QVERIFY(!aChanges->anchors()->left().isEmpty()); @@ -714,11 +714,11 @@ void tst_qquickstates::anchorChanges2() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); rectPrivate->setState("right"); QCOMPARE(innerRect->x(), qreal(150)); @@ -735,25 +735,25 @@ void tst_qquickstates::anchorChanges3() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); + QVERIFY(leftGuideline != nullptr); QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); + QVERIFY(bottomGuideline != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); QVERIFY(!aChanges->anchors()->top().isEmpty()); QVERIFY(!aChanges->anchors()->bottom().isEmpty()); @@ -789,24 +789,24 @@ void tst_qquickstates::anchorChanges4() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges4.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); + QVERIFY(leftGuideline != nullptr); QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); + QVERIFY(bottomGuideline != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); QVERIFY(!aChanges->anchors()->horizontalCenter().isEmpty()); QVERIFY(!aChanges->anchors()->verticalCenter().isEmpty()); @@ -827,24 +827,24 @@ void tst_qquickstates::anchorChanges5() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges5.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); + QVERIFY(leftGuideline != nullptr); QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); + QVERIFY(bottomGuideline != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); QVERIFY(!aChanges->anchors()->baseline().isEmpty()); @@ -873,20 +873,20 @@ void tst_qquickstates::anchorChangesRTL() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges1.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); mirrorAnchors(innerRect); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); rectPrivate->setState("right"); QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(150)); @@ -907,11 +907,11 @@ void tst_qquickstates::anchorChangesRTL2() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); mirrorAnchors(innerRect); rectPrivate->setState("right"); @@ -929,26 +929,26 @@ void tst_qquickstates::anchorChangesRTL3() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); mirrorAnchors(innerRect); QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); + QVERIFY(leftGuideline != nullptr); QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); + QVERIFY(bottomGuideline != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); rectPrivate->setState("reanchored"); QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect)); @@ -984,7 +984,7 @@ void tst_qquickstates::anchorChangesCrash() QQmlComponent rectComponent(&engine, testFileUrl("anchorChangesCrash.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate::get(rect)->setState("reanchored"); @@ -1002,11 +1002,11 @@ void tst_qquickstates::anchorRewindBug() QVERIFY(QTest::qWaitForWindowExposed(view)); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(view->rootObject()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItem * column = rect->findChild<QQuickItem*>("column"); - QVERIFY(column != 0); + QVERIFY(column != nullptr); QVERIFY(!QQuickItemPrivate::get(column)->heightValid); QVERIFY(!QQuickItemPrivate::get(column)->widthValid); QCOMPARE(column->height(), 200.0); @@ -1036,11 +1036,11 @@ void tst_qquickstates::anchorRewindBug2() QQmlComponent rectComponent(&engine, testFileUrl("anchorRewindBug2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *mover = rect->findChild<QQuickRectangle*>("mover"); - QVERIFY(mover != 0); + QVERIFY(mover != nullptr); QCOMPARE(mover->y(), qreal(0.0)); QCOMPARE(mover->width(), qreal(50.0)); @@ -1062,7 +1062,7 @@ void tst_qquickstates::script() { QQmlComponent rectComponent(&engine, testFileUrl("script.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rect->color(),QColor("red")); @@ -1080,7 +1080,7 @@ void tst_qquickstates::restoreEntryValues() QQmlComponent rectComponent(&engine, testFileUrl("restoreEntryValues.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rect->color(),QColor("red")); @@ -1097,15 +1097,15 @@ void tst_qquickstates::explicitChanges() QQmlComponent rectComponent(&engine, testFileUrl("explicit.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickPropertyChanges *changes = qobject_cast<QQuickPropertyChanges*>(rect->findChild<QQuickPropertyChanges*>("changes")); - QVERIFY(changes != 0); + QVERIFY(changes != nullptr); QVERIFY(changes->isExplicit()); QCOMPARE(rect->color(),QColor("red")); @@ -1130,7 +1130,7 @@ void tst_qquickstates::propertyErrors() QQmlEngine engine; QQmlComponent rectComponent(&engine, testFileUrl("propertyErrors.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -1145,7 +1145,7 @@ void tst_qquickstates::incorrectRestoreBug() QQmlComponent rectComponent(&engine, testFileUrl("basicChanges.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rect->color(),QColor("red")); @@ -1172,7 +1172,7 @@ void tst_qquickstates::autoStateAtStartupRestoreBug() QQmlComponent component(&engine, testFileUrl("autoStateAtStartupRestoreBug.qml")); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("test").toInt(), 3); obj->setProperty("input", 2); @@ -1188,7 +1188,7 @@ void tst_qquickstates::deletingChange() QQmlComponent rectComponent(&engine, testFileUrl("deleting.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); @@ -1199,11 +1199,11 @@ void tst_qquickstates::deletingChange() QCOMPARE(rect->radius(),qreal(0)); QQuickPropertyChanges *pc = rect->findChild<QQuickPropertyChanges*>("pc1"); - QVERIFY(pc != 0); + QVERIFY(pc != nullptr); delete pc; QQuickState *state = rect->findChild<QQuickState*>(); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QCOMPARE(state->operationCount(), 1); @@ -1220,11 +1220,11 @@ void tst_qquickstates::deletingState() QQmlComponent rectComponent(&engine, testFileUrl("deletingState.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickStateGroup *sg = rect->findChild<QQuickStateGroup*>(); - QVERIFY(sg != 0); - QVERIFY(sg->findState("blue") != 0); + QVERIFY(sg != nullptr); + QVERIFY(sg->findState("blue") != nullptr); sg->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); @@ -1233,7 +1233,7 @@ void tst_qquickstates::deletingState() QCOMPARE(rect->color(),QColor("red")); QQuickState *state = rect->findChild<QQuickState*>(); - QVERIFY(state != 0); + QVERIFY(state != nullptr); delete state; QVERIFY(!sg->findState("blue")); @@ -1251,7 +1251,7 @@ void tst_qquickstates::tempState() QQmlComponent rectComponent(&engine, testFileUrl("legalTempState.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QTest::ignoreMessage(QtDebugMsg, "entering placed"); QTest::ignoreMessage(QtDebugMsg, "entering idle"); @@ -1265,7 +1265,7 @@ void tst_qquickstates::illegalTempState() QQmlComponent rectComponent(&engine, testFileUrl("illegalTempState.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML StateGroup: Can't apply a state change as part of a state definition."); rectPrivate->setState("placed"); @@ -1278,7 +1278,7 @@ void tst_qquickstates::nonExistantProperty() QQmlComponent rectComponent(&engine, testFileUrl("nonExistantProp.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QTest::ignoreMessage(QtWarningMsg, fullDataPath("nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\""); rectPrivate->setState("blue"); @@ -1291,10 +1291,10 @@ void tst_qquickstates::reset() QQmlComponent c(&engine, testFileUrl("reset.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickImage *image = rect->findChild<QQuickImage*>(); - QVERIFY(image != 0); + QVERIFY(image != nullptr); QCOMPARE(image->width(), qreal(40.)); QCOMPARE(image->height(), qreal(20.)); @@ -1325,7 +1325,7 @@ void tst_qquickstates::whenOrdering() QQmlComponent c(&engine, testFileUrl("whenOrdering.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rectPrivate->state(), QLatin1String("")); @@ -1348,13 +1348,13 @@ void tst_qquickstates::urlResolution() QQmlComponent c(&engine, testFileUrl("urlResolution.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItem *myType = rect->findChild<QQuickItem*>("MyType"); QQuickImage *image1 = rect->findChild<QQuickImage*>("image1"); QQuickImage *image2 = rect->findChild<QQuickImage*>("image2"); QQuickImage *image3 = rect->findChild<QQuickImage*>("image3"); - QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0); + QVERIFY(myType != nullptr && image1 != nullptr && image2 != nullptr && image3 != nullptr); QQuickItemPrivate::get(myType)->setState("SetImageState"); QUrl resolved = testFileUrl("Implementation/images/qt-logo.png"); @@ -1371,7 +1371,7 @@ void tst_qquickstates::unnamedWhen() QQmlComponent c(&engine, testFileUrl("unnamedWhen.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rectPrivate->state(), QLatin1String("")); @@ -1390,7 +1390,7 @@ void tst_qquickstates::returnToBase() QQmlComponent c(&engine, testFileUrl("returnToBase.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rectPrivate->state(), QLatin1String("")); @@ -1410,7 +1410,7 @@ void tst_qquickstates::extendsBug() QQmlComponent c(&engine, testFileUrl("extendsBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *greenRect = rect->findChild<QQuickRectangle*>("greenRect"); @@ -1425,30 +1425,30 @@ void tst_qquickstates::editProperties() QQmlComponent c(&engine, testFileUrl("editProperties.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickStateGroup *stateGroup = rectPrivate->_states(); - QVERIFY(stateGroup != 0); + QVERIFY(stateGroup != nullptr); qmlExecuteDeferred(stateGroup); QQuickState *blueState = stateGroup->findState("blue"); - QVERIFY(blueState != 0); + QVERIFY(blueState != nullptr); qmlExecuteDeferred(blueState); QQuickPropertyChanges *propertyChangesBlue = qobject_cast<QQuickPropertyChanges*>(blueState->operationAt(0)); - QVERIFY(propertyChangesBlue != 0); + QVERIFY(propertyChangesBlue != nullptr); QQuickState *greenState = stateGroup->findState("green"); - QVERIFY(greenState != 0); + QVERIFY(greenState != nullptr); qmlExecuteDeferred(greenState); QQuickPropertyChanges *propertyChangesGreen = qobject_cast<QQuickPropertyChanges*>(greenState->operationAt(0)); - QVERIFY(propertyChangesGreen != 0); + QVERIFY(propertyChangesGreen != nullptr); QQuickRectangle *childRect = rect->findChild<QQuickRectangle*>("rect2"); - QVERIFY(childRect != 0); + QVERIFY(childRect != nullptr); QCOMPARE(childRect->width(), qreal(402)); QVERIFY(QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width"))); QCOMPARE(childRect->height(), qreal(200)); @@ -1553,7 +1553,7 @@ void tst_qquickstates::QTBUG_14830() QQmlComponent c(&engine, testFileUrl("QTBUG-14830.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItem *item = rect->findChild<QQuickItem*>("area"); QCOMPARE(item->width(), qreal(170)); @@ -1566,7 +1566,7 @@ void tst_qquickstates::avoidFastForward() //shouldn't fast forward if there isn't a transition QQmlComponent c(&engine, testFileUrl("avoidFastForward.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); rectPrivate->setState("a"); @@ -1580,7 +1580,7 @@ void tst_qquickstates::revertListBug() QQmlComponent c(&engine, testFileUrl("revertListBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *rect1 = rect->findChild<QQuickRectangle*>("rect1"); QQuickRectangle *rect2 = rect->findChild<QQuickRectangle*>("rect2"); @@ -1621,7 +1621,7 @@ void tst_qquickstates::QTBUG_38492() QQmlComponent rectComponent(&engine, testFileUrl("QTBUG-38492.qml")); QQuickItem *item = qobject_cast<QQuickItem*>(rectComponent.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QQuickItemPrivate::get(item)->setState("apply"); diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp index 045029c3b6..6ca5ad2653 100644 --- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp +++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp @@ -162,7 +162,7 @@ void tst_qquickstyledtext::textOutput() QTextLayout layout; QList<QQuickStyledTextImgTag*> imgTags; bool fontSizeModified = false; - QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified); + QQuickStyledText::parse(input, layout, imgTags, QUrl(), nullptr, false, &fontSizeModified); QCOMPARE(layout.text(), output); @@ -191,7 +191,7 @@ void tst_qquickstyledtext::anchors() QTextLayout layout; QList<QQuickStyledTextImgTag*> imgTags; bool fontSizeModified = false; - QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified); + QQuickStyledText::parse(input, layout, imgTags, QUrl(), nullptr, false, &fontSizeModified); QCOMPARE(layout.text(), output); @@ -229,11 +229,11 @@ void tst_qquickstyledtext::longString() bool fontSizeModified = false; QString input(9999999, QChar('.')); - QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified); + QQuickStyledText::parse(input, layout, imgTags, QUrl(), nullptr, false, &fontSizeModified); QCOMPARE(layout.text(), input); input = QString(9999999, QChar('\t')); // whitespace - QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified); + QQuickStyledText::parse(input, layout, imgTags, QUrl(), nullptr, false, &fontSizeModified); QCOMPARE(layout.text(), QString("")); } diff --git a/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp b/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp index 136cfa9a80..071dcafc97 100644 --- a/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp +++ b/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp @@ -62,7 +62,7 @@ void tst_qquicksystempalette::activePalette() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QPalette palette; palette.setCurrentColorGroup(QPalette::Active); @@ -91,7 +91,7 @@ void tst_qquicksystempalette::inactivePalette() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->colorGroup(), QQuickSystemPalette::Inactive); QPalette palette; @@ -121,7 +121,7 @@ void tst_qquicksystempalette::disabledPalette() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->colorGroup(), QQuickSystemPalette::Disabled); QPalette palette; @@ -152,7 +152,7 @@ void tst_qquicksystempalette::paletteChanged() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QPalette p; p.setCurrentColorGroup(QPalette::Active); diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 6fa898e9fb..609a84ce82 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -238,7 +238,7 @@ tst_qquicktext::tst_qquicktext() QQuickView *tst_qquicktext::createView(const QString &filename) { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(QUrl::fromLocalFile(filename)); return window; @@ -251,7 +251,7 @@ void tst_qquicktext::text() textComponent.setData("import QtQuick 2.0\nText { text: \"\" }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->text(), QString("")); QCOMPARE(textObject->width(), qreal(0)); @@ -266,7 +266,7 @@ void tst_qquicktext::text() QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->text(), standard.at(i)); QVERIFY(textObject->width() > 0); @@ -280,7 +280,7 @@ void tst_qquicktext::text() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QString expected = richText.at(i); QCOMPARE(textObject->text(), expected.replace("\\\"", "\"")); QVERIFY(textObject->width() > 0); @@ -297,7 +297,7 @@ void tst_qquicktext::width() textComponent.setData("import QtQuick 2.0\nText { text: \"\" }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 0.); delete textObject; @@ -344,7 +344,7 @@ void tst_qquicktext::width() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QVERIFY(textObject->boundingRect().width() > 0); QCOMPARE(textObject->width(), qreal(metricWidth)); QVERIFY(textObject->textFormat() == QQuickText::AutoText); // setting text doesn't change format @@ -360,14 +360,14 @@ void tst_qquicktext::width() QQmlComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->extra.isAllocated()); QTextDocument *doc = textPrivate->extra->doc; - QVERIFY(doc != 0); + QVERIFY(doc != nullptr); QCOMPARE(int(textObject->width()), int(doc->idealWidth())); QCOMPARE(textObject->textFormat(), QQuickText::RichText); @@ -386,7 +386,7 @@ void tst_qquicktext::wrap() QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); textHeight = textObject->height(); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->wrapMode(), QQuickText::WordWrap); QCOMPARE(textObject->width(), 300.); @@ -400,7 +400,7 @@ void tst_qquicktext::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->height() > textHeight); @@ -418,7 +418,7 @@ void tst_qquicktext::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->height() > textHeight); @@ -437,16 +437,16 @@ void tst_qquicktext::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->height() > textHeight); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->extra.isAllocated()); QTextDocument *doc = textPrivate->extra->doc; - QVERIFY(doc != 0); + QVERIFY(doc != nullptr); textObject->setWidth(doc->idealWidth()); QCOMPARE(textObject->width(), doc->idealWidth()); QVERIFY(textObject->height() > textHeight); @@ -466,7 +466,7 @@ void tst_qquicktext::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->implicitHeight() > textHeight); @@ -567,7 +567,7 @@ void tst_qquicktext::multilineElide() QScopedPointer<QQuickView> window(createView(testFile("multilineelide.qml"))); QQuickText *myText = qobject_cast<QQuickText*>(window->rootObject()); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); myText->setTextFormat(format); QCOMPARE(myText->lineCount(), 3); @@ -667,11 +667,11 @@ void tst_qquicktext::textFormat() textComponent.setData("import QtQuick 2.0\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickText::RichText); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->richText); delete textObject; @@ -681,11 +681,11 @@ void tst_qquicktext::textFormat() textComponent.setData("import QtQuick 2.0\nText { text: \"<b>Hello</b>\" }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickText::AutoText); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->styledText); delete textObject; @@ -695,7 +695,7 @@ void tst_qquicktext::textFormat() textComponent.setData("import QtQuick 2.0\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickText::PlainText); delete textObject; @@ -821,11 +821,11 @@ void tst_qquicktext::horizontalAlignment_RightToLeft() { QScopedPointer<QQuickView> window(createView(testFile("horizontalAlignment_RightToLeft.qml"))); QQuickText *text = window->rootObject()->findChild<QQuickText*>("text"); - QVERIFY(text != 0); + QVERIFY(text != nullptr); window->showNormal(); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(text); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QTRY_VERIFY(textPrivate->layout.lineCount()); @@ -965,7 +965,7 @@ void tst_qquicktext::hAlignImplicitWidth() QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickText *text = view.rootObject()->findChild<QQuickText*>("textItem"); - QVERIFY(text != 0); + QVERIFY(text != nullptr); // Try to check whether alignment works by checking the number of black // pixels in the thirds of the grabbed image. @@ -1032,7 +1032,7 @@ void tst_qquicktext::verticalAlignment() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); delete textObject; @@ -1048,7 +1048,7 @@ void tst_qquicktext::verticalAlignment() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); delete textObject; @@ -1444,7 +1444,7 @@ void tst_qquicktext::weight() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().weight(), (int)QQuickFontValueType::Normal); delete textObject; @@ -1455,7 +1455,7 @@ void tst_qquicktext::weight() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().weight(), (int)QQuickFontValueType::Bold); delete textObject; @@ -1469,7 +1469,7 @@ void tst_qquicktext::underline() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickText *textObject = view.rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().overline(), false); QCOMPARE(textObject->font().underline(), true); QCOMPARE(textObject->font().strikeOut(), false); @@ -1482,7 +1482,7 @@ void tst_qquicktext::overline() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickText *textObject = view.rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().overline(), true); QCOMPARE(textObject->font().underline(), false); QCOMPARE(textObject->font().strikeOut(), false); @@ -1495,7 +1495,7 @@ void tst_qquicktext::strikeout() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickText *textObject = view.rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().overline(), false); QCOMPARE(textObject->font().underline(), false); QCOMPARE(textObject->font().strikeOut(), true); @@ -1509,7 +1509,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::MixedCase); delete textObject; @@ -1520,7 +1520,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::AllUppercase); delete textObject; @@ -1531,7 +1531,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::AllLowercase); delete textObject; @@ -1542,7 +1542,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::SmallCaps); delete textObject; @@ -1553,7 +1553,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::Capitalize); delete textObject; @@ -1568,7 +1568,7 @@ void tst_qquicktext::letterSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().letterSpacing(), 0.0); delete textObject; @@ -1579,7 +1579,7 @@ void tst_qquicktext::letterSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().letterSpacing(), -2.); delete textObject; @@ -1590,7 +1590,7 @@ void tst_qquicktext::letterSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().letterSpacing(), 3.); delete textObject; @@ -1605,7 +1605,7 @@ void tst_qquicktext::wordSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().wordSpacing(), 0.0); delete textObject; @@ -1616,7 +1616,7 @@ void tst_qquicktext::wordSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().wordSpacing(), -50.); delete textObject; @@ -1627,7 +1627,7 @@ void tst_qquicktext::wordSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().wordSpacing(), 200.); delete textObject; @@ -2024,7 +2024,7 @@ void tst_qquicktext::linkInteraction() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); LinkTest test; QObject::connect(textObject, SIGNAL(linkActivated(QString)), &test, SLOT(linkClicked(QString))); @@ -2146,7 +2146,7 @@ void tst_qquicktext::embeddedImages() QVERIFY(QTest::qWaitForWindowActive(view)); QQuickText *textObject = qobject_cast<QQuickText*>(view->rootObject()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QTRY_COMPARE(textObject->resourcesLoading(), 0); QPixmap pm(testFile("http/exists.png")); @@ -2167,7 +2167,7 @@ void tst_qquicktext::lineCount() QScopedPointer<QQuickView> window(createView(testFile("lineCount.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QVERIFY(myText->lineCount() > 1); QVERIFY(!myText->truncated()); @@ -2194,7 +2194,7 @@ void tst_qquicktext::lineHeight() QScopedPointer<QQuickView> window(createView(testFile("lineHeight.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QCOMPARE(myText->lineHeight(), qreal(1)); QCOMPARE(myText->lineHeightMode(), QQuickText::ProportionalHeight); @@ -2792,10 +2792,10 @@ void tst_qquicktext::lineLaidOut() QScopedPointer<QQuickView> window(createView(testFile("lineLayout.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(!textPrivate->extra.isAllocated()); @@ -2820,10 +2820,10 @@ void tst_qquicktext::lineLaidOutRelayout() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(!textPrivate->extra.isAllocated()); @@ -2848,10 +2848,10 @@ void tst_qquicktext::lineLaidOutHAlign() QScopedPointer<QQuickView> window(createView(testFile("lineLayoutHAlign.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QCOMPARE(textPrivate->layout.lineCount(), 1); @@ -2978,11 +2978,11 @@ void tst_qquicktext::imgTagsAlign() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(".")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->height(), qreal(imgHeight)); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QRectF br = textPrivate->layout.boundingRect(); if (align == "bottom") @@ -3003,11 +3003,11 @@ void tst_qquicktext::imgTagsMultipleImages() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(".")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->height(), qreal(85)); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QCOMPARE(textPrivate->extra->visibleImgTags.count(), 2); delete textObject; @@ -3017,10 +3017,10 @@ void tst_qquicktext::imgTagsElide() { QScopedPointer<QQuickView> window(createView(testFile("imgTagsElide.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QCOMPARE(textPrivate->extra->visibleImgTags.count(), 0); myText->setMaximumLineCount(20); QTRY_COMPARE(textPrivate->extra->visibleImgTags.count(), 1); @@ -3032,12 +3032,12 @@ void tst_qquicktext::imgTagsUpdates() { QScopedPointer<QQuickView> window(createView(testFile("imgTagsUpdates.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QSignalSpy spy(myText, SIGNAL(contentSizeChanged())); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); myText->setText("This is a heart<img src=\"images/heart200.png\">."); QCOMPARE(textPrivate->extra->visibleImgTags.count(), 1); @@ -3063,7 +3063,7 @@ void tst_qquicktext::imgTagsError() textComponent.setData(componentStr.toLatin1(), QUrl("file:")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); delete textObject; } @@ -3082,7 +3082,7 @@ void tst_qquicktext::fontSizeMode() window->show(); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); myText->setText(text); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -3325,7 +3325,7 @@ void tst_qquicktext::fontSizeModeMultiline() window->show(); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); myText->setText(text); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -3573,7 +3573,7 @@ void tst_qquicktext::multilengthStrings() window->show(); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); const QString longText = "the quick brown fox jumped over the lazy dog"; const QString mediumText = "the brown fox jumped over the dog"; @@ -3653,8 +3653,8 @@ void tst_qquicktext::fontFormatSizes() QQuickText *qtext = view->rootObject()->findChild<QQuickText*>("text"); QQuickText *qtextWithTag = view->rootObject()->findChild<QQuickText*>("textWithTag"); - QVERIFY(qtext != 0); - QVERIFY(qtextWithTag != 0); + QVERIFY(qtext != nullptr); + QVERIFY(qtextWithTag != nullptr); qtext->setText(text); qtextWithTag->setText(textWithTag); @@ -3672,8 +3672,8 @@ void tst_qquicktext::fontFormatSizes() view->setSource(testFileUrl("pixelFontSizes.qml")); QQuickText *qtext = view->rootObject()->findChild<QQuickText*>("text"); QQuickText *qtextWithTag = view->rootObject()->findChild<QQuickText*>("textWithTag"); - QVERIFY(qtext != 0); - QVERIFY(qtextWithTag != 0); + QVERIFY(qtext != nullptr); + QVERIFY(qtextWithTag != nullptr); qtext->setText(text); qtextWithTag->setText(textWithTag); @@ -4039,10 +4039,10 @@ void tst_qquicktext::htmlLists() QQuickText *textObject = view->rootObject()->findChild<QQuickText*>("myText"); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->extra.isAllocated()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); textObject->setText(text); view->show(); @@ -4139,7 +4139,7 @@ void tst_qquicktext::padding() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickText *obj = qobject_cast<QQuickText*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); qreal cw = obj->contentWidth(); qreal ch = obj->contentHeight(); @@ -4227,7 +4227,7 @@ void tst_qquicktext::hintingPreference() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().hintingPreference(), (int)QFont::PreferDefaultHinting); delete textObject; @@ -4238,7 +4238,7 @@ void tst_qquicktext::hintingPreference() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().hintingPreference(), (int)QFont::PreferNoHinting); delete textObject; diff --git a/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp b/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp index 7507938589..e9c699db6a 100644 --- a/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp +++ b/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp @@ -58,7 +58,7 @@ void tst_qquicktextdocument::textDocumentWriter() QVERIFY(edit); QQuickTextDocument* quickDocument = qobject_cast<QQuickTextDocument*>(edit->property("textDocument").value<QObject*>()); - QVERIFY(quickDocument->textDocument() != 0); + QVERIFY(quickDocument->textDocument() != nullptr); QBuffer output; output.open(QBuffer::ReadWrite); @@ -73,7 +73,7 @@ void tst_qquicktextdocument::textDocumentWriter() void tst_qquicktextdocument::textDocumentWithImage() { - QQuickTextDocumentWithImageResources document(0); + QQuickTextDocumentWithImageResources document(nullptr); QImage image(1, 1, QImage::Format_Mono); image.fill(1); diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 37f6e94271..da15ca6b48 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -210,7 +210,7 @@ private: void simulateKeys(QWindow *window, const QList<Key> &keys); void simulateKeys(QWindow *window, const QKeySequence &sequence); - void simulateKey(QWindow *, int key, Qt::KeyboardModifiers modifiers = 0); + void simulateKey(QWindow *, int key, Qt::KeyboardModifiers modifiers = nullptr); QStringList standard; QStringList richText; @@ -336,7 +336,7 @@ void tst_qquicktextedit::cleanup() { // ensure not even skipped tests with custom input context leave it dangling QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); - inputMethodPrivate->testContext = 0; + inputMethodPrivate->testContext = nullptr; } void tst_qquicktextedit::text() @@ -346,7 +346,7 @@ void tst_qquicktextedit::text() texteditComponent.setData("import QtQuick 2.0\nTextEdit { text: \"\" }", QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), QString("")); QCOMPARE(textEditObject->length(), 0); } @@ -358,7 +358,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), standard.at(i)); QCOMPARE(textEditObject->length(), standard.at(i).length()); } @@ -371,7 +371,7 @@ void tst_qquicktextedit::text() QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QString expected = richText.at(i); expected.replace(QRegExp("\\\\(.)"),"\\1"); @@ -386,7 +386,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QString actual = textEditObject->text(); QString expected = standard.at(i); @@ -404,7 +404,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QString actual = textEditObject->text(); QString expected = richText.at(i); actual.replace(QRegExp(".*<body[^>]*>"),""); @@ -423,7 +423,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), standard.at(i)); QCOMPARE(textEditObject->length(), standard.at(i).length()); } @@ -435,7 +435,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QString actual = textEditObject->text(); QString expected = richText.at(i); actual.replace(QRegExp(".*<body[^>]*>"),""); @@ -456,7 +456,7 @@ void tst_qquicktextedit::width() texteditComponent.setData("import QtQuick 2.0\nTextEdit { text: \"\" }", QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), 0.0); } @@ -492,7 +492,7 @@ void tst_qquicktextedit::width() qreal metricWidth = layout.boundingRect().width(); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), metricWidth); } @@ -511,7 +511,7 @@ void tst_qquicktextedit::width() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), documentWidth); } } @@ -524,7 +524,7 @@ void tst_qquicktextedit::wrap() texteditComponent.setData("import QtQuick 2.0\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), 300.); } @@ -535,7 +535,7 @@ void tst_qquicktextedit::wrap() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), 300.); } @@ -546,7 +546,7 @@ void tst_qquicktextedit::wrap() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), 300.); } { @@ -581,7 +581,7 @@ void tst_qquicktextedit::textFormat() textComponent.setData("import QtQuick 2.0\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickTextEdit::RichText); } { @@ -589,7 +589,7 @@ void tst_qquicktextedit::textFormat() textComponent.setData("import QtQuick 2.0\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickTextEdit::PlainText); } { @@ -679,7 +679,7 @@ void tst_qquicktextedit::hAlign() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); } } @@ -693,7 +693,7 @@ void tst_qquicktextedit::hAlign() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); } } @@ -708,7 +708,7 @@ void tst_qquicktextedit::hAlign_RightToLeft() QQuickView window(testFileUrl("horizontalAlignment_RightToLeft.qml")); QQuickTextEdit *textEdit = window.rootObject()->findChild<QQuickTextEdit*>("text"); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); window.showNormal(); const QString rtlText = textEdit->text(); @@ -853,7 +853,7 @@ void tst_qquicktextedit::hAlign_RightToLeft() // make sure editor doesn't rely on input for updating size QQuickTextEdit *emptyEdit = window.rootObject()->findChild<QQuickTextEdit*>("emptyTextEdit"); - QVERIFY(emptyEdit != 0); + QVERIFY(emptyEdit != nullptr); platformInputContext.setInputDirection(Qt::RightToLeft); emptyEdit->setFocus(true); QCOMPARE(emptyEdit->hAlign(), QQuickTextEdit::AlignRight); @@ -891,7 +891,7 @@ void tst_qquicktextedit::hAlignVisual() QVERIFY(QTest::qWaitForWindowExposed(&view)); QQuickText *text = view.rootObject()->findChild<QQuickText*>("textItem"); - QVERIFY(text != 0); + QVERIFY(text != nullptr); // Try to check whether alignment works by checking the number of black // pixels in the thirds of the grabbed image. @@ -987,7 +987,7 @@ void tst_qquicktextedit::vAlign() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); } } @@ -1001,7 +1001,7 @@ void tst_qquicktextedit::vAlign() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); } } @@ -1012,7 +1012,7 @@ void tst_qquicktextedit::vAlign() "TextEdit { width: 100; height: 100; text: \"Hello World\" }", QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->vAlign(), QQuickTextEdit::AlignTop); QVERIFY(textEditObject->cursorRectangle().bottom() < 50); @@ -1055,7 +1055,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().pointSize(), 40); QCOMPARE(textEditObject->font().bold(), false); QCOMPARE(textEditObject->font().italic(), false); @@ -1067,7 +1067,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().bold(), true); QCOMPARE(textEditObject->font().italic(), false); } @@ -1078,7 +1078,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().italic(), true); QCOMPARE(textEditObject->font().bold(), false); } @@ -1089,7 +1089,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().family(), QString("Helvetica")); QCOMPARE(textEditObject->font().bold(), false); QCOMPARE(textEditObject->font().italic(), false); @@ -1101,7 +1101,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().family(), QString("")); } } @@ -1166,7 +1166,7 @@ void tst_qquicktextedit::color() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); //qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i)); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->color(), QColor(colorStrings.at(i))); } @@ -1177,7 +1177,7 @@ void tst_qquicktextedit::color() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->selectionColor(), QColor(colorStrings.at(i))); } @@ -1188,7 +1188,7 @@ void tst_qquicktextedit::color() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->selectedTextColor(), QColor(colorStrings.at(i))); } @@ -1202,7 +1202,7 @@ void tst_qquicktextedit::color() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->color(), testColor); } } @@ -1214,7 +1214,7 @@ void tst_qquicktextedit::textMargin() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->textMargin(), i); } } @@ -1275,14 +1275,14 @@ void tst_qquicktextedit::selectionOnFocusOut() QQuickTextEdit *edit1 = window.rootObject()->findChild<QQuickTextEdit*>("text1"); QQuickTextEdit *edit2 = window.rootObject()->findChild<QQuickTextEdit*>("text2"); - QTest::mouseClick(&window, Qt::LeftButton, 0, p1); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1); QVERIFY(edit1->hasActiveFocus()); QVERIFY(!edit2->hasActiveFocus()); edit1->selectAll(); QCOMPARE(edit1->selectedText(), QLatin1String("text 1")); - QTest::mouseClick(&window, Qt::LeftButton, 0, p2); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p2); QCOMPARE(edit1->selectedText(), QLatin1String("")); QVERIFY(!edit1->hasActiveFocus()); @@ -1318,7 +1318,7 @@ void tst_qquicktextedit::focusOnPress() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->focusOnPress(), true); QCOMPARE(textEditObject->hasFocus(), false); @@ -1341,7 +1341,7 @@ void tst_qquicktextedit::focusOnPress() QCOMPARE(textEditObject->hasActiveFocus(), false); QPoint centerPoint(window.width()/2, window.height()/2); - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = nullptr; QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint); QGuiApplication::processEvents(); QCOMPARE(textEditObject->hasFocus(), true); @@ -1396,7 +1396,7 @@ void tst_qquicktextedit::selection() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); //Test selection follows cursor @@ -1479,7 +1479,7 @@ void tst_qquicktextedit::overwriteMode() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QSignalSpy spy(textEdit, SIGNAL(overwriteModeChanged(bool))); @@ -1605,11 +1605,11 @@ void tst_qquicktextedit::keySelection() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *input = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QVERIFY(input->hasActiveFocus()); QSignalSpy spy(input, SIGNAL(selectedTextChanged())); @@ -1805,7 +1805,7 @@ void tst_qquicktextedit::moveCursorSelection() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit*>(textinputComponent.create()); - QVERIFY(texteditObject != 0); + QVERIFY(texteditObject != nullptr); texteditObject->setCursorPosition(cursorPosition); texteditObject->moveCursorSelection(movePosition, mode); @@ -1964,7 +1964,7 @@ void tst_qquicktextedit::moveCursorSelectionSequence() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(texteditObject != 0); + QVERIFY(texteditObject != nullptr); texteditObject->setCursorPosition(cursorPosition); @@ -2062,9 +2062,9 @@ void tst_qquicktextedit::mouseSelection() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); textEditObject->setFocus(focus); textEditObject->setFocusOnPress(focusOnPress); @@ -2109,17 +2109,17 @@ void tst_qquicktextedit::dragMouseSelection() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); // press-and-drag-and-release from x1 to x2 int x1 = 10; int x2 = 70; int y = QFontMetrics(textEditObject->font()).height() / 2; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QTest::qWait(300); QString str1; QTRY_VERIFY((str1 = textEditObject->selectedText()).length() > 3); @@ -2127,9 +2127,9 @@ void tst_qquicktextedit::dragMouseSelection() // press and drag the current selection. x1 = 40; x2 = 100; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QTest::qWait(300); QString str2; QTRY_VERIFY((str2 = textEditObject->selectedText()).length() > 3); @@ -2162,17 +2162,17 @@ void tst_qquicktextedit::mouseSelectionMode() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); // press-and-drag-and-release from x1 to x2 int x1 = 10; int x2 = 70; int y = textEditObject->height()/2; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str = textEditObject->selectedText(); if (selectWords) { QTRY_COMPARE(textEditObject->selectedText(), text); @@ -2383,9 +2383,9 @@ void tst_qquicktextedit::inputMethodHints() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QVERIFY(textEditObject->inputMethodHints() & Qt::ImhNoPredictiveText); QSignalSpy inputMethodHintSpy(textEditObject, SIGNAL(inputMethodHintsChanged())); textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); @@ -2419,13 +2419,13 @@ void tst_qquicktextedit::positionAt() QFETCH(QQuickTextEdit::VAlignment, verticalAlignment); QQuickView window(testFileUrl("positionAt.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(texteditObject != 0); + QVERIFY(texteditObject != nullptr); texteditObject->setHAlign(horizontalAlignment); texteditObject->setVAlign(verticalAlignment); @@ -2509,13 +2509,13 @@ void tst_qquicktextedit::positionAt() void tst_qquicktextedit::linkInteraction() { QQuickView window(testFileUrl("linkInteraction.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(texteditObject != 0); + QVERIFY(texteditObject != nullptr); QSignalSpy spy(texteditObject, SIGNAL(linkActivated(QString))); QSignalSpy hover(texteditObject, SIGNAL(linkHovered(QString))); @@ -2525,7 +2525,7 @@ void tst_qquicktextedit::linkInteraction() const QPointF linkPos = texteditObject->positionToRectangle(7).center(); const QPointF textPos = texteditObject->positionToRectangle(2).center(); - QTest::mouseClick(&window, Qt::LeftButton, 0, linkPos.toPoint()); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, linkPos.toPoint()); QTRY_COMPARE(spy.count(), 1); QTRY_COMPARE(hover.count(), 1); QCOMPARE(spy.last()[0].toString(), link); @@ -2533,7 +2533,7 @@ void tst_qquicktextedit::linkInteraction() QCOMPARE(texteditObject->hoveredLink(), link); QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); - QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint()); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, textPos.toPoint()); QTRY_COMPARE(spy.count(), 1); QTRY_COMPARE(hover.count(), 2); QCOMPARE(hover.last()[0].toString(), QString()); @@ -2542,7 +2542,7 @@ void tst_qquicktextedit::linkInteraction() texteditObject->setReadOnly(true); - QTest::mouseClick(&window, Qt::LeftButton, 0, linkPos.toPoint()); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, linkPos.toPoint()); QTRY_COMPARE(spy.count(), 2); QTRY_COMPARE(hover.count(), 3); QCOMPARE(spy.last()[0].toString(), link); @@ -2550,7 +2550,7 @@ void tst_qquicktextedit::linkInteraction() QCOMPARE(texteditObject->hoveredLink(), link); QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); - QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint()); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, textPos.toPoint()); QTRY_COMPARE(spy.count(), 2); QTRY_COMPARE(hover.count(), 4); QCOMPARE(hover.last()[0].toString(), QString()); @@ -2574,7 +2574,7 @@ void tst_qquicktextedit::cursorDelegate() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject"); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); // Delegate creation is deferred until focus in or cursor visibility is forced. QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance")); QVERIFY(!textEditObject->isCursorVisible()); @@ -2596,7 +2596,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setCursorPosition(0); const QPoint point1 = textEditObject->positionToRectangle(5).center().toPoint(); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, point1); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, point1); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); @@ -2606,10 +2606,10 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setCursorPosition(0); const QPoint point2 = textEditObject->positionToRectangle(10).center().toPoint(); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mousePress(&view, Qt::LeftButton, 0, point1); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, point1); QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QGuiApplication::sendEvent(&view, &mv); - QTest::mouseRelease(&view, Qt::LeftButton, 0, point2); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, point2); QTest::qWait(50); QTRY_COMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); @@ -2617,7 +2617,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setReadOnly(true); textEditObject->setCursorPosition(0); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); @@ -2625,7 +2625,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setCursorPosition(0); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); @@ -2671,7 +2671,7 @@ void tst_qquicktextedit::cursorDelegate() } //Test Delegate gets deleted - textEditObject->setCursorDelegate(0); + textEditObject->setCursorDelegate(nullptr); QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance")); } @@ -2689,7 +2689,7 @@ void tst_qquicktextedit::remoteCursorDelegate() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject"); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); // Delegate is created on demand, and so won't be available immediately. Focus in or // setCursorVisible(true) will trigger creation. @@ -2834,7 +2834,7 @@ void tst_qquicktextedit::delegateLoading() QTRY_VERIFY(view.rootObject());//Wait for loading to finish. QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject"); // view.rootObject()->dumpObjectTree(); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); textEditObject->setFocus(true); QQuickItem *delegate; delegate = view.rootObject()->findChild<QQuickItem*>("delegateOkay"); @@ -2886,7 +2886,7 @@ void tst_qquicktextedit::cursorDelegateHeight() QCOMPARE(delegateObject->height(), textEditObject->cursorRectangle().height()); // Test that the delegate gets deleted - textEditObject->setCursorDelegate(0); + textEditObject->setCursorDelegate(nullptr); QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance")); } @@ -2900,11 +2900,11 @@ void tst_qquicktextedit::navigation() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *input = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QTRY_VERIFY(input->hasActiveFocus()); simulateKey(&window, Qt::Key_Left); QVERIFY(!input->hasActiveFocus()); @@ -2938,7 +2938,7 @@ void tst_qquicktextedit::copyAndPaste() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); // copy and paste QCOMPARE(textEdit->text().length(), 12); @@ -3014,7 +3014,7 @@ void tst_qquicktextedit::canPaste() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); // check initial value - QTBUG-17765 QTextDocument document; @@ -3032,7 +3032,7 @@ void tst_qquicktextedit::canPasteEmpty() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); // check initial value - QTBUG-17765 QTextDocument document; @@ -3053,9 +3053,9 @@ void tst_qquicktextedit::middleClickPaste() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); textEditObject->setFocus(true); @@ -3087,11 +3087,11 @@ void tst_qquicktextedit::readOnly() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(edit != 0); + QVERIFY(edit != nullptr); QTRY_VERIFY(edit->hasActiveFocus()); QVERIFY(edit->isReadOnly()); QString initial = edit->text(); @@ -3279,7 +3279,7 @@ void tst_qquicktextedit::openInputPanel() // input panel should open on focus QPoint centerPoint(view.width()/2, view.height()/2); - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = Qt::NoModifier; QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QGuiApplication::processEvents(); QVERIFY(edit->hasActiveFocus()); @@ -3330,7 +3330,7 @@ void tst_qquicktextedit::openInputPanel() QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QCOMPARE(qApp->inputMethod()->isVisible(), false); - inputMethodPrivate->testContext = 0; + inputMethodPrivate->testContext = nullptr; } void tst_qquicktextedit::geometrySignals() @@ -3351,7 +3351,7 @@ void tst_qquicktextedit::pastingRichText_QTBUG_14003() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickTextEdit *obj = qobject_cast<QQuickTextEdit*>(component.create()); - QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj != nullptr); QTRY_COMPARE(obj->textFormat(), QQuickTextEdit::PlainText); QMimeData *mData = new QMimeData; @@ -3463,7 +3463,7 @@ void tst_qquicktextedit::implicitSizeBinding() void tst_qquicktextedit::signal_editingfinished() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("signal_editingfinished.qml")); @@ -3472,7 +3472,7 @@ void tst_qquicktextedit::signal_editingfinished() QVERIFY(QTest::qWaitForWindowActive(window)); QCOMPARE(QGuiApplication::focusWindow(), window); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTextEdit *input1 = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window->rootObject()->property("input1"))); QVERIFY(input1); @@ -3860,7 +3860,7 @@ void tst_qquicktextedit::cursorRectangleSize() QFETCH(bool, useCursorDelegate); QQuickView *window = new QQuickView(testFileUrl("positionAt.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit *>(window->rootObject()); QQmlComponent cursorDelegate(window->engine()); @@ -3873,7 +3873,7 @@ void tst_qquicktextedit::cursorRectangleSize() textEdit->setX(10); textEdit->setY(10); textEdit->setCursorPosition(3); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setFocus(true); window->show(); window->requestActivate(); @@ -4011,7 +4011,7 @@ void tst_qquicktextedit::getText() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QCOMPARE(textEdit->getText(start, end), expectedText); } @@ -4112,7 +4112,7 @@ void tst_qquicktextedit::getFormattedText() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setTextFormat(textFormat); textEdit->setText(text); @@ -4238,7 +4238,7 @@ void tst_qquicktextedit::append() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setTextFormat(textFormat); textEdit->select(selectionStart, selectionEnd); @@ -4453,7 +4453,7 @@ void tst_qquicktextedit::insert() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setTextFormat(textFormat); textEdit->select(selectionStart, selectionEnd); @@ -4695,7 +4695,7 @@ void tst_qquicktextedit::remove() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setTextFormat(textFormat); textEdit->select(selectionStart, selectionEnd); @@ -4876,7 +4876,7 @@ void tst_qquicktextedit::keySequence() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); @@ -5038,7 +5038,7 @@ void tst_qquicktextedit::undo() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); @@ -5124,7 +5124,7 @@ void tst_qquicktextedit::redo() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); @@ -5345,7 +5345,7 @@ void tst_qquicktextedit::undo_keypressevents() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); @@ -5369,7 +5369,7 @@ void tst_qquicktextedit::clear() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); @@ -5479,7 +5479,7 @@ void tst_qquicktextedit::embeddedImages() QQmlComponent textComponent(&engine, qmlfile); QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.beginCreate(engine.rootContext())); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); const int baseUrlPropertyIndex = textObject->metaObject()->indexOfProperty("serverBaseUrl"); if (baseUrlPropertyIndex != -1) { @@ -5507,7 +5507,7 @@ void tst_qquicktextedit::embeddedImages() void tst_qquicktextedit::emptytags_QTBUG_22058() { QQuickView window(testFileUrl("qtbug-22058.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); @@ -5568,7 +5568,7 @@ void tst_qquicktextedit::doubleSelect_QTBUG_38704() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged())); @@ -5592,7 +5592,7 @@ void tst_qquicktextedit::padding() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickTextEdit *obj = qobject_cast<QQuickTextEdit*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); qreal cw = obj->contentWidth(); qreal ch = obj->contentHeight(); diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 84a87f63a7..65c9c9e8ad 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -300,7 +300,7 @@ void tst_qquicktextinput::cleanup() { // ensure not even skipped tests with custom input context leave it dangling QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); - inputMethodPrivate->testContext = 0; + inputMethodPrivate->testContext = nullptr; } tst_qquicktextinput::tst_qquicktextinput() @@ -332,7 +332,7 @@ void tst_qquicktextinput::text() textinputComponent.setData("import QtQuick 2.0\nTextInput { text: \"\" }", QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->text(), QString("")); QCOMPARE(textinputObject->length(), 0); @@ -346,7 +346,7 @@ void tst_qquicktextinput::text() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->text(), standard.at(i)); QCOMPARE(textinputObject->length(), standard.at(i).length()); @@ -363,7 +363,7 @@ void tst_qquicktextinput::width() textinputComponent.setData("import QtQuick 2.0\nTextInput { text: \"\" }", QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->width(), 0.0); delete textinputObject; @@ -401,7 +401,7 @@ void tst_qquicktextinput::width() qreal metricWidth = ceil(layout.boundingRect().width()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); int delta = abs(int(int(textinputObject->width()) - metricWidth)); QVERIFY(delta <= 3.0); // As best as we can hope for cross-platform. @@ -418,7 +418,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().pointSize(), 40); QCOMPARE(textinputObject->font().bold(), false); QCOMPARE(textinputObject->font().italic(), false); @@ -432,7 +432,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().bold(), true); QCOMPARE(textinputObject->font().italic(), false); @@ -445,7 +445,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().italic(), true); QCOMPARE(textinputObject->font().bold(), false); @@ -458,7 +458,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().family(), QString("Helvetica")); QCOMPARE(textinputObject->font().bold(), false); QCOMPARE(textinputObject->font().italic(), false); @@ -472,7 +472,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().family(), QString("")); delete textinputObject; @@ -539,7 +539,7 @@ void tst_qquicktextinput::color() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->color(), QColor(colorStrings.at(i))); delete textinputObject; @@ -552,7 +552,7 @@ void tst_qquicktextinput::color() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->selectionColor(), QColor(colorStrings.at(i))); delete textinputObject; @@ -565,7 +565,7 @@ void tst_qquicktextinput::color() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->selectedTextColor(), QColor(colorStrings.at(i))); delete textinputObject; @@ -581,7 +581,7 @@ void tst_qquicktextinput::color() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->color(), testColor); delete textinputObject; @@ -598,7 +598,7 @@ void tst_qquicktextinput::wrap() QQuickTextInput *textObject = qobject_cast<QQuickTextInput*>(textComponent.create()); textHeight = textObject->height(); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->wrapMode(), QQuickTextInput::WrapAnywhere); QCOMPARE(textObject->width(), 300.); @@ -611,7 +611,7 @@ void tst_qquicktextinput::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickTextInput *textObject = qobject_cast<QQuickTextInput*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->height() > textHeight); @@ -653,7 +653,7 @@ void tst_qquicktextinput::selection() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); //Test selection follows cursor @@ -793,7 +793,7 @@ void tst_qquicktextinput::overwriteMode() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QSignalSpy spy(textInput, SIGNAL(overwriteModeChanged(bool))); @@ -1071,7 +1071,7 @@ void tst_qquicktextinput::moveCursorSelection() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); textinputObject->setCursorPosition(cursorPosition); textinputObject->moveCursorSelection(movePosition, mode); @@ -1279,7 +1279,7 @@ void tst_qquicktextinput::moveCursorSelectionSequence() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); textinputObject->setCursorPosition(cursorPosition); @@ -1306,17 +1306,17 @@ void tst_qquicktextinput::dragMouseSelection() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); // press-and-drag-and-release from x1 to x2 int x1 = 10; int x2 = 70; int y = textInputObject->height()/2; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str1; QTRY_VERIFY((str1 = textInputObject->selectedText()).length() > 3); QTRY_VERIFY(str1.length() > 3); @@ -1324,9 +1324,9 @@ void tst_qquicktextinput::dragMouseSelection() // press and drag the current selection. x1 = 40; x2 = 100; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str2 = textInputObject->selectedText(); QTRY_VERIFY(str2.length() > 3); @@ -1367,9 +1367,9 @@ void tst_qquicktextinput::mouseSelectionMode() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); textInputObject->setFocus(focus); textInputObject->setFocusOnPress(focusOnPress); @@ -1378,9 +1378,9 @@ void tst_qquicktextinput::mouseSelectionMode() int x1 = 10; int x2 = 70; int y = textInputObject->height()/2; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2,y)); // doesn't work - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); if (selectWords) { QTRY_COMPARE(textInputObject->selectedText(), text); } else { @@ -1471,7 +1471,7 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft() QQuickView window(testFileUrl("horizontalAlignment_RightToLeft.qml")); QQuickTextInput *textInput = window.rootObject()->findChild<QQuickTextInput*>("text"); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); window.show(); const QString rtlText = textInput->text(); @@ -1618,7 +1618,7 @@ void tst_qquicktextinput::verticalAlignment() { QQuickView window(testFileUrl("horizontalAlignment.qml")); QQuickTextInput *textInput = window.rootObject()->findChild<QQuickTextInput*>("text"); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); window.showNormal(); QCOMPARE(textInput->vAlign(), QQuickTextInput::AlignTop); @@ -1805,13 +1805,13 @@ void tst_qquicktextinput::boundingRect() void tst_qquicktextinput::positionAt() { QQuickView window(testFileUrl("positionAt.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); // Check autoscrolled... @@ -1895,13 +1895,13 @@ void tst_qquicktextinput::positionAt() void tst_qquicktextinput::maxLength() { QQuickView window(testFileUrl("maxLength.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QVERIFY(textinputObject->text().isEmpty()); QCOMPARE(textinputObject->maxLength(), 10); foreach (const QString &str, standard) { @@ -1927,9 +1927,9 @@ void tst_qquicktextinput::masks() QQuickView window(testFileUrl("masks.qml")); window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QTRY_VERIFY(textinputObject->hasActiveFocus()); QCOMPARE(textinputObject->text().length(), 0); QCOMPARE(textinputObject->inputMask(), QString("HHHHhhhh; ")); @@ -1959,7 +1959,7 @@ void tst_qquicktextinput::validators() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QLocale defaultLocale; QLocale enLocale("en"); @@ -2250,9 +2250,9 @@ void tst_qquicktextinput::inputMethods() QVERIFY(QTest::qWaitForWindowActive(&window)); // test input method hints - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QVERIFY(input->inputMethodHints() & Qt::ImhNoPredictiveText); QSignalSpy inputMethodHintSpy(input, SIGNAL(inputMethodHintsChanged())); input->setInputMethodHints(Qt::ImhUppercaseOnly); @@ -2341,7 +2341,7 @@ void tst_qquicktextinput::signal_accepted() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("input"))); QVERIFY(input); @@ -2383,7 +2383,7 @@ void tst_qquicktextinput::signal_editingfinished() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input1 = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("input1"))); QVERIFY(input1); @@ -2508,11 +2508,11 @@ void tst_qquicktextinput::navigation() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); input->setCursorPosition(0); QTRY_VERIFY(input->hasActiveFocus()); simulateKey(&window, Qt::Key_Left); @@ -2557,11 +2557,11 @@ void tst_qquicktextinput::navigation_RTL() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647}; input->setText(QString::fromUtf16(arabic_str, 11)); @@ -2598,7 +2598,7 @@ void tst_qquicktextinput::copyAndPaste() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); // copy and paste QCOMPARE(textInput->text().length(), 12); @@ -2696,7 +2696,7 @@ void tst_qquicktextinput::copyAndPasteKeySequence() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -2763,7 +2763,7 @@ void tst_qquicktextinput::canPasteEmpty() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0; QCOMPARE(textInput->canPaste(), cp); @@ -2779,7 +2779,7 @@ void tst_qquicktextinput::canPaste() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0; QCOMPARE(textInput->canPaste(), cp); @@ -2798,9 +2798,9 @@ void tst_qquicktextinput::middleClickPaste() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); textInputObject->setFocus(true); @@ -2835,7 +2835,7 @@ void tst_qquicktextinput::passwordCharacter() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->setPasswordCharacter("X"); qreal implicitWidth = textInput->implicitWidth(); @@ -2863,7 +2863,7 @@ void tst_qquicktextinput::cursorDelegate() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *textInputObject = view.rootObject()->findChild<QQuickTextInput*>("textInputObject"); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); // Delegate is created on demand, and so won't be available immediately. Focus in or // setCursorVisible(true) will trigger creation. QTRY_VERIFY(!textInputObject->findChild<QQuickItem*>("cursorInstance")); @@ -2889,7 +2889,7 @@ void tst_qquicktextinput::cursorDelegate() textInputObject->setCursorPosition(0); const QPoint point1 = textInputObject->positionToRectangle(5).center().toPoint(); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, point1); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, point1); QTest::qWait(50); QTRY_VERIFY(textInputObject->cursorPosition() != 0); QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); @@ -2899,10 +2899,10 @@ void tst_qquicktextinput::cursorDelegate() textInputObject->setCursorPosition(0); const QPoint point2 = textInputObject->positionToRectangle(10).center().toPoint(); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mousePress(&view, Qt::LeftButton, 0, point1); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, point1); QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QGuiApplication::sendEvent(&view, &mv); - QTest::mouseRelease(&view, Qt::LeftButton, 0, point2); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, point2); QTest::qWait(50); QTRY_COMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y()); @@ -2910,7 +2910,7 @@ void tst_qquicktextinput::cursorDelegate() textInputObject->setReadOnly(true); textInputObject->setCursorPosition(0); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, textInputObject->positionToRectangle(5).center().toPoint()); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textInputObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textInputObject->cursorPosition() != 0); QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); @@ -2918,7 +2918,7 @@ void tst_qquicktextinput::cursorDelegate() textInputObject->setCursorPosition(0); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, textInputObject->positionToRectangle(5).center().toPoint()); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textInputObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textInputObject->cursorPosition() != 0); QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); @@ -2964,7 +2964,7 @@ void tst_qquicktextinput::cursorDelegate() } //Test Delegate gets deleted - textInputObject->setCursorDelegate(0); + textInputObject->setCursorDelegate(nullptr); QVERIFY(!textInputObject->findChild<QQuickItem*>("cursorInstance")); } @@ -2981,7 +2981,7 @@ void tst_qquicktextinput::remoteCursorDelegate() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *textInputObject = view.rootObject()->findChild<QQuickTextInput*>("textInputObject"); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); // Delegate is created on demand, and so won't be available immediately. Focus in or // setCursorVisible(true) will trigger creation. @@ -3307,11 +3307,11 @@ void tst_qquicktextinput::readOnly() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QTRY_VERIFY(input->hasActiveFocus()); QVERIFY(input->isReadOnly()); QVERIFY(!input->isCursorVisible()); @@ -3337,11 +3337,11 @@ void tst_qquicktextinput::echoMode() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QTRY_VERIFY(input->hasActiveFocus()); QString initial = input->text(); Qt::InputMethodHints ref; @@ -3413,7 +3413,7 @@ void tst_qquicktextinput::passwordEchoDelay() window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); QVERIFY(input); @@ -3478,8 +3478,8 @@ void tst_qquicktextinput::passwordEchoDelay() void tst_qquicktextinput::simulateKey(QWindow *view, int key) { - QKeyEvent press(QKeyEvent::KeyPress, key, 0); - QKeyEvent release(QKeyEvent::KeyRelease, key, 0); + QKeyEvent press(QKeyEvent::KeyPress, key, nullptr); + QKeyEvent release(QKeyEvent::KeyRelease, key, nullptr); QGuiApplication::sendEvent(view, &press); QGuiApplication::sendEvent(view, &release); @@ -3500,7 +3500,7 @@ void tst_qquicktextinput::focusOnPress() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput*>(texteditComponent.create()); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); QCOMPARE(textInputObject->focusOnPress(), true); QCOMPARE(textInputObject->hasFocus(), false); @@ -3522,7 +3522,7 @@ void tst_qquicktextinput::focusOnPress() QCOMPARE(textInputObject->hasFocus(), false); QCOMPARE(textInputObject->hasActiveFocus(), false); - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = Qt::NoModifier; QTest::mousePress(&window, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), true); @@ -3596,7 +3596,7 @@ void tst_qquicktextinput::focusOnPressOnlyOneItem() // // this is a contrived example to be sure, but at the end of this, the // important thing is that only one thing should have activeFocus. - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = nullptr; QTest::mousePress(&window, Qt::LeftButton, noModifiers, QPoint(10, 10)); // make sure the press is processed. @@ -3631,7 +3631,7 @@ void tst_qquicktextinput::openInputPanel() QCOMPARE(qApp->inputMethod()->isVisible(), false); // input panel should open on focus - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = nullptr; QTest::mousePress(&view, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QVERIFY(input->hasActiveFocus()); @@ -3687,7 +3687,7 @@ void tst_qquicktextinput::openInputPanel() class MyTextInput : public QQuickTextInput { public: - MyTextInput(QQuickItem *parent = 0) : QQuickTextInput(parent) + MyTextInput(QQuickItem *parent = nullptr) : QQuickTextInput(parent) { nbPaint = 0; } @@ -4232,14 +4232,14 @@ void tst_qquicktextinput::inputMethodUpdate() void tst_qquicktextinput::cursorRectangleSize() { QQuickView *window = new QQuickView(testFileUrl("positionAt.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTextInput *textInput = qobject_cast<QQuickTextInput *>(window->rootObject()); // make sure cursor rectangle is not at (0,0) textInput->setX(10); textInput->setY(10); textInput->setCursorPosition(3); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->setFocus(true); window->show(); window->requestActivate(); @@ -4287,24 +4287,24 @@ void tst_qquicktextinput::tripleClickSelectsAll() // Clicking on the same point inside TextInput three times in a row // should trigger a triple click, thus selecting all the text. QPoint pointInside = input->position().toPoint() + QPoint(2,2); - QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside); - QTest::mouseClick(&view, Qt::LeftButton, 0, pointInside); + QTest::mouseDClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); QGuiApplication::processEvents(); QCOMPARE(input->selectedText(), hello); // Now it simulates user moving the mouse between the second and the third click. // In this situation, we don't expect a triple click. QPoint pointInsideButFar = QPoint(input->width(),input->height()) - QPoint(2,2); - QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside); - QTest::mouseClick(&view, Qt::LeftButton, 0, pointInsideButFar); + QTest::mouseDClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, pointInsideButFar); QGuiApplication::processEvents(); QVERIFY(input->selectedText().isEmpty()); // And now we press the third click too late, so no triple click event is triggered. - QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside); + QTest::mouseDClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); QGuiApplication::processEvents(); QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 1); - QTest::mouseClick(&view, Qt::LeftButton, 0, pointInside); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); QGuiApplication::processEvents(); QVERIFY(input->selectedText().isEmpty()); } @@ -4374,7 +4374,7 @@ void tst_qquicktextinput::getText() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QCOMPARE(textInput->getText(start, end), expectedText); } @@ -4714,7 +4714,7 @@ void tst_qquicktextinput::insert() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->select(selectionStart, selectionEnd); @@ -5069,7 +5069,7 @@ void tst_qquicktextinput::remove() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->select(selectionStart, selectionEnd); @@ -5264,7 +5264,7 @@ void tst_qquicktextinput::keySequence() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->setEchoMode(echoMode); QQuickWindow window; @@ -5426,7 +5426,7 @@ void tst_qquicktextinput::undo() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -5512,7 +5512,7 @@ void tst_qquicktextinput::redo() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -5844,7 +5844,7 @@ void tst_qquicktextinput::undo_keypressevents() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -5868,7 +5868,7 @@ void tst_qquicktextinput::clear() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -5922,7 +5922,7 @@ void tst_qquicktextinput::backspaceSurrogatePairs() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->setText(text); textInput->setCursorPosition(text.length()); @@ -5957,7 +5957,7 @@ void tst_qquicktextinput::QTBUG_19956() window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput*>(window.rootObject()); QVERIFY(input); input->setFocus(true); @@ -5996,7 +5996,7 @@ void tst_qquicktextinput::QTBUG_19956_regexp() window.show(); window.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput*>(window.rootObject()); QVERIFY(input); input->setFocus(true); @@ -6181,7 +6181,7 @@ void tst_qquicktextinput::keypress_inputMask_withValidator() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -6411,7 +6411,7 @@ void tst_qquicktextinput::setInputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); // then either insert using insert() or keyboard if (insert_text) { @@ -6468,7 +6468,7 @@ void tst_qquicktextinput::inputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QCOMPARE(textInput->inputMask(), expectedMask); } @@ -6479,7 +6479,7 @@ void tst_qquicktextinput::clearInputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QVERIFY(!textInput->inputMask().isEmpty()); textInput->setInputMask(QString()); @@ -6551,7 +6551,7 @@ void tst_qquicktextinput::keypress_inputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -6574,7 +6574,7 @@ void tst_qquicktextinput::keypress_inputMethod_inputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); @@ -6639,7 +6639,7 @@ void tst_qquicktextinput::hasAcceptableInputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); // test that invalid input (for required) work for optionalMask textInput->setText(invalid); @@ -6693,7 +6693,7 @@ void tst_qquicktextinput::maskCharacter() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); for (int i = 0; i < input.size(); ++i) { QString in = QString(input.at(i)); @@ -6706,7 +6706,7 @@ void tst_qquicktextinput::maskCharacter() class TestValidator : public QValidator { public: - TestValidator(QObject *parent = 0) : QValidator(parent) { } + TestValidator(QObject *parent = nullptr) : QValidator(parent) { } State validate(QString &input, int &) const { return input == QStringLiteral("ok") ? Acceptable : Intermediate; } void fixup(QString &input) const { input = QStringLiteral("ok"); } @@ -6926,7 +6926,7 @@ void tst_qquicktextinput::padding() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickTextInput *obj = qobject_cast<QQuickTextInput*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); qreal cw = obj->contentWidth(); qreal ch = obj->contentHeight(); diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index 5849d35353..e259ed1ae7 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -212,11 +212,11 @@ void tst_QQuickView::engine() QQmlEngine *engine = new QQmlEngine; QVERIFY(!engine->incubationController()); - QQuickView *view = new QQuickView(engine, 0); + QQuickView *view = new QQuickView(engine, nullptr); QVERIFY(view); QCOMPARE(engine->incubationController(), view->incubationController()); - QQuickView *view2 = new QQuickView(engine, 0); + QQuickView *view2 = new QQuickView(engine, nullptr); QVERIFY(view); QCOMPARE(engine->incubationController(), view->incubationController()); delete view; @@ -228,7 +228,7 @@ void tst_QQuickView::engine() QVERIFY(!engine->incubationController()); QQuickView *view3 = new QQuickView; - QQuickView *view4 = new QQuickView(view3->engine(), 0); + QQuickView *view4 = new QQuickView(view3->engine(), nullptr); QVERIFY(view3->engine()); QVERIFY(view4->engine()); diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index bf43e976ab..da227b871b 100644 --- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -76,13 +76,13 @@ class SingleRoleModel : public QAbstractItemModel public: struct Branch; struct Node { - Node(const QString &display = QString()) : branch(0), display(display) {} + Node(const QString &display = QString()) : branch(nullptr), display(display) {} Branch *branch; QString display; }; struct Branch { - Branch(Branch *parent = 0) : parent(parent) {} + Branch(Branch *parent = nullptr) : parent(parent) {} ~Branch() { foreach (const Node &child, children) delete child.branch; } int indexOf(Branch *branch) const { for (int i = 0; i < children.count(); ++i) { @@ -96,7 +96,7 @@ public: }; - SingleRoleModel(const QStringList &list = QStringList(), const QByteArray &role = "name", QObject *parent = 0) + SingleRoleModel(const QStringList &list = QStringList(), const QByteArray &role = "name", QObject *parent = nullptr) : QAbstractItemModel(parent), m_role(role) { foreach (const QString &string, list) @@ -255,7 +255,7 @@ class StandardItemModel : public QStandardItemModel Q_PROPERTY(QQmlListProperty<StandardItem> items READ items CONSTANT) Q_CLASSINFO("DefaultProperty", "items") public: - QQmlListProperty<StandardItem> items() { return QQmlListProperty<StandardItem>(this, 0, append, 0, 0, 0); } + QQmlListProperty<StandardItem> items() { return QQmlListProperty<StandardItem>(this, nullptr, append, nullptr, nullptr, nullptr); } static void append(QQmlListProperty<StandardItem> *property, StandardItem *item) { @@ -270,7 +270,7 @@ class DataSubObject : public QObject Q_PROPERTY(QString subName READ subName WRITE setSubName NOTIFY subNameChanged) public: - DataSubObject(QObject *parent=0) : QObject(parent) {} + DataSubObject(QObject *parent=nullptr) : QObject(parent) {} QString subName() const { return m_subName; } void setSubName(const QString &name) { @@ -296,8 +296,8 @@ class DataObject : public QObject Q_PROPERTY(QObject *object READ object) public: - DataObject(QObject *parent=0) : QObject(parent) {} - DataObject(const QString &name, const QString &color, QObject *parent=0) + DataObject(QObject *parent=nullptr) : QObject(parent) {} + DataObject(const QString &name, const QString &color, QObject *parent=nullptr) : QObject(parent), m_name(name), m_color(color), m_object(new DataSubObject(this)) { } @@ -336,11 +336,11 @@ class ItemRequester : public QObject { Q_OBJECT public: - ItemRequester(QObject *parent = 0) + ItemRequester(QObject *parent = nullptr) : QObject(parent) - , itemInitialized(0) - , itemCreated(0) - , itemDestroyed(0) + , itemInitialized(nullptr) + , itemCreated(nullptr) + , itemDestroyed(nullptr) , indexInitialized(-1) , indexCreated(-1) { @@ -511,7 +511,7 @@ void tst_qquickvisualdatamodel::rootIndex() engine.rootContext()->setContextProperty("myModel", &model); QQmlDelegateModel *obj = qobject_cast<QQmlDelegateModel*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QMetaObject::invokeMethod(obj, "setRoot"); QCOMPARE(qvariant_cast<QModelIndex>(obj->rootIndex()), model.index(0,0)); @@ -549,10 +549,10 @@ void tst_qquickvisualdatamodel::updateLayout() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "display", 0); QVERIFY(name); @@ -599,10 +599,10 @@ void tst_qquickvisualdatamodel::childChanged() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *vdm = listview->findChild<QQmlDelegateModel*>("visualModel"); vdm->setRootIndex(QVariant::fromValue(model.indexFromItem(model.item(1,0)))); @@ -624,7 +624,7 @@ void tst_qquickvisualdatamodel::childChanged() listview->forceLayout(); name = findItem<QQuickText>(contentItem, "display", 1); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), QString("Row 2 Child Item 2")); model.item(1,0)->takeRow(1); @@ -662,10 +662,10 @@ void tst_qquickvisualdatamodel::objectListModel() view.setSource(testFileUrl("objectlist.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "name", 0); QCOMPARE(name->text(), QString("Item 1")); @@ -701,10 +701,10 @@ void tst_qquickvisualdatamodel::singleRole() view.setSource(testFileUrl("singlerole1.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "name", 1); QCOMPARE(name->text(), QString("two")); @@ -723,10 +723,10 @@ void tst_qquickvisualdatamodel::singleRole() view.setSource(testFileUrl("singlerole2.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "name", 1); QCOMPARE(name->text(), QString("two")); @@ -745,10 +745,10 @@ void tst_qquickvisualdatamodel::singleRole() view.setSource(testFileUrl("singlerole2.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "name", 1); QCOMPARE(name->text(), QString("two")); @@ -771,10 +771,10 @@ void tst_qquickvisualdatamodel::modelProperties() view.setSource(testFileUrl("modelproperties.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 1); QVERIFY(delegate); @@ -804,10 +804,10 @@ void tst_qquickvisualdatamodel::modelProperties() view.setSource(testFileUrl("modelproperties.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 1); QVERIFY(delegate); @@ -833,10 +833,10 @@ void tst_qquickvisualdatamodel::modelProperties() view.setSource(testFileUrl("modelproperties.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 0); QVERIFY(delegate); @@ -875,10 +875,10 @@ void tst_qquickvisualdatamodel::modelProperties() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 1); QVERIFY(delegate); @@ -917,13 +917,13 @@ void tst_qquickvisualdatamodel::noDelegate() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQmlDelegateModel *vdm = listview->findChild<QQmlDelegateModel*>("visualModel"); - QVERIFY(vdm != 0); + QVERIFY(vdm != nullptr); QCOMPARE(vdm->count(), 3); - vdm->setDelegate(0); + vdm->setDelegate(nullptr); QCOMPARE(vdm->count(), 0); } @@ -955,7 +955,7 @@ void tst_qquickvisualdatamodel::itemsDestroyed() QVERIFY(delegate = findItem<QQuickItem>(view.contentItem(), "delegate", 1)); } - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QVERIFY(!delegate); } @@ -975,16 +975,16 @@ void tst_qquickvisualdatamodel::packagesDestroyed() qApp->processEvents(); QQuickListView *leftview = findItem<QQuickListView>(view.rootObject(), "leftList"); - QTRY_VERIFY(leftview != 0); + QTRY_VERIFY(leftview != nullptr); QQuickListView *rightview = findItem<QQuickListView>(view.rootObject(), "rightList"); - QTRY_VERIFY(rightview != 0); + QTRY_VERIFY(rightview != nullptr); QQuickItem *leftContent = leftview->contentItem(); - QTRY_VERIFY(leftContent != 0); + QTRY_VERIFY(leftContent != nullptr); QQuickItem *rightContent = rightview->contentItem(); - QTRY_VERIFY(rightContent != 0); + QTRY_VERIFY(rightContent != nullptr); leftview->forceLayout(); rightview->forceLayout(); @@ -1052,7 +1052,7 @@ void tst_qquickvisualdatamodel::qaimRowsMoved() engine.rootContext()->setContextProperty("myModel", &model); QQmlDelegateModel *obj = qobject_cast<QQmlDelegateModel*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QSignalSpy spy(obj, SIGNAL(modelUpdated(QQmlChangeSet,bool))); model.emitMove(sourceFirst, sourceLast, destinationChild); @@ -1217,7 +1217,7 @@ void tst_qquickvisualdatamodel::watchedRoles() QQuickItem *item = qobject_cast<QQuickItem*>(vdm->object(0)); QVERIFY(item); vdm->release(item); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. QSignalSpy spy(vdm, SIGNAL(modelUpdated(QQmlChangeSet,bool))); QQmlChangeSet changeSet; @@ -1305,7 +1305,7 @@ void tst_qquickvisualdatamodel::hasModelChildren() QCOMPARE(vdm->count(), 4); - QQuickItem *item = 0; + QQuickItem *item = nullptr; item = qobject_cast<QQuickItem*>(vdm->object(0)); QVERIFY(item); @@ -1326,7 +1326,7 @@ void tst_qquickvisualdatamodel::hasModelChildren() QVERIFY(item); QCOMPARE(item->property("modelChildren").toBool(), false); vdm->release(item); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. QCOMPARE(vdm->stringValue(0, QLatin1String("hasModelChildren")), QVariant(true).toString()); QCOMPARE(vdm->stringValue(1, QLatin1String("hasModelChildren")), QVariant(false).toString()); @@ -1355,7 +1355,7 @@ void tst_qquickvisualdatamodel::setValue() QCOMPARE(vdm->count(), 3); - QQuickItem *item = 0; + QQuickItem *item = nullptr; item = qobject_cast<QQuickItem*>(vdm->object(0)); QVERIFY(item); @@ -1366,7 +1366,7 @@ void tst_qquickvisualdatamodel::setValue() vdm->release(item); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. } void tst_qquickvisualdatamodel::remove_data() @@ -1406,10 +1406,10 @@ void tst_qquickvisualdatamodel::remove() view.setSource(testFileUrl("groups.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model())); QVERIFY(visualModel); @@ -1515,10 +1515,10 @@ void tst_qquickvisualdatamodel::move() view.setSource(testFileUrl("groups.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model())); QVERIFY(visualModel); @@ -1704,10 +1704,10 @@ void tst_qquickvisualdatamodel::groups() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = listview->findChild<QQmlDelegateModel *>("visualModel"); QVERIFY(visualModel); @@ -2024,10 +2024,10 @@ void tst_qquickvisualdatamodel::get() view.setSource(testFileUrl("groups.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model())); QVERIFY(visualModel); @@ -2317,10 +2317,10 @@ void tst_qquickvisualdatamodel::create() view.setSource(testFileUrl("create.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model())); QVERIFY(visualModel); @@ -3151,7 +3151,7 @@ void tst_qquickvisualdatamodel::insert() QCOMPARE(evaluate<int>(visualModel, get + ".selectedIndex"), selected && i > index ? 1 : 0); } - QObject *item = 0; + QObject *item = nullptr; if (inItems) item = evaluate<QObject *>(visualModel, QString("items.create(%1)").arg(index)); @@ -3615,7 +3615,7 @@ void tst_qquickvisualdatamodel::resolve() QCOMPARE(evaluate<int>(visualModel, get + ".selectedIndex"), selected && i > index ? 1 : 0); } - QObject *item = 0; + QObject *item = nullptr; if (inItems) item = evaluate<QObject *>(visualModel, QString("items.create(%1)").arg(index)); diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index d11f6e8e05..cd3486f95f 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -73,10 +73,10 @@ static QTouchEvent::TouchPoint makeTouchPoint(QQuickItem *item, const QPointF &p return tp; } -static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states = 0, +static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states = nullptr, const QList<QTouchEvent::TouchPoint>& touchPoints = QList<QTouchEvent::TouchPoint>()) { - TouchEventData d = { type, 0, w, states, touchPoints }; + TouchEventData d = { type, nullptr, w, states, touchPoints }; return d; } static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states, const QTouchEvent::TouchPoint &touchPoint) @@ -114,7 +114,7 @@ class RootItemAccessor : public QQuickItem public: RootItemAccessor() : m_rootItemDestroyed(false) - , m_rootItem(0) + , m_rootItem(nullptr) { } Q_INVOKABLE QQuickItem *contentItem() @@ -141,7 +141,7 @@ class TestTouchItem : public QQuickRectangle { Q_OBJECT public: - TestTouchItem(QQuickItem *parent = 0) + TestTouchItem(QQuickItem *parent = nullptr) : QQuickRectangle(parent), acceptTouchEvents(true), acceptMouseEvents(true), mousePressCount(0), mouseMoveCount(0), spinLoopWhenPressed(false), touchEventCount(0), @@ -157,7 +157,7 @@ public: setEnabled(true); setVisible(true); - lastEvent = makeTouchData(QEvent::None, window(), 0, QList<QTouchEvent::TouchPoint>());//CHECK_VALID + lastEvent = makeTouchData(QEvent::None, window(), nullptr, QList<QTouchEvent::TouchPoint>());//CHECK_VALID lastVelocity = lastVelocityFromMouseMove = QVector2D(); lastMousePos = QPointF(); @@ -281,14 +281,14 @@ class ConstantUpdateItem : public QQuickItem { Q_OBJECT public: - ConstantUpdateItem(QQuickItem *parent = 0) : QQuickItem(parent), iterations(0) {setFlag(ItemHasContents);} + ConstantUpdateItem(QQuickItem *parent = nullptr) : QQuickItem(parent), iterations(0) {setFlag(ItemHasContents);} int iterations; protected: QSGNode* updatePaintNode(QSGNode *, UpdatePaintNodeData *){ iterations++; update(); - return 0; + return nullptr; } }; @@ -896,7 +896,7 @@ void tst_qquickwindow::touchEvent_cancel() COMPARE_TOUCH_DATA(item->lastEvent, d); item->reset(); - QWindowSystemInterface::handleTouchCancelEvent(0, touchDevice); + QWindowSystemInterface::handleTouchCancelEvent(nullptr, touchDevice); QCoreApplication::processEvents(); d = makeTouchData(QEvent::TouchCancel, window); COMPARE_TOUCH_DATA(item->lastEvent, d); @@ -930,7 +930,7 @@ void tst_qquickwindow::touchEvent_cancelClearsMouseGrab() QTRY_COMPARE(item->mousePressCount, 1); QTRY_COMPARE(item->mouseUngrabEventCount, 0); - QWindowSystemInterface::handleTouchCancelEvent(0, touchDevice); + QWindowSystemInterface::handleTouchCancelEvent(nullptr, touchDevice); QCoreApplication::processEvents(); QTRY_COMPARE(item->mouseUngrabEventCount, 1); @@ -1283,7 +1283,7 @@ void tst_qquickwindow::mouseFiltering() QPoint pos(100, 100); - QTest::mousePress(window, Qt::LeftButton, 0, pos); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, pos); // Mouse filtering propagates down the stack, so the // correct order is @@ -1295,7 +1295,7 @@ void tst_qquickwindow::mouseFiltering() QTRY_COMPARE(topItem->mousePressCount, 3); QCOMPARE(siblingItem->mousePressCount, 0); - QTest::mouseRelease(window, Qt::LeftButton, 0, pos); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, pos); topItem->clearMouseEventCounters(); middleItem->clearMouseEventCounters(); bottomItem->clearMouseEventCounters(); @@ -1304,7 +1304,7 @@ void tst_qquickwindow::mouseFiltering() // Repeat, but this time have the top item accept the press topItem->acceptMouseEvents = true; - QTest::mousePress(window, Qt::LeftButton, 0, pos); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, pos); // Mouse filtering propagates down the stack, so the // correct order is @@ -1327,7 +1327,7 @@ void tst_qquickwindow::mouseFiltering() QCOMPARE(siblingItem->mouseMoveCount, 0); // clean up mouse press state for the next tests - QTest::mouseRelease(window, Qt::LeftButton, 0, pos); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, pos); } void tst_qquickwindow::qmlCreation() @@ -1752,7 +1752,7 @@ void tst_qquickwindow::ownershipRootItem() QVERIFY(accessor); engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(!accessor->isRootItemDestroyed()); } @@ -1859,7 +1859,7 @@ void tst_qquickwindow::cursor() QCOMPARE(window.cursor().shape(), Qt::WaitCursor); // Try with the mouse pressed. - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100, 100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 100)); QTest::mouseMove(&window, QPoint(20, 20)); QCOMPARE(window.cursor().shape(), Qt::IBeamCursor); QTest::mouseMove(&window, QPoint(125, 125)); @@ -1870,12 +1870,12 @@ void tst_qquickwindow::cursor() QCOMPARE(window.cursor().shape(), Qt::ArrowCursor); QTest::mouseMove(&window, QPoint(100, 100)); QCOMPARE(window.cursor().shape(), Qt::WaitCursor); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 100)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 100)); // Remove the cursor item from the scene. Theoretically this should make parentItem the // cursorItem, but given the situation will correct itself after the next mouse move it // simply unsets the window cursor for now. - childItem.setParentItem(0); + childItem.setParentItem(nullptr); QCOMPARE(window.cursor().shape(), Qt::ArrowCursor); parentItem.setCursor(Qt::SizeAllCursor); @@ -1891,7 +1891,7 @@ void tst_qquickwindow::cursor() QCOMPARE(childItem.cursor().shape(), Qt::ArrowCursor); QCOMPARE(window.cursor().shape(), Qt::ArrowCursor); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 101)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 101)); QCOMPARE(window.cursor().shape(), Qt::SizeAllCursor); } #endif @@ -1912,8 +1912,8 @@ void tst_qquickwindow::hideThenDelete() QFETCH(bool, persistentSG); QFETCH(bool, persistentGL); - QSignalSpy *openglDestroyed = 0; - QSignalSpy *sgInvalidated = 0; + QSignalSpy *openglDestroyed = nullptr; + QSignalSpy *sgInvalidated = nullptr; { QQuickWindow window; @@ -2051,7 +2051,7 @@ void tst_qquickwindow::requestActivate() QString warning = QString::fromLatin1("Mouse event MousePress not accepted by receiving window"); QWARN(warning.toLatin1().data()); } - me = QMouseEvent(QEvent::MouseButtonPress, pos, window1->mapToGlobal(pos), Qt::LeftButton, 0, Qt::NoModifier); + me = QMouseEvent(QEvent::MouseButtonPress, pos, window1->mapToGlobal(pos), Qt::LeftButton, nullptr, Qt::NoModifier); QSpontaneKeyEvent::setSpontaneous(&me); if (!qApp->notify(window1.data(), &me)) { QString warning = QString::fromLatin1("Mouse event MouseRelease not accepted by receiving window"); @@ -2412,7 +2412,7 @@ void tst_qquickwindow::attachedProperty() QCOMPARE(text->property("windowHeight").toInt(), innerWindow->height()); QCOMPARE(text->property("window").value<QQuickWindow*>(), innerWindow); - text->setParentItem(0); + text->setParentItem(nullptr); QVERIFY(!text->property("contentItem").value<QQuickItem*>()); QCOMPARE(text->property("windowWidth").toInt(), 0); QCOMPARE(text->property("windowHeight").toInt(), 0); @@ -2435,7 +2435,7 @@ public: class GlRenderJob : public QRunnable { public: - GlRenderJob(GLubyte *buf) : readPixel(buf), mutex(0), condition(0) {} + GlRenderJob(GLubyte *buf) : readPixel(buf), mutex(nullptr), condition(nullptr) {} ~GlRenderJob() {} void run() { QOpenGLContext::currentContext()->functions()->glClearColor(1.0f, 0, 0, 1.0f); @@ -2546,7 +2546,7 @@ void tst_qquickwindow::testRenderJob() class EventCounter : public QQuickRectangle { public: - EventCounter(QQuickItem *parent = 0) + EventCounter(QQuickItem *parent = nullptr) : QQuickRectangle(parent) { } @@ -2654,7 +2654,7 @@ class HoverTimestampConsumer : public QQuickItem { Q_OBJECT public: - HoverTimestampConsumer(QQuickItem *parent = 0) + HoverTimestampConsumer(QQuickItem *parent = nullptr) : QQuickItem(parent) { setAcceptHoverEvents(true); @@ -2737,7 +2737,7 @@ void tst_qquickwindow::testHoverTimestamp() class CircleItem : public QQuickRectangle { public: - CircleItem(QQuickItem *parent = 0) : QQuickRectangle(parent) { } + CircleItem(QQuickItem *parent = nullptr) : QQuickRectangle(parent) { } void setRadius(qreal radius) { const qreal diameter = radius*2; @@ -2883,7 +2883,7 @@ class TestDropTarget : public QQuickItem { Q_OBJECT public: - TestDropTarget(QQuickItem *parent = 0) + TestDropTarget(QQuickItem *parent = nullptr) : QQuickItem(parent) , enterDropAction(Qt::CopyAction) , moveDropAction(Qt::CopyAction) @@ -2944,10 +2944,10 @@ public: ~DragEventTester() { qDeleteAll(events); events.clear(); - enterEvent = 0; - moveEvent = 0; - dropEvent = 0; - leaveEvent = 0; + enterEvent = nullptr; + moveEvent = nullptr; + dropEvent = nullptr; + leaveEvent = nullptr; } void addEnterEvent() @@ -3494,7 +3494,7 @@ void tst_qquickwindow::testChildMouseEventFilter() DeliveryRecordVector &actualDeliveryOrder = EventItem::deliveryList(); actualDeliveryOrder.clear(); - QTest::mousePress(&window, Qt::LeftButton, 0, mousePos); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, mousePos); // Check if event got delivered to the root item. If so, append it to the list of items the event got delivered to if (rootFilter->events.contains(QEvent::MouseButtonPress)) @@ -3511,7 +3511,7 @@ void tst_qquickwindow::testChildMouseEventFilter() } // "restore" mouse state - QTest::mouseRelease(&window, Qt::LeftButton, 0, mousePos); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, mousePos); } diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index f62fdd09a2..2479450287 100644 --- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp +++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp @@ -116,7 +116,7 @@ private slots: private: bool m_brokenMipmapSupport; - QQuickView *createView(const QString &file, QWindow *parent = 0, int x = -1, int y = -1, int w = -1, int h = -1); + QQuickView *createView(const QString &file, QWindow *parent = nullptr, int x = -1, int y = -1, int w = -1, int h = -1); bool isRunningOnOpenGL(); }; @@ -231,7 +231,7 @@ void tst_SceneGraph::manyWindows_data() #if QT_CONFIG(opengl) struct ShareContextResetter { public: - ~ShareContextResetter() { qt_gl_set_global_share_context(0); } + ~ShareContextResetter() { qt_gl_set_global_share_context(nullptr); } }; #endif diff --git a/tests/auto/quick/sharedimage/tst_sharedimage.cpp b/tests/auto/quick/sharedimage/tst_sharedimage.cpp index b91fc8a0de..afadb76ad0 100644 --- a/tests/auto/quick/sharedimage/tst_sharedimage.cpp +++ b/tests/auto/quick/sharedimage/tst_sharedimage.cpp @@ -90,7 +90,7 @@ void tst_sharedimage::compareToPlainLoad() engine.loadData(i ? sharedScript : plainScript); QVERIFY(engine.rootObjects().size()); QQuickImage *obj = qobject_cast<QQuickImage*>(engine.rootObjects().at(0)); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QTRY_VERIFY(!obj->image().isNull()); images[i] = obj->image(); } diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 646317078b..67a7c56099 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -86,7 +86,7 @@ Q_SIGNALS: void onTouchEvent(QQuickItem *receiver); public: - EventItem(QQuickItem *parent = 0) + EventItem(QQuickItem *parent = nullptr) : QQuickItem(parent), touchUngrabCount(0), acceptMouse(false), acceptTouch(false), filterTouch(false), point0(-1) { setAcceptedMouseButtons(Qt::LeftButton); @@ -220,7 +220,7 @@ private: QQuickView *tst_TouchMouse::createView() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); return window; } @@ -240,7 +240,7 @@ void tst_TouchMouse::simpleTouchEvent() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); QVERIFY(eventItem1); @@ -402,7 +402,7 @@ void tst_TouchMouse::mouse() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); QVERIFY(eventItem1); @@ -432,7 +432,7 @@ void tst_TouchMouse::touchOverMouse() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); QVERIFY(eventItem1); @@ -472,7 +472,7 @@ void tst_TouchMouse::mouseOverTouch() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); QVERIFY(eventItem1); @@ -513,7 +513,7 @@ void tst_TouchMouse::buttonOnFlickable() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable"); QVERIFY(flickable); @@ -631,7 +631,7 @@ void tst_TouchMouse::touchButtonOnFlickable() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable"); QVERIFY(flickable); @@ -708,7 +708,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable"); QVERIFY(flickable); @@ -806,7 +806,7 @@ void tst_TouchMouse::buttonOnTouch() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QVERIFY(pinchArea); @@ -848,7 +848,7 @@ void tst_TouchMouse::buttonOnTouch() eventItem1->eventList.clear(); // Normal mouse click - QTest::mouseClick(window.data(), Qt::LeftButton, 0, p1); + QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(eventItem1->eventList.size(), 3); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress); QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonRelease); @@ -942,7 +942,7 @@ void tst_TouchMouse::pinchOnFlickable() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QVERIFY(pinchArea); @@ -1023,7 +1023,7 @@ void tst_TouchMouse::flickableOnPinch() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QVERIFY(pinchArea); @@ -1102,7 +1102,7 @@ void tst_TouchMouse::mouseOnFlickableOnPinch() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QRect windowRect = QRect(window->position(), window->size()); QCursor::setPos(windowRect.center()); @@ -1235,7 +1235,7 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMouseArea *bottomMouseArea = window->rootObject()->findChild<QQuickMouseArea*>("rear mouseArea"); @@ -1275,7 +1275,7 @@ void tst_TouchMouse::touchGrabCausesMouseUngrab() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *leftItem = window->rootObject()->findChild<EventItem*>("leftItem"); QVERIFY(leftItem); @@ -1309,7 +1309,7 @@ void tst_TouchMouse::touchGrabCausesMouseUngrab() // has been grabbed by another item. QCOMPARE(leftItem->eventList.size(), 1); QCOMPARE(leftItem->eventList.at(0).type, QEvent::UngrabMouse); - QCOMPARE(window->mouseGrabberItem(), (QQuickItem*)0); + QCOMPARE(window->mouseGrabberItem(), (QQuickItem*)nullptr); } void tst_TouchMouse::touchPointDeliveryOrder() @@ -1425,13 +1425,13 @@ void tst_TouchMouse::hoverEnabled() window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickItem *root = window->rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea1 = root->findChild<QQuickMouseArea*>("mouseArea1"); - QVERIFY(mouseArea1 != 0); + QVERIFY(mouseArea1 != nullptr); QQuickMouseArea *mouseArea2 = root->findChild<QQuickMouseArea*>("mouseArea2"); - QVERIFY(mouseArea2 != 0); + QVERIFY(mouseArea2 != nullptr); QSignalSpy enterSpy1(mouseArea1, SIGNAL(entered())); QSignalSpy exitSpy1(mouseArea1, SIGNAL(exited())); @@ -1508,7 +1508,7 @@ void tst_TouchMouse::implicitUngrab() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickItem *root = window->rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); EventItem *eventItem = root->findChild<EventItem*>("eventItem1"); eventItem->acceptMouse = true; QPoint p1(20, 20); diff --git a/tests/auto/quicktest/signalspy/tst_signalspy.cpp b/tests/auto/quicktest/signalspy/tst_signalspy.cpp index c062edd977..0806f43c1c 100644 --- a/tests/auto/quicktest/signalspy/tst_signalspy.cpp +++ b/tests/auto/quicktest/signalspy/tst_signalspy.cpp @@ -58,7 +58,7 @@ void tst_SignalSpy::testValid() { QQuickView window; window.setSource(testFileUrl("signalspy.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QObject *mouseSpy = window.rootObject()->findChild<QObject*>("mouseSpy"); QVERIFY(mouseSpy->property("valid").toBool()); @@ -74,7 +74,7 @@ void tst_SignalSpy::testCount() window.setSource(testFileUrl("signalspy.qml")); window.show(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QObject *mouseSpy = window.rootObject()->findChild<QObject*>("mouseSpy"); QCOMPARE(mouseSpy->property("count").toInt(), 0); diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp index 51755c8502..a97e3c0538 100644 --- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp +++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp @@ -354,8 +354,8 @@ void tst_qquickwidget::errors() void tst_qquickwidget::engine() { QScopedPointer<QQmlEngine> engine(new QQmlEngine); - QScopedPointer<QQuickWidget> view(new QQuickWidget(engine.data(), 0)); - QScopedPointer<QQuickWidget> view2(new QQuickWidget(view->engine(), 0)); + QScopedPointer<QQuickWidget> view(new QQuickWidget(engine.data(), nullptr)); + QScopedPointer<QQuickWidget> view2(new QQuickWidget(view->engine(), nullptr)); QVERIFY(view->engine()); QVERIFY(view2->engine()); |