diff options
author | Liang Qi <liang.qi@qt.io> | 2018-02-27 08:43:10 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-02-27 08:43:10 +0100 |
commit | bb7a5d0cb6e62fa411e8b66759bf6b798c3f68d9 (patch) | |
tree | 06c325dc386afd26281ba0ebdbf4fd3f56f892b0 | |
parent | 41edb3bd9f373a865d5698ac8c18bf341071eae9 (diff) | |
parent | e41d067227eb6225b05df88ab724708588fa5304 (diff) | |
download | qtdeclarative-bb7a5d0cb6e62fa411e8b66759bf6b798c3f68d9.tar.gz |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/qml/jsruntime/qv4engine.cpp
src/qml/jsruntime/qv4internalclass.cpp
src/qml/parser/qqmljslexer.cpp
src/qml/qml/v8/qv8engine.cpp
src/qml/util/qqmladaptormodel_p.h
src/quick/items/qquickanimatedsprite.cpp
tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
Change-Id: I16702b7a0da29c2a332afee47728d6a6ebf4fb3f
695 files changed, 6929 insertions, 7095 deletions
diff --git a/examples/qml/qmlextensionplugins/plugin.cpp b/examples/qml/qmlextensionplugins/plugin.cpp index c00c7bc015..3ef7f04f95 100644 --- a/examples/qml/qmlextensionplugins/plugin.cpp +++ b/examples/qml/qmlextensionplugins/plugin.cpp @@ -115,7 +115,7 @@ class TimeModel : public QObject //![0] public: - TimeModel(QObject *parent=0) : QObject(parent) + TimeModel(QObject *parent=nullptr) : QObject(parent) { if (++instances == 1) { if (!timer) @@ -145,7 +145,7 @@ private: }; int TimeModel::instances=0; -MinuteTimer *TimeModel::timer=0; +MinuteTimer *TimeModel::timer=nullptr; //![plugin] class QExampleQmlPlugin : public QQmlExtensionPlugin diff --git a/examples/qml/referenceexamples/attached/birthdayparty.cpp b/examples/qml/referenceexamples/attached/birthdayparty.cpp index 2594fea641..26aa56e86c 100644 --- a/examples/qml/referenceexamples/attached/birthdayparty.cpp +++ b/examples/qml/referenceexamples/attached/birthdayparty.cpp @@ -65,7 +65,7 @@ void BirthdayPartyAttached::setRsvp(const QDate &d) } BirthdayParty::BirthdayParty(QObject *parent) -: QObject(parent), m_host(0) +: QObject(parent), m_host(nullptr) { } diff --git a/examples/qml/referenceexamples/binding/birthdayparty.cpp b/examples/qml/referenceexamples/binding/birthdayparty.cpp index d30674a92d..866c1f6968 100644 --- a/examples/qml/referenceexamples/binding/birthdayparty.cpp +++ b/examples/qml/referenceexamples/binding/birthdayparty.cpp @@ -69,7 +69,7 @@ void BirthdayPartyAttached::setRsvp(const QDate &d) BirthdayParty::BirthdayParty(QObject *parent) -: QObject(parent), m_host(0) +: QObject(parent), m_host(nullptr) { } diff --git a/examples/qml/referenceexamples/coercion/birthdayparty.cpp b/examples/qml/referenceexamples/coercion/birthdayparty.cpp index fd6995597b..e729c42bb5 100644 --- a/examples/qml/referenceexamples/coercion/birthdayparty.cpp +++ b/examples/qml/referenceexamples/coercion/birthdayparty.cpp @@ -50,7 +50,7 @@ #include "birthdayparty.h" BirthdayParty::BirthdayParty(QObject *parent) -: QObject(parent), m_host(0) +: QObject(parent), m_host(nullptr) { } diff --git a/examples/qml/referenceexamples/default/birthdayparty.cpp b/examples/qml/referenceexamples/default/birthdayparty.cpp index fd6995597b..e729c42bb5 100644 --- a/examples/qml/referenceexamples/default/birthdayparty.cpp +++ b/examples/qml/referenceexamples/default/birthdayparty.cpp @@ -50,7 +50,7 @@ #include "birthdayparty.h" BirthdayParty::BirthdayParty(QObject *parent) -: QObject(parent), m_host(0) +: QObject(parent), m_host(nullptr) { } diff --git a/examples/qml/referenceexamples/grouped/birthdayparty.cpp b/examples/qml/referenceexamples/grouped/birthdayparty.cpp index fd6995597b..e729c42bb5 100644 --- a/examples/qml/referenceexamples/grouped/birthdayparty.cpp +++ b/examples/qml/referenceexamples/grouped/birthdayparty.cpp @@ -50,7 +50,7 @@ #include "birthdayparty.h" BirthdayParty::BirthdayParty(QObject *parent) -: QObject(parent), m_host(0) +: QObject(parent), m_host(nullptr) { } diff --git a/examples/qml/referenceexamples/grouped/main.cpp b/examples/qml/referenceexamples/grouped/main.cpp index 8a137b0380..17dcd09c34 100644 --- a/examples/qml/referenceexamples/grouped/main.cpp +++ b/examples/qml/referenceexamples/grouped/main.cpp @@ -76,7 +76,7 @@ int main(int argc, char ** argv) else qWarning() << "She is inviting:"; - Person *bestShoe = 0; + Person *bestShoe = nullptr; for (int ii = 0; ii < party->guestCount(); ++ii) { Person *guest = party->guest(ii); qWarning() << " " << guest->name(); diff --git a/examples/qml/referenceexamples/methods/birthdayparty.cpp b/examples/qml/referenceexamples/methods/birthdayparty.cpp index 7f2a2cc153..dfb36257eb 100644 --- a/examples/qml/referenceexamples/methods/birthdayparty.cpp +++ b/examples/qml/referenceexamples/methods/birthdayparty.cpp @@ -50,7 +50,7 @@ #include "birthdayparty.h" BirthdayParty::BirthdayParty(QObject *parent) -: QObject(parent), m_host(0) +: QObject(parent), m_host(nullptr) { } diff --git a/examples/qml/referenceexamples/properties/birthdayparty.cpp b/examples/qml/referenceexamples/properties/birthdayparty.cpp index 1cb79c8b1b..8a5e9e553e 100644 --- a/examples/qml/referenceexamples/properties/birthdayparty.cpp +++ b/examples/qml/referenceexamples/properties/birthdayparty.cpp @@ -50,7 +50,7 @@ #include "birthdayparty.h" BirthdayParty::BirthdayParty(QObject *parent) -: QObject(parent), m_host(0) +: QObject(parent), m_host(nullptr) { } diff --git a/examples/qml/referenceexamples/signal/birthdayparty.cpp b/examples/qml/referenceexamples/signal/birthdayparty.cpp index c0e4f177e5..a5fbb742a5 100644 --- a/examples/qml/referenceexamples/signal/birthdayparty.cpp +++ b/examples/qml/referenceexamples/signal/birthdayparty.cpp @@ -66,7 +66,7 @@ void BirthdayPartyAttached::setRsvp(const QDate &d) BirthdayParty::BirthdayParty(QObject *parent) -: QObject(parent), m_host(0) +: QObject(parent), m_host(nullptr) { } diff --git a/examples/qml/referenceexamples/valuesource/birthdayparty.cpp b/examples/qml/referenceexamples/valuesource/birthdayparty.cpp index beb59315ea..b107c61570 100644 --- a/examples/qml/referenceexamples/valuesource/birthdayparty.cpp +++ b/examples/qml/referenceexamples/valuesource/birthdayparty.cpp @@ -66,7 +66,7 @@ void BirthdayPartyAttached::setRsvp(const QDate &d) BirthdayParty::BirthdayParty(QObject *parent) -: QObject(parent), m_host(0) +: QObject(parent), m_host(nullptr) { } diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.cpp b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.cpp index 0107a1fc69..066963cf33 100644 --- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.cpp +++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.cpp @@ -51,7 +51,7 @@ #include "pieslice.h" PieChart::PieChart(QQuickItem *parent) - : QQuickItem(parent), m_pieSlice(0) + : QQuickItem(parent), m_pieSlice(nullptr) { } diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.cpp b/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.cpp index 699fce14ca..ac680bb9c9 100644 --- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.cpp +++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.cpp @@ -68,7 +68,7 @@ void PieChart::setName(const QString &name) //![0] QQmlListProperty<PieSlice> PieChart::slices() { - return QQmlListProperty<PieSlice>(this, 0, &PieChart::append_slice, 0, 0, 0); + return QQmlListProperty<PieSlice>(this, nullptr, &PieChart::append_slice, nullptr, nullptr, nullptr); } void PieChart::append_slice(QQmlListProperty<PieSlice> *list, PieSlice *slice) diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.cpp b/examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.cpp index 40b31b32de..1c712c887a 100644 --- a/examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.cpp +++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/import/piechart.cpp @@ -67,7 +67,7 @@ void PieChart::setName(const QString &name) QQmlListProperty<PieSlice> PieChart::slices() { - return QQmlListProperty<PieSlice>(this, 0, &PieChart::append_slice, 0, 0, 0); + return QQmlListProperty<PieSlice>(this, nullptr, &PieChart::append_slice, nullptr, nullptr, nullptr); } void PieChart::append_slice(QQmlListProperty<PieSlice> *list, PieSlice *slice) diff --git a/examples/quick/imageelements/animatedsprite.qml b/examples/quick/imageelements/animatedsprite.qml index ba3d8ffdbc..0c6bf5e28d 100644 --- a/examples/quick/imageelements/animatedsprite.qml +++ b/examples/quick/imageelements/animatedsprite.qml @@ -60,8 +60,6 @@ Item { //! [sprite] AnimatedSprite { id: sprite - width: 170 - height: 170 anchors.centerIn: parent source: "content/speaker.png" frameCount: 60 diff --git a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp b/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp index 1f1bd55cfd..139fcbae5c 100644 --- a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp +++ b/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp @@ -238,7 +238,7 @@ void FbItemRenderer::setupVertexAttribs() QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); f->glEnableVertexAttribArray(0); f->glEnableVertexAttribArray(1); - f->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), 0); + f->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), nullptr); f->glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(GLfloat), reinterpret_cast<void *>(3 * sizeof(GLfloat))); m_logoVbo.release(); } diff --git a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp b/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp index 524af1e915..84e116dce6 100644 --- a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp +++ b/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp @@ -58,8 +58,8 @@ #include <QQuickItem> MainWindow::MainWindow(bool transparency, bool noRenderAlpha) - : m_currentView(0), - m_currentRootObject(0), + : m_currentView(nullptr), + m_currentRootObject(nullptr), m_transparent(transparency), m_noRenderAlpha(noRenderAlpha) { diff --git a/examples/quick/quickwidgets/quickwidget/fbitem.cpp b/examples/quick/quickwidgets/quickwidget/fbitem.cpp index 7a5de991ce..6c71b6184e 100644 --- a/examples/quick/quickwidgets/quickwidget/fbitem.cpp +++ b/examples/quick/quickwidgets/quickwidget/fbitem.cpp @@ -58,7 +58,7 @@ class FbRenderer : public QQuickFramebufferObject::Renderer { public: - FbRenderer() : c(0), dir(1) { } + FbRenderer() { } // The lifetime of the FBO and this class depends on how QQuickWidget // manages the scenegraph and context when it comes to showing and hiding @@ -85,8 +85,8 @@ public: } private: - float c; - int dir; + float c = 0; + int dir = 1; }; #endif diff --git a/examples/quick/rendercontrol/cuberenderer.cpp b/examples/quick/rendercontrol/cuberenderer.cpp index 9acc1bd127..f3ecfc2566 100644 --- a/examples/quick/rendercontrol/cuberenderer.cpp +++ b/examples/quick/rendercontrol/cuberenderer.cpp @@ -60,10 +60,10 @@ CubeRenderer::CubeRenderer(QOffscreenSurface *offscreenSurface) : m_offscreenSurface(offscreenSurface), - m_context(0), - m_program(0), - m_vbo(0), - m_vao(0), + m_context(nullptr), + m_program(nullptr), + m_vbo(nullptr), + m_vao(nullptr), m_matrixLoc(0) { } @@ -180,7 +180,7 @@ void CubeRenderer::setupVertexAttribs() m_vbo->bind(); m_program->enableAttributeArray(0); m_program->enableAttributeArray(1); - m_context->functions()->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); + m_context->functions()->glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr); m_context->functions()->glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, (const void *)(36 * 3 * sizeof(GLfloat))); m_vbo->release(); diff --git a/examples/quick/rendercontrol/window_multithreaded.cpp b/examples/quick/rendercontrol/window_multithreaded.cpp index ac82847dbf..01d6b8b5b2 100644 --- a/examples/quick/rendercontrol/window_multithreaded.cpp +++ b/examples/quick/rendercontrol/window_multithreaded.cpp @@ -87,13 +87,13 @@ static const QEvent::Type STOP = QEvent::Type(QEvent::User + 4); static const QEvent::Type UPDATE = QEvent::Type(QEvent::User + 5); QuickRenderer::QuickRenderer() - : m_context(0), - m_surface(0), - m_fbo(0), - m_window(0), - m_quickWindow(0), - m_renderControl(0), - m_cubeRenderer(0), + : m_context(nullptr), + m_surface(nullptr), + m_fbo(nullptr), + m_window(nullptr), + m_quickWindow(nullptr), + m_renderControl(nullptr), + m_cubeRenderer(nullptr), m_quit(false) { } @@ -162,10 +162,10 @@ void QuickRenderer::cleanup() m_renderControl->invalidate(); delete m_fbo; - m_fbo = 0; + m_fbo = nullptr; delete m_cubeRenderer; - m_cubeRenderer = 0; + m_cubeRenderer = nullptr; m_context->doneCurrent(); m_context->moveToThread(QCoreApplication::instance()->thread()); @@ -177,7 +177,7 @@ void QuickRenderer::ensureFbo() { if (m_fbo && m_fbo->size() != m_window->size() * m_window->devicePixelRatio()) { delete m_fbo; - m_fbo = 0; + m_fbo = nullptr; } if (!m_fbo) { @@ -235,7 +235,7 @@ private: WindowMultiThreaded::WindowMultiThreaded() : m_qmlComponent(nullptr), - m_rootItem(0), + m_rootItem(nullptr), m_quickInitialized(false), m_psrRequested(false) { diff --git a/examples/quick/rendercontrol/window_singlethreaded.cpp b/examples/quick/rendercontrol/window_singlethreaded.cpp index d0bf0adad4..ddbbfe4b52 100644 --- a/examples/quick/rendercontrol/window_singlethreaded.cpp +++ b/examples/quick/rendercontrol/window_singlethreaded.cpp @@ -84,8 +84,8 @@ QWindow *RenderControl::renderWindow(QPoint *offset) } WindowSingleThreaded::WindowSingleThreaded() - : m_rootItem(0), - m_fbo(0), + : m_rootItem(nullptr), + m_fbo(nullptr), m_quickInitialized(false), m_quickReady(false), m_dpr(0) @@ -191,7 +191,7 @@ void WindowSingleThreaded::createFbo() void WindowSingleThreaded::destroyFbo() { delete m_fbo; - m_fbo = 0; + m_fbo = nullptr; } void WindowSingleThreaded::render() diff --git a/examples/quick/scenegraph/customgeometry/beziercurve.cpp b/examples/quick/scenegraph/customgeometry/beziercurve.cpp index 750ff6aa3b..72fc7e6f1b 100644 --- a/examples/quick/scenegraph/customgeometry/beziercurve.cpp +++ b/examples/quick/scenegraph/customgeometry/beziercurve.cpp @@ -127,8 +127,8 @@ void BezierCurve::setSegmentCount(int count) //! [4] QSGNode *BezierCurve::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { - QSGGeometryNode *node = 0; - QSGGeometry *geometry = 0; + QSGGeometryNode *node = nullptr; + QSGGeometry *geometry = nullptr; if (!oldNode) { node = new QSGGeometryNode; diff --git a/examples/quick/scenegraph/graph/graph.cpp b/examples/quick/scenegraph/graph/graph.cpp index 3ea6a8d07f..ccf98ef813 100644 --- a/examples/quick/scenegraph/graph/graph.cpp +++ b/examples/quick/scenegraph/graph/graph.cpp @@ -103,7 +103,7 @@ QSGNode *Graph::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) if (rect.isEmpty()) { delete n; - return 0; + return nullptr; } if (!n) { diff --git a/examples/quick/scenegraph/graph/linenode.cpp b/examples/quick/scenegraph/graph/linenode.cpp index 306909161e..b9ce1afc38 100644 --- a/examples/quick/scenegraph/graph/linenode.cpp +++ b/examples/quick/scenegraph/graph/linenode.cpp @@ -66,7 +66,7 @@ class LineShader : public QSGSimpleMaterialShader<LineMaterial> QSG_DECLARE_SIMPLE_SHADER(LineShader, LineMaterial) public: - LineShader() : id_color(-1), id_spread(-1), id_size(-1) { + LineShader() { setShaderSourceFile(QOpenGLShader::Vertex, ":/scenegraph/graph/shaders/line.vsh"); setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/line.fsh"); } @@ -86,9 +86,9 @@ public: } private: - int id_color; - int id_spread; - int id_size; + int id_color = -1; + int id_spread = -1; + int id_size = -1; }; struct LineVertex { diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp index 6e79bb247f..d1eaa1ec26 100644 --- a/examples/quick/scenegraph/graph/noisynode.cpp +++ b/examples/quick/scenegraph/graph/noisynode.cpp @@ -72,7 +72,7 @@ class NoisyShader : public QSGSimpleMaterialShader<NoisyMaterial> QSG_DECLARE_SIMPLE_SHADER(NoisyShader, NoisyMaterial) public: - NoisyShader() : id_color(-1), id_texture(-1), id_textureSize(-1) { + NoisyShader() { setShaderSourceFile(QOpenGLShader::Vertex, ":/scenegraph/graph/shaders/noisy.vsh"); setShaderSourceFile(QOpenGLShader::Fragment, ":/scenegraph/graph/shaders/noisy.fsh"); } @@ -103,9 +103,9 @@ public: } private: - int id_color; - int id_texture; - int id_textureSize; + int id_color = -1; + int id_texture = -1; + int id_textureSize = -1; }; NoisyNode::NoisyNode(QQuickWindow *window) diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp index b7082892b8..d6f6b327f2 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.cpp +++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp @@ -57,7 +57,7 @@ //! [7] Squircle::Squircle() : m_t(0) - , m_renderer(0) + , m_renderer(nullptr) { connect(this, &QQuickItem::windowChanged, this, &Squircle::handleWindowChanged); } @@ -95,7 +95,7 @@ void Squircle::cleanup() { if (m_renderer) { delete m_renderer; - m_renderer = 0; + m_renderer = nullptr; } } diff --git a/examples/quick/scenegraph/rendernode/softwarerenderer.cpp b/examples/quick/scenegraph/rendernode/softwarerenderer.cpp index b6f7ffa577..0a0ec4b485 100644 --- a/examples/quick/scenegraph/rendernode/softwarerenderer.cpp +++ b/examples/quick/scenegraph/rendernode/softwarerenderer.cpp @@ -98,7 +98,7 @@ void SoftwareRenderNode::render(const RenderState *renderState) QSGRenderNode::StateFlags SoftwareRenderNode::changedStates() const { - return 0; + return nullptr; } QSGRenderNode::RenderingFlags SoftwareRenderNode::flags() const diff --git a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp index 9782a83a90..27cb0eb5ea 100644 --- a/examples/quick/scenegraph/textureinthread/threadrenderer.cpp +++ b/examples/quick/scenegraph/textureinthread/threadrenderer.cpp @@ -74,11 +74,11 @@ class RenderThread : public QThread Q_OBJECT public: RenderThread(const QSize &size) - : surface(0) - , context(0) - , m_renderFbo(0) - , m_displayFbo(0) - , m_logoRenderer(0) + : surface(nullptr) + , context(nullptr) + , m_renderFbo(nullptr) + , m_displayFbo(nullptr) + , m_logoRenderer(nullptr) , m_size(size) { ThreadRenderer::threads << this; @@ -156,7 +156,7 @@ public: TextureNode(QQuickWindow *window) : m_id(0) , m_size(0, 0) - , m_texture(0) + , m_texture(nullptr) , m_window(window) { // Our texture node must have a texture, so use the default 0 texture. @@ -224,7 +224,7 @@ private: }; ThreadRenderer::ThreadRenderer() - : m_renderThread(0) + : m_renderThread(nullptr) { setFlag(ItemHasContents, true); m_renderThread = new RenderThread(QSize(512, 512)); @@ -264,7 +264,7 @@ QSGNode *ThreadRenderer::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * current->makeCurrent(window()); QMetaObject::invokeMethod(this, "ready"); - return 0; + return nullptr; } if (!node) { diff --git a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp index 1b1692eab6..3c02c4695e 100644 --- a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp +++ b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp @@ -149,8 +149,8 @@ public: // Set up material so it is all set for later.. m_material = XorBlendShader::createMaterial(); - m_material->state()->texture1 = 0; - m_material->state()->texture2 = 0; + m_material->state()->texture1 = nullptr; + m_material->state()->texture2 = nullptr; m_material->setFlag(QSGMaterial::Blending); m_node.setMaterial(m_material); m_node.setFlag(QSGNode::OwnsMaterial); @@ -214,8 +214,8 @@ private: XorBlender::XorBlender(QQuickItem *parent) : QQuickItem(parent) - , m_source1(0) - , m_source2(0) + , m_source1(nullptr) + , m_source2(nullptr) , m_source1Changed(false) , m_source2Changed(false) { @@ -256,7 +256,7 @@ QSGNode *XorBlender::updatePaintNode(QSGNode *old, UpdatePaintNodeData *) } if (abort) { delete old; - return 0; + return nullptr; } XorNode *node = static_cast<XorNode *>(old); @@ -264,7 +264,7 @@ QSGNode *XorBlender::updatePaintNode(QSGNode *old, UpdatePaintNodeData *) // If the sources have changed, recreate the nodes if (m_source1Changed || m_source2Changed) { delete node; - node = 0; + node = nullptr; m_source1Changed = false; m_source2Changed = false; } diff --git a/examples/quick/textureprovider/etcprovider.cpp b/examples/quick/textureprovider/etcprovider.cpp index de8eb12366..01a3f69be3 100644 --- a/examples/quick/textureprovider/etcprovider.cpp +++ b/examples/quick/textureprovider/etcprovider.cpp @@ -137,7 +137,7 @@ void EtcTexture::bind() #endif QOpenGLContext *ctx = QOpenGLContext::currentContext(); - Q_ASSERT(ctx != 0); + Q_ASSERT(ctx != nullptr); ctx->functions()->glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_ETC1_RGB8_OES, m_size.width(), m_size.height(), 0, (m_paddedSize.width() * m_paddedSize.height()) >> 1, @@ -181,7 +181,7 @@ public: QQuickTextureFactory *EtcProvider::requestTexture(const QString &id, QSize *size, const QSize &requestedSize) { Q_UNUSED(requestedSize); - QEtcTextureFactory *ret = 0; + QEtcTextureFactory *ret = nullptr; size->setHeight(0); size->setWidth(0); @@ -199,7 +199,7 @@ QQuickTextureFactory *EtcProvider::requestTexture(const QString &id, QSize *size ret = new QEtcTextureFactory; ret->m_data = file.readAll(); if (!ret->m_data.isEmpty()) { - ETCHeader *pETCHeader = NULL; + ETCHeader *pETCHeader = nullptr; pETCHeader = (ETCHeader *)ret->m_data.data(); size->setHeight(getHeight(pETCHeader)); size->setWidth(getWidth(pETCHeader)); @@ -209,7 +209,7 @@ QQuickTextureFactory *EtcProvider::requestTexture(const QString &id, QSize *size } else { delete ret; - ret = 0; + ret = nullptr; } } diff --git a/src/imports/folderlistmodel/fileinfothread.cpp b/src/imports/folderlistmodel/fileinfothread.cpp index 4ef8d02810..5b44ed012f 100644 --- a/src/imports/folderlistmodel/fileinfothread.cpp +++ b/src/imports/folderlistmodel/fileinfothread.cpp @@ -47,7 +47,7 @@ FileInfoThread::FileInfoThread(QObject *parent) : QThread(parent), abort(false), #if QT_CONFIG(filesystemwatcher) - watcher(0), + watcher(nullptr), #endif sortFlags(QDir::Name), needUpdate(true), diff --git a/src/imports/folderlistmodel/plugin.cpp b/src/imports/folderlistmodel/plugin.cpp index e90c8724e0..5e8b41401f 100644 --- a/src/imports/folderlistmodel/plugin.cpp +++ b/src/imports/folderlistmodel/plugin.cpp @@ -58,7 +58,7 @@ class QmlFolderListModelPlugin : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QmlFolderListModelPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QmlFolderListModelPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.folderlistmodel")); diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp index b3c1de6cc9..32c709830a 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp @@ -114,7 +114,7 @@ void QQuickFolderListModelPrivate::updateSorting() { Q_Q(QQuickFolderListModel); - QDir::SortFlags flags = 0; + QDir::SortFlags flags = nullptr; switch (sortField) { case QQuickFolderListModel::Unsorted: diff --git a/src/imports/handlers/plugin.cpp b/src/imports/handlers/plugin.cpp index d26ef2b2d4..026814541e 100644 --- a/src/imports/handlers/plugin.cpp +++ b/src/imports/handlers/plugin.cpp @@ -73,7 +73,7 @@ class QtQuickHandlersPlugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQuickHandlersPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QtQuickHandlersPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("Qt.labs.handlers")); diff --git a/src/imports/layouts/plugin.cpp b/src/imports/layouts/plugin.cpp index fc3938c5d8..25d5bacc90 100644 --- a/src/imports/layouts/plugin.cpp +++ b/src/imports/layouts/plugin.cpp @@ -57,7 +57,7 @@ class QtQuickLayoutsPlugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQuickLayoutsPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) + QtQuickLayoutsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } diff --git a/src/imports/layouts/qquickgridlayoutengine.cpp b/src/imports/layouts/qquickgridlayoutengine.cpp index fe716f0694..6004bb92ca 100644 --- a/src/imports/layouts/qquickgridlayoutengine.cpp +++ b/src/imports/layouts/qquickgridlayoutengine.cpp @@ -55,7 +55,7 @@ Qt::Alignment QQuickGridLayoutEngine::alignment(QQuickItem *quickItem) const { if (QGridLayoutItem *item = findLayoutItem(quickItem)) return item->alignment(); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/imports/layouts/qquicklayout.cpp b/src/imports/layouts/qquicklayout.cpp index 3bfdea5be7..b3a5a2cfc8 100644 --- a/src/imports/layouts/qquicklayout.cpp +++ b/src/imports/layouts/qquicklayout.cpp @@ -114,7 +114,7 @@ QQuickLayoutAttached::QQuickLayoutAttached(QObject *parent) m_isTopMarginSet(false), m_isRightMarginSet(false), m_isBottomMarginSet(false), - m_alignment(0) + m_alignment(nullptr) { } @@ -683,7 +683,7 @@ QQuickLayout *QQuickLayoutAttached::parentLayout() const } else { qmlWarning(parent()) << "Layout must be attached to Item elements"; } - return 0; + return nullptr; } QQuickItem *QQuickLayoutAttached::item() const diff --git a/src/imports/layouts/qquicklinearlayout.cpp b/src/imports/layouts/qquicklinearlayout.cpp index db983e06ba..fa51ef1f2f 100644 --- a/src/imports/layouts/qquicklinearlayout.cpp +++ b/src/imports/layouts/qquicklinearlayout.cpp @@ -653,13 +653,13 @@ void QQuickGridLayout::insertLayoutItems() const auto items = childItems(); for (QQuickItem *child : items) { checkAnchors(child); - QQuickLayoutAttached *info = 0; + QQuickLayoutAttached *info = nullptr; // Will skip all items with effective maximum width/height == 0 if (shouldIgnoreItem(child, info, sizeHints)) continue; - Qt::Alignment alignment = 0; + Qt::Alignment alignment = nullptr; int row = -1; int column = -1; int span[2] = {1,1}; @@ -828,13 +828,13 @@ void QQuickLinearLayout::insertLayoutItems() for (QQuickItem *child : items) { Q_ASSERT(child); checkAnchors(child); - QQuickLayoutAttached *info = 0; + QQuickLayoutAttached *info = nullptr; // Will skip all items with effective maximum width/height == 0 if (shouldIgnoreItem(child, info, sizeHints)) continue; - Qt::Alignment alignment = 0; + Qt::Alignment alignment = nullptr; if (info) alignment = info->alignment(); diff --git a/src/imports/layouts/qquickstacklayout.cpp b/src/imports/layouts/qquickstacklayout.cpp index cf70856e14..0b51d79bef 100644 --- a/src/imports/layouts/qquickstacklayout.cpp +++ b/src/imports/layouts/qquickstacklayout.cpp @@ -213,7 +213,7 @@ QQuickItem *QQuickStackLayout::itemAt(int index) const return item; --index; } - return 0; + return nullptr; } int QQuickStackLayout::itemCount() const @@ -320,7 +320,7 @@ void QQuickStackLayout::rearrange(const QSizeF &newSize) void QQuickStackLayout::collectItemSizeHints(QQuickItem *item, QSizeF *sizeHints) { - QQuickLayoutAttached *info = 0; + QQuickLayoutAttached *info = nullptr; QQuickLayout::effectiveSizeHints_helper(item, sizeHints, &info, true); if (!info) return; diff --git a/src/imports/localstorage/plugin.cpp b/src/imports/localstorage/plugin.cpp index 9a67b9a19b..5148b2f18f 100644 --- a/src/imports/localstorage/plugin.cpp +++ b/src/imports/localstorage/plugin.cpp @@ -220,7 +220,7 @@ QQmlSqlDatabaseData::~QQmlSqlDatabaseData() { } -static ReturnedValue qmlsqldatabase_rows_index(const QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, quint32 index, bool *hasProperty = 0) +static ReturnedValue qmlsqldatabase_rows_index(const QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, quint32 index, bool *hasProperty = nullptr) { Scope scope(v4); @@ -376,10 +376,10 @@ struct TransactionRollback { } void clear() { - db = 0; + db = nullptr; if (inTransactionFlag) *inTransactionFlag = false; - inTransactionFlag = 0; + inTransactionFlag = nullptr; } }; @@ -448,7 +448,7 @@ static ReturnedValue qmlsqldatabase_transaction_shared(const FunctionObject *b, if (!r || r->d()->type != Heap::QQmlSqlDatabaseWrapper::Database) V4THROW_REFERENCE("Not a SQLDatabase object"); - const FunctionObject *callback = argc ? argv[0].as<FunctionObject>() : 0; + const FunctionObject *callback = argc ? argv[0].as<FunctionObject>() : nullptr; if (!callback) V4THROW_SQL(SQLEXCEPTION_UNKNOWN_ERR, QQmlEngine::tr("transaction: missing callback")); @@ -495,7 +495,7 @@ QQmlSqlDatabaseData::QQmlSqlDatabaseData(ExecutionEngine *v4) ScopedObject proto(scope, v4->newObject()); proto->defineDefaultProperty(QStringLiteral("transaction"), qmlsqldatabase_transaction); proto->defineDefaultProperty(QStringLiteral("readTransaction"), qmlsqldatabase_read_transaction); - proto->defineAccessorProperty(QStringLiteral("version"), qmlsqldatabase_version, 0); + proto->defineAccessorProperty(QStringLiteral("version"), qmlsqldatabase_version, nullptr); proto->defineDefaultProperty(QStringLiteral("changeVersion"), qmlsqldatabase_changeVersion); databaseProto = proto; } @@ -508,7 +508,7 @@ QQmlSqlDatabaseData::QQmlSqlDatabaseData(ExecutionEngine *v4) { ScopedObject proto(scope, v4->newObject()); proto->defineDefaultProperty(QStringLiteral("item"), qmlsqldatabase_rows_item); - proto->defineAccessorProperty(QStringLiteral("length"), qmlsqldatabase_rows_length, 0); + proto->defineAccessorProperty(QStringLiteral("length"), qmlsqldatabase_rows_length, nullptr); proto->defineAccessorProperty(QStringLiteral("forwardOnly"), qmlsqldatabase_rows_forwardOnly, qmlsqldatabase_rows_setForwardOnly); rowsProto = proto; @@ -690,7 +690,7 @@ class QQuickLocalStorage : public QObject { Q_OBJECT public: - QQuickLocalStorage(QObject *parent=0) : QObject(parent) + QQuickLocalStorage(QObject *parent=nullptr) : QObject(parent) { } ~QQuickLocalStorage() { @@ -790,7 +790,7 @@ class QQmlLocalStoragePlugin : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QQmlLocalStoragePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) + QQmlLocalStoragePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } diff --git a/src/imports/models/plugin.cpp b/src/imports/models/plugin.cpp index 5933128713..2f8a9713d2 100644 --- a/src/imports/models/plugin.cpp +++ b/src/imports/models/plugin.cpp @@ -77,7 +77,7 @@ class QtQmlModelsPlugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQmlModelsPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QtQmlModelsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQml.Models")); diff --git a/src/imports/particles/plugin.cpp b/src/imports/particles/plugin.cpp index f7a3472403..a04e115976 100644 --- a/src/imports/particles/plugin.cpp +++ b/src/imports/particles/plugin.cpp @@ -56,7 +56,7 @@ class QtQuick2ParticlesPlugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQuick2ParticlesPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QtQuick2ParticlesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Particles")); diff --git a/src/imports/qtquick2/plugin.cpp b/src/imports/qtquick2/plugin.cpp index a5b2c8c67e..516b823856 100644 --- a/src/imports/qtquick2/plugin.cpp +++ b/src/imports/qtquick2/plugin.cpp @@ -56,7 +56,7 @@ class QtQuick2Plugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQuick2Plugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QtQuick2Plugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick")); diff --git a/src/imports/settings/plugin.cpp b/src/imports/settings/plugin.cpp index 70d24c12cd..65de78a2f1 100644 --- a/src/imports/settings/plugin.cpp +++ b/src/imports/settings/plugin.cpp @@ -57,7 +57,7 @@ class QmlSettingsPlugin : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QmlSettingsPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QmlSettingsPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { Q_ASSERT(QByteArray(uri) == QByteArray("Qt.labs.settings")); diff --git a/src/imports/settings/qqmlsettings.cpp b/src/imports/settings/qqmlsettings.cpp index f6040e7a64..2271774643 100644 --- a/src/imports/settings/qqmlsettings.cpp +++ b/src/imports/settings/qqmlsettings.cpp @@ -254,18 +254,15 @@ public: void _q_propertyChanged(); QVariant readProperty(const QMetaProperty &property) const; - QQmlSettings *q_ptr; - int timerId; - bool initialized; + QQmlSettings *q_ptr = nullptr; + int timerId = 0; + bool initialized = false; QString category; mutable QPointer<QSettings> settings; QHash<const char *, QVariant> changedProperties; }; -QQmlSettingsPrivate::QQmlSettingsPrivate() - : q_ptr(0), timerId(0), initialized(false) -{ -} +QQmlSettingsPrivate::QQmlSettingsPrivate() {} QSettings *QQmlSettingsPrivate::instance() const { diff --git a/src/imports/shapes/plugin.cpp b/src/imports/shapes/plugin.cpp index 74731aa35f..f0e66479b6 100644 --- a/src/imports/shapes/plugin.cpp +++ b/src/imports/shapes/plugin.cpp @@ -58,7 +58,7 @@ class QmlShapesPlugin : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QmlShapesPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QmlShapesPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { Q_ASSERT(QByteArray(uri) == QByteArray("QtQuick.Shapes")); diff --git a/src/imports/shapes/qquickshapegenericrenderer.cpp b/src/imports/shapes/qquickshapegenericrenderer.cpp index 8131f02f1a..411252a906 100644 --- a/src/imports/shapes/qquickshapegenericrenderer.cpp +++ b/src/imports/shapes/qquickshapegenericrenderer.cpp @@ -448,14 +448,14 @@ void QQuickShapeGenericRenderer::triangulateStroke(const QPainterPath &path, stroker.setInvScale(inverseScale); if (pen.style() == Qt::SolidLine) { - stroker.process(vp, pen, clip, 0); + stroker.process(vp, pen, clip, nullptr); } else { QDashedStrokeProcessor dashStroker; dashStroker.setInvScale(inverseScale); - dashStroker.process(vp, pen, clip, 0); + dashStroker.process(vp, pen, clip, nullptr); QVectorPath dashStroke(dashStroker.points(), dashStroker.elementCount(), dashStroker.elementTypes(), 0); - stroker.process(dashStroke, pen, clip, 0); + stroker.process(dashStroke, pen, clip, nullptr); } if (!stroker.vertexCount()) { diff --git a/src/imports/shapes/qquickshapenvprrenderer.cpp b/src/imports/shapes/qquickshapenvprrenderer.cpp index 88f367fe70..51af0d8961 100644 --- a/src/imports/shapes/qquickshapenvprrenderer.cpp +++ b/src/imports/shapes/qquickshapenvprrenderer.cpp @@ -986,7 +986,7 @@ void QQuickNvprBlitter::texturedQuad(GLuint textureId, const QSize &size, m_program->enableAttributeArray(0); m_program->enableAttributeArray(1); - f->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), 0); + f->glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), nullptr); f->glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), (const void *) (2 * sizeof(GLfloat))); f->glBindTexture(GL_TEXTURE_2D, textureId); diff --git a/src/imports/shapes/qquickshapesoftwarerenderer.cpp b/src/imports/shapes/qquickshapesoftwarerenderer.cpp index ed13afbc7e..0f5c3604b5 100644 --- a/src/imports/shapes/qquickshapesoftwarerenderer.cpp +++ b/src/imports/shapes/qquickshapesoftwarerenderer.cpp @@ -266,7 +266,7 @@ void QQuickShapeSoftwareRenderNode::render(const RenderState *state) QSGRenderNode::StateFlags QQuickShapeSoftwareRenderNode::changedStates() const { - return 0; + return nullptr; } QSGRenderNode::RenderingFlags QQuickShapeSoftwareRenderNode::flags() const diff --git a/src/imports/sharedimage/plugin.cpp b/src/imports/sharedimage/plugin.cpp index 53e95ef21a..b75e38e303 100644 --- a/src/imports/sharedimage/plugin.cpp +++ b/src/imports/sharedimage/plugin.cpp @@ -106,7 +106,7 @@ class QtQuickSharedImagePlugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQuickSharedImagePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) {} + QtQuickSharedImagePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) {} void registerTypes(const char *uri) override { diff --git a/src/imports/sharedimage/qsharedimageloader.cpp b/src/imports/sharedimage/qsharedimageloader.cpp index ee862b6a77..4672ded376 100644 --- a/src/imports/sharedimage/qsharedimageloader.cpp +++ b/src/imports/sharedimage/qsharedimageloader.cpp @@ -88,9 +88,7 @@ class QSharedImageLoaderPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QSharedImageLoader) public: - QSharedImageLoaderPrivate() - : QObjectPrivate() - {} + QSharedImageLoaderPrivate() {} QImage load(const QString &path, QSharedImageLoader::ImageParameters *params); diff --git a/src/imports/statemachine/plugin.cpp b/src/imports/statemachine/plugin.cpp index 7308df8964..1357743126 100644 --- a/src/imports/statemachine/plugin.cpp +++ b/src/imports/statemachine/plugin.cpp @@ -62,7 +62,7 @@ class QtQmlStateMachinePlugin : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQmlStateMachinePlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QtQmlStateMachinePlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { qmlRegisterType<State>(uri, 1, 0, "State"); diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp index 3c3142cce8..63a969c0e8 100644 --- a/src/imports/statemachine/signaltransition.cpp +++ b/src/imports/statemachine/signaltransition.cpp @@ -163,7 +163,7 @@ void SignalTransition::connectTriggered() QObject *target = senderObject(); QQmlData *ddata = QQmlData::get(this); - QQmlContextData *ctxtdata = ddata ? ddata->outerContext : 0; + QQmlContextData *ctxtdata = ddata ? ddata->outerContext : nullptr; Q_ASSERT(m_bindings.count() == 1); const QV4::CompiledData::Binding *binding = m_bindings.at(0); @@ -178,7 +178,7 @@ void SignalTransition::connectTriggered() QQmlBoundSignalExpression *expression = ctxtdata ? new QQmlBoundSignalExpression(target, signalIndex, - ctxtdata, this, m_compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]) : 0; + ctxtdata, this, m_compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]) : nullptr; if (expression) expression->setNotifyOnValueChanged(false); m_signalExpression = expression; diff --git a/src/imports/statemachine/state.cpp b/src/imports/statemachine/state.cpp index 2467039d01..af76087256 100644 --- a/src/imports/statemachine/state.cpp +++ b/src/imports/statemachine/state.cpp @@ -50,7 +50,7 @@ State::State(QState *parent) void State::componentComplete() { - if (this->machine() == NULL) { + if (this->machine() == nullptr) { static bool once = false; if (!once) { once = true; diff --git a/src/imports/statemachine/statemachine.cpp b/src/imports/statemachine/statemachine.cpp index 7c8dcbc6b6..ca6c59b6ac 100644 --- a/src/imports/statemachine/statemachine.cpp +++ b/src/imports/statemachine/statemachine.cpp @@ -68,7 +68,7 @@ void StateMachine::setRunning(bool running) void StateMachine::componentComplete() { - if (QStateMachine::initialState() == NULL && childMode() == QState::ExclusiveStates) + if (QStateMachine::initialState() == nullptr && childMode() == QState::ExclusiveStates) qmlWarning(this) << "No initial state set for StateMachine"; // Everything is proper setup, now start the state-machine if we got diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index ab84d83ff7..41b5d1715c 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -69,7 +69,7 @@ class QuickTestUtil : public QObject Q_PROPERTY(bool printAvailableFunctions READ printAvailableFunctions NOTIFY printAvailableFunctionsChanged) Q_PROPERTY(int dragThreshold READ dragThreshold NOTIFY dragThresholdChanged) public: - QuickTestUtil(QObject *parent = 0) + QuickTestUtil(QObject *parent = nullptr) :QObject(parent) {} @@ -150,7 +150,7 @@ class QTestQmlModule : public QQmlExtensionPlugin Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QTestQmlModule(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QTestQmlModule(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtTest")); diff --git a/src/imports/window/plugin.cpp b/src/imports/window/plugin.cpp index c4ea9a1d04..4e6eedf326 100644 --- a/src/imports/window/plugin.cpp +++ b/src/imports/window/plugin.cpp @@ -72,7 +72,7 @@ class QtQuick2WindowPlugin : public QQmlExtensionPlugin Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: - QtQuick2WindowPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } + QtQuick2WindowPlugin(QObject *parent = nullptr) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri) override { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtQuick.Window")); diff --git a/src/particles/qquickcustomparticle.cpp b/src/particles/qquickcustomparticle.cpp index e344fea1fa..0e3c656762 100644 --- a/src/particles/qquickcustomparticle.cpp +++ b/src/particles/qquickcustomparticle.cpp @@ -246,7 +246,7 @@ QSGNode *QQuickCustomParticle::updatePaintNode(QSGNode *oldNode, UpdatePaintNode QQuickOpenGLShaderEffectNode *rootNode = static_cast<QQuickOpenGLShaderEffectNode *>(oldNode); if (m_pleaseReset){ delete rootNode;//Automatically deletes children - rootNode = 0; + rootNode = nullptr; m_nodes.clear(); m_pleaseReset = false; m_dirtyProgram = true; @@ -270,7 +270,7 @@ QQuickOpenGLShaderEffectNode *QQuickCustomParticle::prepareNextFrame(QQuickOpenG rootNode = buildCustomNodes(); if (!rootNode) - return 0; + return nullptr; if (m_dirtyProgram) { const bool isES = QOpenGLContext::currentContext()->isOpenGLES(); @@ -316,23 +316,23 @@ QQuickOpenGLShaderEffectNode* QQuickCustomParticle::buildCustomNodes() typedef QHash<int, QQuickOpenGLShaderEffectNode*>::const_iterator NodeHashConstIt; if (!QOpenGLContext::currentContext()) - return 0; + return nullptr; if (m_count * 4 > 0xffff) { // Index data is ushort. qmlInfo(this) << "CustomParticle: Too many particles - maximum 16383 per CustomParticle"; - return 0; + return nullptr; } if (m_count <= 0) { qmlInfo(this) << "CustomParticle: Too few particles"; - return 0; + return nullptr; } if (groups().isEmpty()) - return 0; + return nullptr; - QQuickOpenGLShaderEffectNode *rootNode = 0; + QQuickOpenGLShaderEffectNode *rootNode = nullptr; QQuickOpenGLShaderEffectMaterial *material = new QQuickOpenGLShaderEffectMaterial; m_dirtyProgram = true; diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp index 37bf323f42..d2fb78d72a 100644 --- a/src/particles/qquickimageparticle.cpp +++ b/src/particles/qquickimageparticle.cpp @@ -67,7 +67,7 @@ class ImageMaterialData { public: ImageMaterialData() - : texture(0), colorTable(0) + : texture(nullptr), colorTable(nullptr) {} ~ImageMaterialData(){ @@ -701,7 +701,7 @@ void fillUniformArrayFromImage(float* array, const QImage& img, int size) QQuickImageParticle::QQuickImageParticle(QQuickItem* parent) : QQuickParticlePainter(parent) , m_color_variation(0.0) - , m_material(0) + , m_material(nullptr) , m_alphaVariation(0.0) , m_alpha(1.0) , m_redVariation(0.0) @@ -712,9 +712,9 @@ QQuickImageParticle::QQuickImageParticle(QQuickItem* parent) , m_rotationVelocity(0) , m_rotationVelocityVariation(0) , m_autoRotation(false) - , m_xVector(0) - , m_yVector(0) - , m_spriteEngine(0) + , m_xVector(nullptr) + , m_yVector(nullptr) + , m_spriteEngine(nullptr) , m_spritesInterpolate(true) , m_explicitColor(false) , m_explicitRotation(false) @@ -743,7 +743,7 @@ QQmlListProperty<QQuickSprite> QQuickImageParticle::sprites() void QQuickImageParticle::sceneGraphInvalidated() { m_nodes.clear(); - m_material = 0; + m_material = nullptr; } void QQuickImageParticle::setImage(const QUrl &image) @@ -1011,7 +1011,7 @@ void QQuickImageParticle::resetColor() for (auto groupId : groupIds()) { for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { if (d->colorOwner == this) { - d->colorOwner = 0; + d->colorOwner = nullptr; } } } @@ -1030,7 +1030,7 @@ void QQuickImageParticle::resetRotation() for (auto groupId : groupIds()) { for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { if (d->rotationOwner == this) { - d->rotationOwner = 0; + d->rotationOwner = nullptr; } } } @@ -1047,7 +1047,7 @@ void QQuickImageParticle::resetDeformation() for (auto groupId : groupIds()) { for (QQuickParticleData* d : qAsConst(m_system->groupData[groupId]->data)) { if (d->deformationOwner == this) { - d->deformationOwner = 0; + d->deformationOwner = nullptr; } } } @@ -1055,8 +1055,8 @@ void QQuickImageParticle::resetDeformation() delete m_xVector; if (m_yVector) delete m_yVector; - m_xVector = 0; - m_yVector = 0; + m_xVector = nullptr; + m_yVector = nullptr; } void QQuickImageParticle::reset() @@ -1076,7 +1076,7 @@ void QQuickImageParticle::createEngine() this, SLOT(spriteAdvance(int)), Qt::DirectConnection); m_explicitAnimation = true; } else { - m_spriteEngine = 0; + m_spriteEngine = nullptr; m_explicitAnimation = false; } reset(); @@ -1298,7 +1298,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node) clearShadows(); if (m_material) - m_material = 0; + m_material = nullptr; //Setup material QImage colortable; @@ -1473,12 +1473,12 @@ static inline bool isOpenGL(QSGRenderContext *rc) QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData *) { if (!node && !isOpenGL(QQuickItemPrivate::get(this)->sceneGraphRenderContext())) - return 0; + return nullptr; if (m_pleaseReset){ if (node) delete node; - node = 0; + node = nullptr; m_lastLevel = perfLevel; m_nodes.clear(); @@ -1487,7 +1487,7 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData m_startsIdx.clear(); m_lastIdxStart = 0; - m_material = 0; + m_material = nullptr; m_pleaseReset = false; m_startedImageLoading = 0;//Cancel a part-way build (may still have a pending load) @@ -1509,7 +1509,7 @@ QSGNode *QQuickImageParticle::updatePaintNode(QSGNode *node, UpdatePaintNodeData void QQuickImageParticle::prepareNextFrame(QSGNode **node) { - if (*node == 0){//TODO: Staggered loading (as emitted) + if (*node == nullptr){//TODO: Staggered loading (as emitted) buildParticleNodes(node); if (m_debugMode) { qDebug() << "QQuickImageParticle Feature level: " << perfLevel; @@ -1522,7 +1522,7 @@ void QQuickImageParticle::prepareNextFrame(QSGNode **node) } qDebug() << "Total count: " << count; } - if (*node == 0) + if (*node == nullptr) return; } qint64 timeStamp = m_system->systemSync(this); diff --git a/src/particles/qquickitemparticle.cpp b/src/particles/qquickitemparticle.cpp index 50b66a4d15..412390dffc 100644 --- a/src/particles/qquickitemparticle.cpp +++ b/src/particles/qquickitemparticle.cpp @@ -118,7 +118,7 @@ QT_BEGIN_NAMESPACE */ QQuickItemParticle::QQuickItemParticle(QQuickItem *parent) : - QQuickParticlePainter(parent), m_fade(true), m_lastT(0), m_activeCount(0), m_delegate(0) + QQuickParticlePainter(parent), m_fade(true), m_lastT(0), m_activeCount(0), m_delegate(nullptr) { setFlag(QQuickItem::ItemHasContents); clock = new Clock(this); @@ -195,7 +195,7 @@ void QQuickItemParticle::tick(int time) //remove old item from the particle that is dying to make room for this one if (d->delegate) { m_deletables << d->delegate; - d->delegate = 0; + d->delegate = nullptr; } if (!m_pendingItems.isEmpty()){ d->delegate = m_pendingItems.front(); @@ -289,7 +289,7 @@ void QQuickItemParticle::prepareNextFrame() } if (t >= 1.0f){//Usually happens from load m_deletables << item; - data->delegate = 0; + data->delegate = nullptr; }else{//Fade data->delegate->setVisible(true); if (m_fade){ diff --git a/src/particles/qquickparticleaffector.cpp b/src/particles/qquickparticleaffector.cpp index 30716ecb80..76089c1abd 100644 --- a/src/particles/qquickparticleaffector.cpp +++ b/src/particles/qquickparticleaffector.cpp @@ -131,7 +131,7 @@ QT_BEGIN_NAMESPACE */ QQuickParticleAffector::QQuickParticleAffector(QQuickItem *parent) : QQuickItem(parent), m_needsReset(false), m_ignoresTime(false), m_onceOff(false), m_enabled(true) - , m_system(0), m_updateIntSet(false), m_shape(new QQuickParticleExtruder(this)) + , m_system(nullptr), m_updateIntSet(false), m_shape(new QQuickParticleExtruder(this)) { } diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp index d17c8fc2ba..78409d3a44 100644 --- a/src/particles/qquickparticleemitter.cpp +++ b/src/particles/qquickparticleemitter.cpp @@ -222,9 +222,9 @@ QQuickParticleEmitter::QQuickParticleEmitter(QQuickItem *parent) : , m_particleDuration(1000) , m_particleDurationVariation(0) , m_enabled(true) - , m_system(0) - , m_extruder(0) - , m_defaultExtruder(0) + , m_system(nullptr) + , m_extruder(nullptr) + , m_defaultExtruder(nullptr) , m_velocity(&m_nullVector) , m_acceleration(&m_nullVector) , m_particleSize(16) @@ -349,7 +349,7 @@ void QQuickParticleEmitter::reset() void QQuickParticleEmitter::emitWindow(int timeStamp) { - if (m_system == 0) + if (m_system == nullptr) return; if ((!m_enabled || m_particlesPerSecond <= 0)&& !m_pulseLeft && m_burstQueue.isEmpty()){ m_reset_last = true; diff --git a/src/particles/qquickparticlegroup.cpp b/src/particles/qquickparticlegroup.cpp index 2ee2a1d0a3..a42d2bcb13 100644 --- a/src/particles/qquickparticlegroup.cpp +++ b/src/particles/qquickparticlegroup.cpp @@ -91,7 +91,7 @@ QQuickParticleGroup::QQuickParticleGroup(QObject* parent) : QQuickStochasticState(parent) - , m_system(0) + , m_system(nullptr) { } @@ -107,9 +107,9 @@ QQmlListProperty<QObject> QQuickParticleGroup::particleChildren() { QQuickParticleSystem* system = qobject_cast<QQuickParticleSystem*>(parent()); if (system) - return QQmlListProperty<QObject>(this, 0, &QQuickParticleSystem::statePropertyRedirect, 0, 0, 0); + return QQmlListProperty<QObject>(this, nullptr, &QQuickParticleSystem::statePropertyRedirect, nullptr, nullptr, nullptr); else - return QQmlListProperty<QObject>(this, 0, &delayedRedirect, 0, 0, 0); + return QQmlListProperty<QObject>(this, nullptr, &delayedRedirect, nullptr, nullptr, nullptr); } void QQuickParticleGroup::setSystem(QQuickParticleSystem* arg) diff --git a/src/particles/qquickparticlepainter.cpp b/src/particles/qquickparticlepainter.cpp index 70fc2d59e3..13591be97a 100644 --- a/src/particles/qquickparticlepainter.cpp +++ b/src/particles/qquickparticlepainter.cpp @@ -66,10 +66,10 @@ QT_BEGIN_NAMESPACE */ QQuickParticlePainter::QQuickParticlePainter(QQuickItem *parent) : QQuickItem(parent) - , m_system(0) + , m_system(nullptr) , m_count(0) , m_pleaseReset(true) - , m_window(0) + , m_window(nullptr) , m_groupIdsNeedRecalculation(false) { } diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp index 5e613c484a..612675fec7 100644 --- a/src/particles/qquickparticlesystem.cpp +++ b/src/particles/qquickparticlesystem.cpp @@ -378,7 +378,7 @@ QQuickParticleData* QQuickParticleGroupData::newDatum(bool respectsLimits) return data[idx]; } if (respectsLimits) - return 0; + return nullptr; int oldSize = m_size; setSize(oldSize + 10);//###+1,10%,+10? Choose something non-arbitrarily @@ -418,11 +418,11 @@ QQuickParticleData::QQuickParticleData() : index(0) , systemIndex(-1) , groupId(0) - , colorOwner(0) - , rotationOwner(0) - , deformationOwner(0) - , animationOwner(0) - , v8Datum(0) + , colorOwner(nullptr) + , rotationOwner(nullptr) + , deformationOwner(nullptr) + , animationOwner(nullptr) + , v8Datum(nullptr) { x = 0; y = 0; @@ -455,7 +455,7 @@ QQuickParticleData::QQuickParticleData() color.b = 255; color.a = 255; r = 0; - delegate = 0; + delegate = nullptr; modelIndex = -1; } @@ -477,7 +477,7 @@ QQuickParticleData &QQuickParticleData::operator=(const QQuickParticleData &othe index = other.index; systemIndex = other.systemIndex; // Lazily initialized - v8Datum = 0; + v8Datum = nullptr; return *this; } @@ -564,9 +564,9 @@ void QQuickParticleData::extendLife(float time, QQuickParticleSystem* particleSy QQuickParticleSystem::QQuickParticleSystem(QQuickItem *parent) : QQuickItem(parent), - stateEngine(0), + stateEngine(nullptr), nextFreeGroupId(0), - m_animation(0), + m_animation(nullptr), m_running(true), initialized(0), particleCount(0), @@ -768,9 +768,9 @@ void QQuickParticleSystem::reset() timeInt = 0; //Clear guarded pointers which have been deleted int cleared = 0; - cleared += m_emitters.removeAll(0); - cleared += m_painters.removeAll(0); - cleared += m_affectors.removeAll(0); + cleared += m_emitters.removeAll(nullptr); + cleared += m_painters.removeAll(nullptr); + cleared += m_affectors.removeAll(nullptr); bySysIdx.resize(0); initGroups();//Also clears all logical particles @@ -945,7 +945,7 @@ void QQuickParticleSystem::createEngine() } else { if (stateEngine) delete stateEngine; - stateEngine = 0; + stateEngine = nullptr; } } @@ -993,7 +993,7 @@ QQuickParticleData* QQuickParticleSystem::newDatum(int groupId, bool respectLimi QQuickParticleData* ret = groupData[groupId]->newDatum(respectLimits); if (!ret) { - return 0; + return nullptr; } if (sysIndex == -1) { if (ret->systemIndex == -1) @@ -1056,9 +1056,9 @@ void QQuickParticleSystem::updateCurrentTime( int currentTime ) dt = time - dt; needsReset.clear(); - m_emitters.removeAll(0); - m_painters.removeAll(0); - m_affectors.removeAll(0); + m_emitters.removeAll(nullptr); + m_painters.removeAll(nullptr); + m_affectors.removeAll(nullptr); bool oldClear = m_empty; m_empty = true; diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h index 92dca40419..73351fb99a 100644 --- a/src/particles/qquickparticlesystem_p.h +++ b/src/particles/qquickparticlesystem_p.h @@ -137,10 +137,7 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleGroupData { class FreeList { public: - FreeList() - : firstUnused(UINT_MAX) - , allocated(0) - {} + FreeList() {} void resize(int newSize) { @@ -189,8 +186,8 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleGroupData { private: QV4::BitVector isUnused; - unsigned firstUnused; - int allocated; + unsigned firstUnused = UINT_MAX; + int allocated = 0; }; public: // types @@ -353,7 +350,7 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleSystem : public QQuickItem Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged) public: - explicit QQuickParticleSystem(QQuickItem *parent = 0); + explicit QQuickParticleSystem(QQuickItem *parent = nullptr); ~QQuickParticleSystem(); bool isRunning() const diff --git a/src/particles/qquickspritegoal.cpp b/src/particles/qquickspritegoal.cpp index 2e420a2840..75d6f8bdf6 100644 --- a/src/particles/qquickspritegoal.cpp +++ b/src/particles/qquickspritegoal.cpp @@ -82,7 +82,7 @@ QT_BEGIN_NAMESPACE QQuickSpriteGoalAffector::QQuickSpriteGoalAffector(QQuickItem *parent) : QQuickParticleAffector(parent), m_goalIdx(-1), - m_lastEngine(0), + m_lastEngine(nullptr), m_jump(false), m_systemStates(false), m_notUsingEngine(false) @@ -121,7 +121,7 @@ void QQuickSpriteGoalAffector::setGoalState(const QString &arg) bool QQuickSpriteGoalAffector::affectParticle(QQuickParticleData *d, qreal dt) { Q_UNUSED(dt); - QQuickStochasticEngine *engine = 0; + QQuickStochasticEngine *engine = nullptr; if (!m_systemStates){ //TODO: Affect all engines foreach (QQuickParticlePainter *p, m_system->groupData[d->groupId]->painters) diff --git a/src/particles/qquicktargetdirection.cpp b/src/particles/qquicktargetdirection.cpp index a113b7c04a..5d84f9dc2b 100644 --- a/src/particles/qquicktargetdirection.cpp +++ b/src/particles/qquicktargetdirection.cpp @@ -91,7 +91,7 @@ QQuickTargetDirection::QQuickTargetDirection(QObject *parent) : , m_proportionalMagnitude(false) , m_magnitude(0) , m_magnitudeVariation(0) - , m_targetItem(0) + , m_targetItem(nullptr) { } diff --git a/src/particles/qquicktrailemitter.cpp b/src/particles/qquicktrailemitter.cpp index 16b87f0e51..fde5eab617 100644 --- a/src/particles/qquicktrailemitter.cpp +++ b/src/particles/qquicktrailemitter.cpp @@ -62,7 +62,7 @@ QQuickTrailEmitter::QQuickTrailEmitter(QQuickItem *parent) : , m_emitterXVariation(0) , m_emitterYVariation(0) , m_followCount(0) - , m_emissionExtruder(0) + , m_emissionExtruder(nullptr) , m_defaultEmissionExtruder(new QQuickParticleExtruder(this)) { //TODO: If followed increased their size @@ -150,7 +150,7 @@ void QQuickTrailEmitter::reset() void QQuickTrailEmitter::emitWindow(int timeStamp) { - if (m_system == 0) + if (m_system == nullptr) return; if (!m_enabled && !m_pulseLeft && m_burstQueue.isEmpty()) return; diff --git a/src/particles/qquickturbulence.cpp b/src/particles/qquickturbulence.cpp index f916635358..dc72d884bc 100644 --- a/src/particles/qquickturbulence.cpp +++ b/src/particles/qquickturbulence.cpp @@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE QQuickTurbulenceAffector::QQuickTurbulenceAffector(QQuickItem *parent) : QQuickParticleAffector(parent), - m_strength(10), m_lastT(0), m_gridSize(0), m_field(0), m_vectorField(0), m_inited(false) + m_strength(10), m_lastT(0), m_gridSize(0), m_field(nullptr), m_vectorField(nullptr), m_inited(false) { } diff --git a/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp b/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp index e541810330..5460d617dd 100644 --- a/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp +++ b/src/plugins/qmltooling/packetprotocol/qpacketprotocol.cpp @@ -247,7 +247,7 @@ void QPacketProtocol::readyToRead() disconnect(d->dev, &QIODevice::readyRead, this, &QPacketProtocol::readyToRead); disconnect(d->dev, &QIODevice::aboutToClose, this, &QPacketProtocol::aboutToClose); disconnect(d->dev, &QIODevice::bytesWritten, this, &QPacketProtocol::bytesWritten); - d->dev = 0; + d->dev = nullptr; emit invalidPacket(); return; } diff --git a/src/plugins/qmltooling/packetprotocol/qpacketprotocol_p.h b/src/plugins/qmltooling/packetprotocol/qpacketprotocol_p.h index 7fd722f17f..35edb568aa 100644 --- a/src/plugins/qmltooling/packetprotocol/qpacketprotocol_p.h +++ b/src/plugins/qmltooling/packetprotocol/qpacketprotocol_p.h @@ -63,7 +63,7 @@ class QPacketProtocol : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QPacketProtocol) public: - explicit QPacketProtocol(QIODevice *dev, QObject *parent = 0); + explicit QPacketProtocol(QIODevice *dev, QObject *parent = nullptr); void send(const QByteArray &data); qint64 packetsAvailable() const; diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp index 9315adf4ce..3851cdc71f 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmldebuggerservicefactory.cpp @@ -52,7 +52,7 @@ QQmlDebugService *QQmlDebuggerServiceFactory::create(const QString &key) if (key == QV4DebugServiceImpl::s_key) return new QV4DebugServiceImpl(this); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index 80da09d718..288ad243ce 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE QQmlEngineDebugServiceImpl::QQmlEngineDebugServiceImpl(QObject *parent) : - QQmlEngineDebugService(2, parent), m_watch(new QQmlWatcher(this)), m_statesDelegate(0) + QQmlEngineDebugService(2, parent), m_watch(new QQmlWatcher(this)), m_statesDelegate(nullptr) { connect(m_watch, &QQmlWatcher::propertyChanged, this, &QQmlEngineDebugServiceImpl::propertyChanged); @@ -726,7 +726,7 @@ bool QQmlEngineDebugServiceImpl::resetBinding(int objectId, const QString &prope if (hasValidSignal(object, propertyName)) { QQmlProperty property(object, propertyName, context); - QQmlPropertyPrivate::setSignalExpression(property, 0); + QQmlPropertyPrivate::setSignalExpression(property, nullptr); return true; } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp index cbbbb2ceb7..86571e6cbe 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlwatcher.cpp @@ -61,12 +61,12 @@ public: QObject *object, int debugId, const QMetaProperty &prop, - QQmlWatcher *parent = 0); + QQmlWatcher *parent = nullptr); QQmlWatchProxy(int id, QQmlExpression *exp, int debugId, - QQmlWatcher *parent = 0); + QQmlWatcher *parent = nullptr); public slots: void notifyValueChanged(); // Needs to be a slot because of QQmlPropertyPrivate::connect() @@ -86,7 +86,7 @@ QQmlWatchProxy::QQmlWatchProxy(int id, QQmlExpression *exp, int debugId, QQmlWatcher *parent) -: QObject(parent), m_id(id), m_watch(parent), m_object(0), m_debugId(debugId), m_expr(exp) +: QObject(parent), m_id(id), m_watch(parent), m_object(nullptr), m_debugId(debugId), m_expr(exp) { QObject::connect(m_expr, &QQmlExpression::valueChanged, this, &QQmlWatchProxy::notifyValueChanged); @@ -97,7 +97,7 @@ QQmlWatchProxy::QQmlWatchProxy(int id, int debugId, const QMetaProperty &prop, QQmlWatcher *parent) -: QObject(parent), m_id(id), m_watch(parent), m_object(object), m_debugId(debugId), m_property(prop), m_expr(0) +: QObject(parent), m_id(id), m_watch(parent), m_object(object), m_debugId(debugId), m_property(prop), m_expr(nullptr) { static int refreshIdx = -1; if(refreshIdx == -1) diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp index a538956e8e..c86f3d1803 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp @@ -69,19 +69,19 @@ QV4::Heap::ExecutionContext *QV4DataCollector::findContext(int frame) { QV4::CppStackFrame *f = findFrame(frame); - return f ? f->context()->d() : 0; + return f ? f->context()->d() : nullptr; } QV4::Heap::CallContext *QV4DataCollector::findScope(QV4::Heap::ExecutionContext *ctx, int scope) { if (!ctx) - return 0; + return nullptr; for (; scope > 0 && ctx; --scope) ctx = ctx->outer; return (ctx && ctx->type == QV4::Heap::ExecutionContext::Type_CallContext) ? - static_cast<QV4::Heap::CallContext *>(ctx) : 0; + static_cast<QV4::Heap::CallContext *>(ctx) : nullptr; } QVector<QV4::Heap::ExecutionContext::ContextType> QV4DataCollector::getScopeTypes(int frame) @@ -139,16 +139,16 @@ const QV4::Object *collectProperty(const QV4::ScopedValue &value, QV4::Execution switch (value->type()) { case QV4::Value::Empty_Type: Q_ASSERT(!"empty Value encountered"); - return 0; + return nullptr; case QV4::Value::Undefined_Type: dict.insert(valueKey, QJsonValue::Undefined); - return 0; + return nullptr; case QV4::Value::Null_Type: dict.insert(valueKey, QJsonValue::Null); - return 0; + return nullptr; case QV4::Value::Boolean_Type: dict.insert(valueKey, value->booleanValue()); - return 0; + return nullptr; case QV4::Value::Managed_Type: if (const QV4::String *s = value->as<QV4::String>()) { dict.insert(valueKey, s->toQString()); @@ -176,10 +176,10 @@ const QV4::Object *collectProperty(const QV4::ScopedValue &value, QV4::Execution } else { Q_UNREACHABLE(); } - return 0; + return nullptr; case QV4::Value::Integer_Type: dict.insert(valueKey, value->integerValue()); - return 0; + return nullptr; default: {// double const double val = value->doubleValue(); if (qIsFinite(val)) @@ -190,7 +190,7 @@ const QV4::Object *collectProperty(const QV4::ScopedValue &value, QV4::Execution dict.insert(valueKey, QStringLiteral("-Infinity")); else dict.insert(valueKey, QStringLiteral("Infinity")); - return 0; + return nullptr; } } } diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp index 45817ea38e..a1ed211a55 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugger.cpp @@ -71,8 +71,8 @@ QV4Debugger::QV4Debugger(QV4::ExecutionEngine *engine) , m_haveBreakPoints(false) , m_breakOnThrow(false) , m_returnedValue(engine, QV4::Primitive::undefinedValue()) - , m_gatherSources(0) - , m_runningJob(0) + , m_gatherSources(nullptr) + , m_runningJob(nullptr) , m_collector(engine) { static int debuggerId = qRegisterMetaType<QV4Debugger*>(); @@ -182,7 +182,7 @@ void QV4Debugger::maybeBreakAtInstruction() if (m_gatherSources) { m_gatherSources->run(); delete m_gatherSources; - m_gatherSources = 0; + m_gatherSources = nullptr; } switch (m_stepping) { @@ -295,11 +295,11 @@ bool QV4Debugger::reallyHitTheBreakPoint(const QString &filename, int linenr) if (condition.isEmpty()) return true; - Q_ASSERT(m_runningJob == 0); + Q_ASSERT(m_runningJob == nullptr); EvalJob evilJob(m_engine, condition); m_runningJob = &evilJob; m_runningJob->run(); - m_runningJob = 0; + m_runningJob = nullptr; return evilJob.resultAsBoolean(); } @@ -313,7 +313,7 @@ void QV4Debugger::runInEngine(QV4DebugJob *job) void QV4Debugger::runInEngine_havingLock(QV4DebugJob *job) { Q_ASSERT(job); - Q_ASSERT(m_runningJob == 0); + Q_ASSERT(m_runningJob == nullptr); m_runningJob = job; if (state() == Paused) @@ -321,7 +321,7 @@ void QV4Debugger::runInEngine_havingLock(QV4DebugJob *job) else emit scheduleJob(); m_jobIsRunning.wait(&m_lock); - m_runningJob = 0; + m_runningJob = nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp index 87e75c49b5..71645579c5 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debuggeragent.cpp @@ -56,13 +56,13 @@ QV4Debugger *QV4DebuggerAgent::pausedDebugger() const if (debugger->state() == QV4Debugger::Paused) return debugger; } - return 0; + return nullptr; } bool QV4DebuggerAgent::isRunning() const { // "running" means none of the engines are paused. - return pausedDebugger() == 0; + return pausedDebugger() == nullptr; } void QV4DebuggerAgent::debuggerPaused(QV4Debugger *debugger, QV4Debugger::PauseReason reason) diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp index 6f254c9e28..5b049ab521 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugjob.cpp @@ -208,7 +208,7 @@ void ValueLookupJob::run() QScopedPointer<QObject> scopeObject; QV4::ExecutionEngine *engine = collector->engine(); QV4::Scope scope(engine); - QV4::Heap::ExecutionContext *qmlContext = 0; + QV4::Heap::ExecutionContext *qmlContext = nullptr; if (engine->qmlEngine() && !engine->qmlContext()) { scopeObject.reset(new QObject); qmlContext = QV4::QmlContext::create(engine->currentContext(), diff --git a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp index 99a57be5d6..61209e08cb 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp @@ -98,7 +98,7 @@ public: debugService->send(response); } - debugService = 0; + debugService = nullptr; seq = QJsonValue(); req = QJsonObject(); response = QJsonObject(); diff --git a/src/plugins/qmltooling/qmldbg_inspector/highlight.cpp b/src/plugins/qmltooling/qmldbg_inspector/highlight.cpp index c7307db240..0d6cd45354 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/highlight.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/highlight.cpp @@ -100,7 +100,7 @@ void Highlight::adjust() return; bool success = false; - m_transform = m_item->itemTransform(0, &success); + m_transform = m_item->itemTransform(nullptr, &success); if (!success) m_transform = QTransform(); diff --git a/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp index bc146b176c..1781670cf3 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/inspecttool.cpp @@ -62,8 +62,8 @@ InspectTool::InspectTool(QQuickWindowInspector *inspector, QQuickWindow *view) : m_contentItem(view->contentItem()), m_touchTimestamp(0), m_hoverHighlight(new HoverHighlight(inspector->overlay())), - m_lastItem(0), - m_lastClickedItem(0) + m_lastItem(nullptr), + m_lastClickedItem(nullptr) { //Timer to display selected item's name m_nameDisplayTimer.setSingleShot(true); diff --git a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp index d0d8d62615..fa27adedfd 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qqmlinspectorservice.cpp @@ -49,7 +49,7 @@ class QQmlInspectorServiceImpl : public QQmlInspectorService { Q_OBJECT public: - QQmlInspectorServiceImpl(QObject *parent = 0); + QQmlInspectorServiceImpl(QObject *parent = nullptr); void addWindow(QQuickWindow *window) override; void setParentWindow(QQuickWindow *window, QWindow *parent) override; @@ -72,7 +72,7 @@ private: }; QQmlInspectorServiceImpl::QQmlInspectorServiceImpl(QObject *parent): - QQmlInspectorService(1, parent), m_globalInspector(0) + QQmlInspectorService(1, parent), m_globalInspector(nullptr) { connect(this, &QQmlInspectorServiceImpl::scheduleMessage, this, &QQmlInspectorServiceImpl::messageFromClient, Qt::QueuedConnection); @@ -95,7 +95,7 @@ QmlJSDebugger::GlobalInspector *QQmlInspectorServiceImpl::checkInspector() } } else if (m_globalInspector) { delete m_globalInspector; - m_globalInspector = 0; + m_globalInspector = nullptr; } return m_globalInspector; } @@ -138,7 +138,7 @@ void QQmlInspectorServiceImpl::messageFromClient(const QByteArray &message) QQmlDebugService *QQmlInspectorServiceFactory::create(const QString &key) { - return key == QQmlInspectorServiceImpl::s_key ? new QQmlInspectorServiceImpl(this) : 0; + return key == QQmlInspectorServiceImpl::s_key ? new QQmlInspectorServiceImpl(this) : nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp index d3bd1ac956..09eb6bfc28 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/qquickwindowinspector.cpp @@ -54,14 +54,14 @@ static QQuickItem *itemAt(QQuickItem *item, const QPointF &pos, QQuickItem *overlay) { if (item == overlay) - return 0; + return nullptr; if (!item->isVisible() || item->opacity() == 0.0) - return 0; + return nullptr; if (item->flags() & QQuickItem::ItemClipsChildrenToShape) { if (!QRectF(0, 0, item->width(), item->height()).contains(pos)) - return 0; + return nullptr; } QList<QQuickItem *> children = QQuickItemPrivate::get(item)->paintOrderChildItems(); @@ -73,10 +73,10 @@ static QQuickItem *itemAt(QQuickItem *item, const QPointF &pos, } if (!(item->flags() & QQuickItem::ItemHasContents)) - return 0; + return nullptr; if (!QRectF(0, 0, item->width(), item->height()).contains(pos)) - return 0; + return nullptr; return item; } @@ -111,8 +111,8 @@ QQuickWindowInspector::QQuickWindowInspector(QQuickWindow *quickWindow, QObject QObject(parent), m_overlay(new QQuickItem), m_window(quickWindow), - m_parentWindow(0), - m_tool(0) + m_parentWindow(nullptr), + m_tool(nullptr) { setParentWindow(quickWindow); @@ -199,7 +199,7 @@ void QQuickWindowInspector::setShowAppOnTop(bool appOnTop) bool QQuickWindowInspector::isEnabled() const { - return m_tool != 0; + return m_tool != nullptr; } void QQuickWindowInspector::setEnabled(bool enabled) @@ -208,7 +208,7 @@ void QQuickWindowInspector::setEnabled(bool enabled) m_tool = new InspectTool(this, m_window); } else { delete m_tool; - m_tool = 0; + m_tool = nullptr; } } diff --git a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp index e60644518f..dd0e4c6a04 100644 --- a/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp +++ b/src/plugins/qmltooling/qmldbg_local/qlocalclientconnection.cpp @@ -71,18 +71,13 @@ private: void connectionEstablished(); bool connectToServer(); - bool m_block; + bool m_block = false; QString m_filename; - QLocalSocket *m_socket; - QQmlDebugServer *m_debugServer; + QLocalSocket *m_socket = nullptr; + QQmlDebugServer *m_debugServer = nullptr; }; -QLocalClientConnection::QLocalClientConnection() : - m_block(false), - m_socket(0), - m_debugServer(0) -{ -} +QLocalClientConnection::QLocalClientConnection() { } QLocalClientConnection::~QLocalClientConnection() { @@ -106,7 +101,7 @@ void QLocalClientConnection::disconnect() m_socket->waitForBytesWritten(); m_socket->deleteLater(); - m_socket = 0; + m_socket = nullptr; } bool QLocalClientConnection::setPortRange(int portFrom, int portTo, bool block, @@ -161,7 +156,7 @@ void QLocalClientConnection::connectionEstablished() QQmlDebugServerConnection *QLocalClientConnectionFactory::create(const QString &key) { - return (key == QLatin1String("QLocalClientConnection") ? new QLocalClientConnection : 0); + return (key == QLatin1String("QLocalClientConnection") ? new QLocalClientConnection : nullptr); } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp index bdfed03a40..2bf9210b37 100644 --- a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp +++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservice.cpp @@ -51,7 +51,7 @@ void DebugMessageHandler(QtMsgType type, const QMessageLogContext &ctxt, } QDebugMessageServiceImpl::QDebugMessageServiceImpl(QObject *parent) : - QDebugMessageService(2, parent), oldMsgHandler(0), + QDebugMessageService(2, parent), oldMsgHandler(nullptr), prevState(QQmlDebugService::NotConnected) { // don't execute stateChanged() in parallel diff --git a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.cpp b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.cpp index 860d654128..177ca1fe80 100644 --- a/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.cpp +++ b/src/plugins/qmltooling/qmldbg_messages/qdebugmessageservicefactory.cpp @@ -48,7 +48,7 @@ QQmlDebugService *QDebugMessageServiceFactory::create(const QString &key) if (key == QDebugMessageServiceImpl::s_key) return new QDebugMessageServiceImpl(this); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp index a4b3455eff..93ac875e2d 100644 --- a/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp +++ b/src/plugins/qmltooling/qmldbg_native/qqmlnativedebugconnector.cpp @@ -224,7 +224,7 @@ QQmlDebugService *QQmlNativeDebugConnector::service(const QString &name) const if ((*i)->name() == name) return *i; } - return 0; + return nullptr; } void QQmlNativeDebugConnector::addEngine(QJSEngine *engine) @@ -360,7 +360,7 @@ void QQmlNativeDebugConnector::sendMessages(const QString &name, const QList<QBy QQmlDebugConnector *QQmlNativeDebugConnectorFactory::create(const QString &key) { - return key == QLatin1String("QQmlNativeDebugConnector") ? new QQmlNativeDebugConnector : 0; + return key == QLatin1String("QQmlNativeDebugConnector") ? new QQmlNativeDebugConnector : nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp index ba33de9714..718975275a 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservice.cpp @@ -229,7 +229,7 @@ private: QV4::ExecutionEngine *m_engine; QQmlNativeDebugServiceImpl *m_service; - QV4::CppStackFrame *m_currentFrame = 0; + QV4::CppStackFrame *m_currentFrame = nullptr; Speed m_stepping; bool m_pauseRequested; bool m_runningJob; @@ -457,7 +457,7 @@ void Collector::collect(QJsonArray *out, const QString &parentIName, const QStri void NativeDebugger::handleVariables(QJsonObject *response, const QJsonObject &arguments) { TRACE_PROTOCOL("Build variables"); - QV4::CppStackFrame *frame = 0; + QV4::CppStackFrame *frame = nullptr; decodeFrame(arguments.value(QLatin1String("context")).toString(), &frame); if (!frame) { setError(response, QStringLiteral("No stack frame passed")); @@ -500,7 +500,7 @@ void NativeDebugger::handleVariables(QJsonObject *response, const QJsonObject &a void NativeDebugger::handleExpressions(QJsonObject *response, const QJsonObject &arguments) { TRACE_PROTOCOL("Evaluate expressions"); - QV4::CppStackFrame *frame = 0; + QV4::CppStackFrame *frame = nullptr; decodeFrame(arguments.value(QLatin1String("context")).toString(), &frame); if (!frame) { setError(response, QStringLiteral("No stack frame passed")); diff --git a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp index 1841c82d5d..c0b74c74ff 100644 --- a/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp +++ b/src/plugins/qmltooling/qmldbg_nativedebugger/qqmlnativedebugservicefactory.cpp @@ -48,7 +48,7 @@ QQmlDebugService *QQmlNativeDebugServiceFactory::create(const QString &key) if (key == QQmlNativeDebugServiceImpl::s_key) return new QQmlNativeDebugServiceImpl(this); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp index 4c798e0131..92e93a053a 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservice.cpp @@ -242,7 +242,7 @@ void QQmlProfilerServiceImpl::startProfiling(QJSEngine *engine, quint64 features d << m_timer.nsecsElapsed() << static_cast<qint32>(Event) << static_cast<qint32>(StartTrace); bool startedAny = false; - if (engine != 0) { + if (engine != nullptr) { const auto range = qAsConst(m_engineProfilers).equal_range(engine); for (auto it = range.first; it != range.second; ++it) { QQmlAbstractProfilerAdapter *profiler = *it; @@ -297,7 +297,7 @@ void QQmlProfilerServiceImpl::stopProfiling(QJSEngine *engine) i != m_engineProfilers.end(); ++i) { if (i.value()->isRunning()) { m_startTimes.insert(-1, i.value()); - if (engine == 0 || i.key() == engine) { + if (engine == nullptr || i.key() == engine) { stopping << i.value(); } else { reporting << i.value(); diff --git a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservicefactory.cpp b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservicefactory.cpp index 0cd3e0b4ab..81a1a35d18 100644 --- a/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservicefactory.cpp +++ b/src/plugins/qmltooling/qmldbg_profiler/qqmlprofilerservicefactory.cpp @@ -51,7 +51,7 @@ QQmlDebugService *QQmlProfilerServiceFactory::create(const QString &key) if (key == QQmlEngineControlServiceImpl::s_key) return new QQmlEngineControlServiceImpl(this); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapterfactory.cpp b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapterfactory.cpp index f38307b1f7..66addee2e8 100644 --- a/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapterfactory.cpp +++ b/src/plugins/qmltooling/qmldbg_quickprofiler/qquickprofileradapterfactory.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE QQmlAbstractProfilerAdapter *QQuickProfilerAdapterFactory::create(const QString &key) { if (key != QLatin1String("QQuickProfilerAdapter")) - return 0; + return nullptr; return new QQuickProfilerAdapter(this); } diff --git a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp index f87ade568b..1814e28b83 100644 --- a/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp +++ b/src/plugins/qmltooling/qmldbg_server/qqmldebugserver.cpp @@ -88,7 +88,7 @@ class QQmlDebugServerImpl; class QQmlDebugServerThread : public QThread { public: - QQmlDebugServerThread() : m_server(0), m_portFrom(-1), m_portTo(-1) {} + QQmlDebugServerThread() : m_server(nullptr), m_portFrom(-1), m_portTo(-1) {} void setServer(QQmlDebugServerImpl *server) { @@ -228,7 +228,7 @@ void QQmlDebugServerImpl::cleanup() void QQmlDebugServerThread::run() { - Q_ASSERT_X(m_server != 0, Q_FUNC_INFO, "There should always be a debug server available here."); + Q_ASSERT_X(m_server != nullptr, Q_FUNC_INFO, "There should always be a debug server available here."); QQmlDebugServerConnection *connection = loadQQmlDebugServerConnection(m_pluginName); if (connection) { { @@ -274,7 +274,7 @@ static void cleanupOnShutdown() } QQmlDebugServerImpl::QQmlDebugServerImpl() : - m_connection(0), + m_connection(nullptr), m_gotHello(false), m_blockingMode(false), m_clientSupportsMultiPackets(false) @@ -570,7 +570,7 @@ void QQmlDebugServerImpl::removeThread() QThread *parentThread = m_thread.thread(); delete m_connection; - m_connection = 0; + m_connection = nullptr; // Move it back to the parent thread so that we can potentially restart it on a new thread. moveToThread(parentThread); @@ -755,13 +755,13 @@ void QQmlDebugServerImpl::invalidPacket() m_connection->disconnect(); // protocol might still be processing packages at this point m_protocol->deleteLater(); - m_protocol = 0; + m_protocol = nullptr; } QQmlDebugConnector *QQmlDebugServerFactory::create(const QString &key) { // Cannot parent it to this because it gets moved to another thread - return (key == QLatin1String("QQmlDebugServer") ? new QQmlDebugServerImpl : 0); + return (key == QLatin1String("QQmlDebugServer") ? new QQmlDebugServerImpl : nullptr); } QT_END_NAMESPACE diff --git a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp index c2aafda863..32ce820ea8 100644 --- a/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp +++ b/src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp @@ -70,24 +70,16 @@ private: void newConnection(); bool listen(); - int m_portFrom; - int m_portTo; - bool m_block; + int m_portFrom = 0; + int m_portTo = 0; + bool m_block = false; QString m_hostaddress; - QTcpSocket *m_socket; - QTcpServer *m_tcpServer; - QQmlDebugServer *m_debugServer; + QTcpSocket *m_socket = nullptr; + QTcpServer *m_tcpServer = nullptr; + QQmlDebugServer *m_debugServer = nullptr; }; -QTcpServerConnection::QTcpServerConnection() : - m_portFrom(0), - m_portTo(0), - m_block(false), - m_socket(0), - m_tcpServer(0), - m_debugServer(0) -{ -} +QTcpServerConnection::QTcpServerConnection() {} QTcpServerConnection::~QTcpServerConnection() { @@ -116,7 +108,7 @@ void QTcpServerConnection::disconnect() } m_socket->deleteLater(); - m_socket = 0; + m_socket = nullptr; } bool QTcpServerConnection::setPortRange(int portFrom, int portTo, bool block, @@ -199,7 +191,7 @@ void QTcpServerConnection::newConnection() QQmlDebugServerConnection *QTcpServerConnectionFactory::create(const QString &key) { - return (key == QLatin1String("QTcpServerConnection") ? new QTcpServerConnection : 0); + return (key == QLatin1String("QTcpServerConnection") ? new QTcpServerConnection : nullptr); } QT_END_NAMESPACE diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index b726d2fc43..3f33e7e81b 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -258,7 +258,7 @@ int QQmlAnimationTimer::closestPauseAnimationTimeToFinish() QAbstractAnimationJob::QAbstractAnimationJob() : m_loopCount(1) - , m_group(0) + , m_group(nullptr) , m_direction(QAbstractAnimationJob::Forward) , m_state(QAbstractAnimationJob::Stopped) , m_totalCurrentTime(0) @@ -266,9 +266,9 @@ QAbstractAnimationJob::QAbstractAnimationJob() , m_currentLoop(0) , m_uncontrolledFinishTime(-1) , m_currentLoopStartTime(0) - , m_nextSibling(0) - , m_previousSibling(0) - , m_wasDeleted(0) + , m_nextSibling(nullptr) + , m_previousSibling(nullptr) + , m_wasDeleted(nullptr) , m_hasRegisteredTimer(false) , m_isPause(false) , m_isGroup(false) diff --git a/src/qml/animations/qanimationgroupjob.cpp b/src/qml/animations/qanimationgroupjob.cpp index ea6d87952a..344791fd83 100644 --- a/src/qml/animations/qanimationgroupjob.cpp +++ b/src/qml/animations/qanimationgroupjob.cpp @@ -42,7 +42,7 @@ QT_BEGIN_NAMESPACE QAnimationGroupJob::QAnimationGroupJob() - : QAbstractAnimationJob(), m_firstChild(0), m_lastChild(0) + : QAbstractAnimationJob(), m_firstChild(nullptr), m_lastChild(nullptr) { m_isGroup = true; } @@ -111,25 +111,25 @@ void QAnimationGroupJob::removeAnimation(QAbstractAnimationJob *animation) else m_lastChild = prev; - animation->m_previousSibling = 0; - animation->m_nextSibling = 0; + animation->m_previousSibling = nullptr; + animation->m_nextSibling = nullptr; - animation->m_group = 0; + animation->m_group = nullptr; animationRemoved(animation, prev, next); } void QAnimationGroupJob::clear() { QAbstractAnimationJob *child = firstChild(); - QAbstractAnimationJob *nextSibling = 0; - while (child != 0) { - child->m_group = 0; + QAbstractAnimationJob *nextSibling = nullptr; + while (child != nullptr) { + child->m_group = nullptr; nextSibling = child->nextSibling(); delete child; child = nextSibling; } - m_firstChild = 0; - m_lastChild = 0; + m_firstChild = nullptr; + m_lastChild = nullptr; } void QAnimationGroupJob::resetUncontrolledAnimationsFinishTime() diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h index 148cb0c098..44250079c7 100644 --- a/src/qml/animations/qanimationgroupjob_p.h +++ b/src/qml/animations/qanimationgroupjob_p.h @@ -92,8 +92,8 @@ protected: private: //definition - QAbstractAnimationJob *m_firstChild; - QAbstractAnimationJob *m_lastChild; + QAbstractAnimationJob *m_firstChild = nullptr; + QAbstractAnimationJob *m_lastChild = nullptr; }; QT_END_NAMESPACE diff --git a/src/qml/animations/qcontinuinganimationgroupjob.cpp b/src/qml/animations/qcontinuinganimationgroupjob.cpp index 02dcaf1313..10096bf19c 100644 --- a/src/qml/animations/qcontinuinganimationgroupjob.cpp +++ b/src/qml/animations/qcontinuinganimationgroupjob.cpp @@ -43,7 +43,6 @@ QT_BEGIN_NAMESPACE QContinuingAnimationGroupJob::QContinuingAnimationGroupJob() - : QAnimationGroupJob() { } diff --git a/src/qml/animations/qparallelanimationgroupjob_p.h b/src/qml/animations/qparallelanimationgroupjob_p.h index 2d48686335..0265fe3274 100644 --- a/src/qml/animations/qparallelanimationgroupjob_p.h +++ b/src/qml/animations/qparallelanimationgroupjob_p.h @@ -78,8 +78,8 @@ private: void applyGroupState(QAbstractAnimationJob *animation); //state - int m_previousLoop; - int m_previousCurrentTime; + int m_previousLoop = 0; + int m_previousCurrentTime = 0; }; QT_END_NAMESPACE diff --git a/src/qml/animations/qpauseanimationjob.cpp b/src/qml/animations/qpauseanimationjob.cpp index 27175580dc..0652ed578b 100644 --- a/src/qml/animations/qpauseanimationjob.cpp +++ b/src/qml/animations/qpauseanimationjob.cpp @@ -42,8 +42,7 @@ QT_BEGIN_NAMESPACE QPauseAnimationJob::QPauseAnimationJob(int duration) - : QAbstractAnimationJob() - , m_duration(duration) + : m_duration(duration) { m_isPause = true; } diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index 25d31e4042..22e20d9268 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE QSequentialAnimationGroupJob::QSequentialAnimationGroupJob() : QAnimationGroupJob() - , m_currentAnimation(0) + , m_currentAnimation(nullptr) , m_previousLoop(0) { } @@ -87,7 +87,7 @@ QSequentialAnimationGroupJob::AnimationIndex QSequentialAnimationGroupJob::index Q_ASSERT(firstChild()); AnimationIndex ret; - QAbstractAnimationJob *anim = 0; + QAbstractAnimationJob *anim = nullptr; int duration = 0; for (anim = firstChild(); anim; anim = anim->nextSibling()) { @@ -283,7 +283,7 @@ void QSequentialAnimationGroupJob::setCurrentAnimation(QAbstractAnimationJob *an { if (!anim) { Q_ASSERT(!firstChild()); - m_currentAnimation = 0; + m_currentAnimation = nullptr; return; } @@ -364,7 +364,7 @@ void QSequentialAnimationGroupJob::uncontrolledAnimationFinished(QAbstractAnimat void QSequentialAnimationGroupJob::animationInserted(QAbstractAnimationJob *anim) { - if (m_currentAnimation == 0) + if (m_currentAnimation == nullptr) setCurrentAnimation(firstChild()); // initialize the current animation if (m_currentAnimation == anim->nextSibling() @@ -393,7 +393,7 @@ void QSequentialAnimationGroupJob::animationRemoved(QAbstractAnimationJob *anim, else if (prev) setCurrentAnimation(prev); else// case all animations were removed - setCurrentAnimation(0); + setCurrentAnimation(nullptr); } // duration of the previous animations up to the current animation diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h index 760445c8c6..13f9806be1 100644 --- a/src/qml/animations/qsequentialanimationgroupjob_p.h +++ b/src/qml/animations/qsequentialanimationgroupjob_p.h @@ -79,12 +79,12 @@ protected: private: struct AnimationIndex { - AnimationIndex() : afterCurrent(false), timeOffset(0), animation(0) {} + AnimationIndex() {} // AnimationIndex points to the animation at timeOffset, skipping 0 duration animations. // Note that the index semantic is slightly different depending on the direction. - bool afterCurrent; //whether animation is before or after m_currentAnimation //TODO: make enum Before/After/Same - int timeOffset; // time offset when the animation at index starts. - QAbstractAnimationJob *animation; //points to the animation at timeOffset + bool afterCurrent = false; //whether animation is before or after m_currentAnimation //TODO: make enum Before/After/Same + int timeOffset = 0; // time offset when the animation at index starts. + QAbstractAnimationJob *animation = nullptr; //points to the animation at timeOffset }; int animationActualTotalDuration(QAbstractAnimationJob *anim) const; @@ -105,8 +105,8 @@ private: void advanceForwards(const AnimationIndex &newAnimationIndex); //state - QAbstractAnimationJob *m_currentAnimation; - int m_previousLoop; + QAbstractAnimationJob *m_currentAnimation = nullptr; + int m_previousLoop = 0; }; QT_END_NAMESPACE diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 6c8ca4bbfc..237cd9bf3b 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -93,7 +93,7 @@ void Object::init(QQmlJS::MemoryPool *pool, int typeNameIndex, int idIndex, cons bindings = pool->New<PoolList<Binding> >(); functions = pool->New<PoolList<Function> >(); functionsAndExpressions = pool->New<PoolList<CompiledFunctionOrExpression> >(); - declarationsOverride = 0; + declarationsOverride = nullptr; } QString Object::sanityCheckFunctionNames(const QSet<QString> &illegalNames, QQmlJS::AST::SourceLocation *errorLocation) @@ -233,7 +233,7 @@ Binding *Object::findBinding(quint32 nameIndex) const for (Binding *b = bindings->first; b; b = b->next) if (b->propertyNameIndex == nameIndex) return b; - return 0; + return nullptr; } void Object::insertSorted(Binding *b) @@ -275,7 +275,7 @@ void Document::removeScriptPragmas(QString &script) const QLatin1String pragma("pragma"); const QLatin1String library("library"); - QQmlJS::Lexer l(0); + QQmlJS::Lexer l(nullptr); l.setCode(script, 0); int token = l.lex(); @@ -317,7 +317,7 @@ void Document::removeScriptPragmas(QString &script) Document::Document(bool debugMode) : jsModule(debugMode) - , program(0) + , program(nullptr) , jsGenerator(&jsModule) { } @@ -363,16 +363,16 @@ void ScriptDirectivesCollector::importModule(const QString &uri, const QString & IRBuilder::IRBuilder(const QSet<QString> &illegalNames) : illegalNames(illegalNames) - , _object(0) - , _propertyDeclaration(0) - , pool(0) - , jsGenerator(0) + , _object(nullptr) + , _propertyDeclaration(nullptr) + , pool(nullptr) + , jsGenerator(nullptr) { } bool IRBuilder::generateFromQml(const QString &code, const QString &url, Document *output) { - QQmlJS::AST::UiProgram *program = 0; + QQmlJS::AST::UiProgram *program = nullptr; { QQmlJS::Lexer lexer(&output->jsParserEngine); lexer.setCode(code, /*line = */ 1); @@ -479,7 +479,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiObjectDefinition *node) appendBinding(nameLocation, nameLocation, emptyStringIndex, idx); } else { int idx = 0; - if (!defineQMLObject(&idx, /*qualfied type name id*/0, node->qualifiedTypeNameId->firstSourceLocation(), node->initializer, /*declarations should go here*/_object)) + if (!defineQMLObject(&idx, /*qualfied type name id*/nullptr, node->qualifiedTypeNameId->firstSourceLocation(), node->initializer, /*declarations should go here*/_object)) return false; appendBinding(node->qualifiedTypeNameId, idx); } @@ -504,7 +504,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiScriptBinding *node) bool IRBuilder::visit(QQmlJS::AST::UiArrayBinding *node) { const QQmlJS::AST::SourceLocation qualifiedNameLocation = node->qualifiedId->identifierToken; - Object *object = 0; + Object *object = nullptr; QQmlJS::AST::UiQualifiedId *name = node->qualifiedId; if (!resolveQualifiedId(&name, &object)) return false; @@ -513,7 +513,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiArrayBinding *node) const int propertyNameIndex = registerString(name->name.toString()); - if (bindingsTarget()->findBinding(propertyNameIndex) != 0) { + if (bindingsTarget()->findBinding(propertyNameIndex) != nullptr) { recordError(name->identifierToken, tr("Property value set multiple times")); return false; } @@ -588,7 +588,7 @@ bool IRBuilder::defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qu _object->declarationsOverride = declarationsOverride; // A new object is also a boundary for property declarations. - Property *declaration = 0; + Property *declaration = nullptr; qSwap(_propertyDeclaration, declaration); accept(initializer); @@ -831,7 +831,7 @@ bool IRBuilder::visit(QQmlJS::AST::UiPublicMember *node) return false; } - const TypeNameToType *type = 0; + const TypeNameToType *type = nullptr; for (int typeIndex = 0; typeIndex < propTypeNameToTypesCount; ++typeIndex) { const TypeNameToType *t = propTypeNameToTypes + typeIndex; if (memberType == QLatin1String(t->name, static_cast<int>(t->nameLength))) { @@ -1219,7 +1219,7 @@ void IRBuilder::tryGeneratingTranslationBinding(const QStringRef &base, AST::Arg void IRBuilder::appendBinding(QQmlJS::AST::UiQualifiedId *name, QQmlJS::AST::Statement *value) { const QQmlJS::AST::SourceLocation qualifiedNameLocation = name->identifierToken; - Object *object = 0; + Object *object = nullptr; if (!resolveQualifiedId(&name, &object)) return; if (_object == object && name->name == QLatin1String("id")) { @@ -1234,7 +1234,7 @@ void IRBuilder::appendBinding(QQmlJS::AST::UiQualifiedId *name, QQmlJS::AST::Sta void IRBuilder::appendBinding(QQmlJS::AST::UiQualifiedId *name, int objectIndex, bool isOnAssignment) { const QQmlJS::AST::SourceLocation qualifiedNameLocation = name->identifierToken; - Object *object = 0; + Object *object = nullptr; if (!resolveQualifiedId(&name, &object, isOnAssignment)) return; qSwap(_object, object); @@ -1385,7 +1385,7 @@ bool IRBuilder::setId(const QQmlJS::AST::SourceLocation &idLocation, QQmlJS::AST if (QQmlJS::AST::ExpressionStatement *stmt = QQmlJS::AST::cast<QQmlJS::AST::ExpressionStatement *>(node)) { if (QQmlJS::AST::StringLiteral *lit = QQmlJS::AST::cast<QQmlJS::AST::StringLiteral *>(stmt->expression)) { str = lit->value; - node = 0; + node = nullptr; } else node = stmt->expression; } @@ -1456,9 +1456,9 @@ bool IRBuilder::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, O if (binding) { if (isAttachedProperty) { if (!binding->isAttachedProperty()) - binding = 0; + binding = nullptr; } else if (!binding->isGroupProperty()) { - binding = 0; + binding = nullptr; } } if (!binding) { @@ -1480,7 +1480,7 @@ bool IRBuilder::resolveQualifiedId(QQmlJS::AST::UiQualifiedId **nameToResolve, O binding->type = QV4::CompiledData::Binding::Type_GroupProperty; int objIndex = 0; - if (!defineQMLObject(&objIndex, 0, QQmlJS::AST::SourceLocation(), 0, 0)) + if (!defineQMLObject(&objIndex, nullptr, QQmlJS::AST::SourceLocation(), nullptr, nullptr)) return false; binding->value.objectIndex = objIndex; @@ -1582,7 +1582,7 @@ QV4::CompiledData::Unit *QmlUnitGenerator::generate(Document &output, const QV4: memset(data + unitSize, 0, totalSize - unitSize); if (jsUnit != compilationUnit->data) free(jsUnit); - jsUnit = 0; + jsUnit = nullptr; QV4::CompiledData::Unit *qmlUnit = reinterpret_cast<QV4::CompiledData::Unit *>(data); qmlUnit->unitSize = totalSize; @@ -1782,8 +1782,8 @@ JSCodeGen::JSCodeGen(const QString &sourceCode, QV4::Compiler::JSUnitGenerator * , imports(imports) , stringPool(stringPool) , _disableAcceleratedLookups(false) - , _contextObject(0) - , _scopeObject(0) + , _contextObject(nullptr) + , _scopeObject(nullptr) , _qmlContextSlot(-1) , _importedScriptsSlot(-1) , m_globalNames(globalNames) @@ -1796,7 +1796,7 @@ void JSCodeGen::beginContextScope(const JSCodeGen::ObjectIdMapping &objectIds, Q { _idObjects = objectIds; _contextObject = contextObject; - _scopeObject = 0; + _scopeObject = nullptr; } void JSCodeGen::beginObjectScope(QQmlPropertyCache *scopeObject) @@ -1809,7 +1809,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil QVector<int> runtimeFunctionIndices(functions.size()); QV4::Compiler::ScanFunctions scan(this, sourceCode, QV4::Compiler::GlobalCode); - scan.enterEnvironment(0, QV4::Compiler::QmlBinding); + scan.enterEnvironment(nullptr, QV4::Compiler::QmlBinding); scan.enterQmlScope(qmlRoot, QStringLiteral("context scope")); for (const CompiledFunctionOrExpression &f : functions) { Q_ASSERT(f.node != qmlRoot); @@ -1826,7 +1826,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil scan.leaveEnvironment(); scan.leaveEnvironment(); - _context = 0; + _context = nullptr; for (int i = 0; i < functions.count(); ++i) { const CompiledFunctionOrExpression &qmlFunction = functions.at(i); @@ -1845,7 +1845,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil QQmlJS::AST::SourceElements *body; if (function) - body = function->body ? function->body->elements : 0; + body = function->body ? function->body->elements : nullptr; else { // Synthesize source elements. QQmlJS::MemoryPool *pool = jsEngine->pool(); @@ -1863,7 +1863,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil _disableAcceleratedLookups = qmlFunction.disableAcceleratedLookups; int idx = defineFunction(name, node, - function ? function->formals : 0, + function ? function->formals : nullptr, body); runtimeFunctionIndices[i] = idx; } @@ -1889,14 +1889,14 @@ int JSCodeGen::defineFunction(const QString &name, AST::Node *ast, AST::FormalPa #ifndef V4_BOOTSTRAP QQmlPropertyData *JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name) { - QQmlPropertyData *pd = cache->property(name, /*object*/0, /*context*/0); + QQmlPropertyData *pd = cache->property(name, /*object*/nullptr, /*context*/nullptr); // Q_INVOKABLEs can't be FINAL, so we have to look them up at run-time if (!pd || pd->isFunction()) - return 0; + return nullptr; if (!cache->isAllowedInRevision(pd)) - return 0; + return nullptr; return pd; } @@ -2273,7 +2273,7 @@ QQmlPropertyData *PropertyResolver::property(const QString &name, bool *notInRev { if (notInRevision) *notInRevision = false; - QQmlPropertyData *d = cache->property(name, 0, 0); + QQmlPropertyData *d = cache->property(name, nullptr, nullptr); // Find the first property while (d && d->isFunction()) @@ -2281,7 +2281,7 @@ QQmlPropertyData *PropertyResolver::property(const QString &name, bool *notInRev if (check != IgnoreRevision && d && !cache->isAllowedInRevision(d)) { if (notInRevision) *notInRevision = true; - return 0; + return nullptr; } else { return d; } @@ -2292,7 +2292,7 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis { if (notInRevision) *notInRevision = false; - QQmlPropertyData *d = cache->property(name, 0, 0); + QQmlPropertyData *d = cache->property(name, nullptr, nullptr); if (notInRevision) *notInRevision = false; while (d && !(d->isFunction())) @@ -2300,7 +2300,7 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis if (d && !cache->isAllowedInRevision(d)) { if (notInRevision) *notInRevision = true; - return 0; + return nullptr; } else if (d && d->isSignal()) { return d; } @@ -2313,7 +2313,7 @@ QQmlPropertyData *PropertyResolver::signal(const QString &name, bool *notInRevis return cache->signal(d->notifyIndex()); } - return 0; + return nullptr; } IRLoader::IRLoader(const QV4::CompiledData::Unit *qmlData, QmlIR::Document *output) @@ -2450,7 +2450,7 @@ QmlIR::Object *IRLoader::loadObject(const QV4::CompiledData::Object *serializedO f->location = compiledFunction->location; f->nameIndex = compiledFunction->nameIndex; - QQmlJS::AST::FormalParameterList *paramList = 0; + QQmlJS::AST::FormalParameterList *paramList = nullptr; const quint32_le *formalNameIdx = compiledFunction->formalsTable(); for (uint i = 0; i < compiledFunction->nFormals; ++i, ++formalNameIdx) { const QString formal = unit->stringAt(*formalNameIdx); @@ -2466,7 +2466,7 @@ QmlIR::Object *IRLoader::loadObject(const QV4::CompiledData::Object *serializedO paramList = paramList->finish(); const QString name = unit->stringAt(compiledFunction->nameIndex); - f->functionDeclaration = new(pool) QQmlJS::AST::FunctionDeclaration(jsParserEngine->newStringRef(name), paramList, /*body*/0); + f->functionDeclaration = new(pool) QQmlJS::AST::FunctionDeclaration(jsParserEngine->newStringRef(name), paramList, /*body*/nullptr); f->formals.allocate(pool, int(compiledFunction->nFormals)); formalNameIdx = compiledFunction->formalsTable(); diff --git a/src/qml/compiler/qqmlirbuilder_p.h b/src/qml/compiler/qqmlirbuilder_p.h index f8f8649fc7..7f2cf40611 100644 --- a/src/qml/compiler/qqmlirbuilder_p.h +++ b/src/qml/compiler/qqmlirbuilder_p.h @@ -80,17 +80,16 @@ template <typename T> struct PoolList { PoolList() - : first(0) - , last(0) - , count(0) + : first(nullptr) + , last(nullptr) {} T *first; T *last; - int count; + int count = 0; int append(T *item) { - item->next = 0; + item->next = nullptr; if (last) last->next = item; else @@ -110,7 +109,7 @@ struct PoolList template <typename Sortable, typename Base, Sortable Base::*sortMember> T *findSortedInsertionPoint(T *item) const { - T *insertPos = 0; + T *insertPos = nullptr; for (T *it = first; it; it = it->next) { if (!(it->*sortMember <= item->*sortMember)) @@ -205,11 +204,11 @@ class FixedPoolArray { T *data; public: - int count; + int count = 0; FixedPoolArray() - : data(0) - , count(0) + : data(nullptr) + {} void allocate(QQmlJS::MemoryPool *pool, int size) @@ -343,21 +342,16 @@ struct Function struct Q_QML_PRIVATE_EXPORT CompiledFunctionOrExpression { CompiledFunctionOrExpression() - : node(0) - , nameIndex(0) - , disableAcceleratedLookups(false) - , next(0) + {} CompiledFunctionOrExpression(QQmlJS::AST::Node *n) : node(n) - , nameIndex(0) - , disableAcceleratedLookups(false) - , next(0) + {} - QQmlJS::AST::Node *node; // FunctionDeclaration, Statement or Expression - quint32 nameIndex; - bool disableAcceleratedLookups; - CompiledFunctionOrExpression *next; + QQmlJS::AST::Node *node = nullptr; // FunctionDeclaration, Statement or Expression + quint32 nameIndex = 0; + bool disableAcceleratedLookups = false; + CompiledFunctionOrExpression *next = nullptr; }; struct Q_QML_PRIVATE_EXPORT Object @@ -514,8 +508,8 @@ public: void accept(QQmlJS::AST::Node *node); // returns index in _objects - bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, Object *declarationsOverride = 0); - bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiObjectDefinition *node, Object *declarationsOverride = 0) + bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiQualifiedId *qualifiedTypeNameId, const QQmlJS::AST::SourceLocation &location, QQmlJS::AST::UiObjectInitializer *initializer, Object *declarationsOverride = nullptr); + bool defineQMLObject(int *objectIndex, QQmlJS::AST::UiObjectDefinition *node, Object *declarationsOverride = nullptr) { return defineQMLObject(objectIndex, node->qualifiedTypeNameId, node->qualifiedTypeNameId->firstSourceLocation(), node->initializer, declarationsOverride); } static QString asString(QQmlJS::AST::UiQualifiedId *node); @@ -598,7 +592,7 @@ struct Q_QML_EXPORT PropertyResolver IgnoreRevision }; - QQmlPropertyData *property(const QString &name, bool *notInRevision = 0, RevisionCheck check = CheckRevision) const; + QQmlPropertyData *property(const QString &name, bool *notInRevision = nullptr, RevisionCheck check = CheckRevision) const; // This code must match the semantics of QQmlPropertyPrivate::findSignalByName QQmlPropertyData *signal(const QString &name, bool *notInRevision) const; diff --git a/src/qml/compiler/qqmlpropertycachecreator_p.h b/src/qml/compiler/qqmlpropertycachecreator_p.h index 7a52f3a12c..2af0fe0036 100644 --- a/src/qml/compiler/qqmlpropertycachecreator_p.h +++ b/src/qml/compiler/qqmlpropertycachecreator_p.h @@ -214,7 +214,7 @@ inline QQmlPropertyCache *QQmlPropertyCacheCreator<ObjectContainer>::propertyCac QQmlType qmltype = typeRef->type; if (!qmltype.isValid()) { QString propertyName = stringAt(context.instantiatingBinding->propertyNameIndex); - if (imports->resolveType(propertyName, &qmltype, 0, 0, 0)) { + if (imports->resolveType(propertyName, &qmltype, nullptr, nullptr, nullptr)) { if (qmltype.isComposite()) { QQmlTypeData *tdata = enginePrivate->typeLoader.getType(qmltype.sourceUrl()); Q_ASSERT(tdata); @@ -411,7 +411,7 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj Q_ASSERT(param->type == QV4::CompiledData::Property::Custom); const QString customTypeName = stringAt(param->customTypeNameIndex); QQmlType qmltype; - if (!imports->resolveType(customTypeName, &qmltype, 0, 0, 0)) + if (!imports->resolveType(customTypeName, &qmltype, nullptr, nullptr, nullptr)) return QQmlCompileError(s->location, QQmlPropertyCacheCreatorBase::tr("Invalid signal parameter type: %1").arg(customTypeName)); if (qmltype.isComposite()) { @@ -441,7 +441,7 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj seenSignals.insert(signalName); cache->appendSignal(signalName, flags, effectiveMethodIndex++, - paramCount?paramTypes.constData():0, names); + paramCount?paramTypes.constData():nullptr, names); } @@ -492,7 +492,7 @@ inline QQmlCompileError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObj p->type == QV4::CompiledData::Property::Custom); QQmlType qmltype; - if (!imports->resolveType(stringAt(p->customTypeNameIndex), &qmltype, 0, 0, 0)) { + if (!imports->resolveType(stringAt(p->customTypeNameIndex), &qmltype, nullptr, nullptr, nullptr)) { return QQmlCompileError(p->location, QQmlPropertyCacheCreatorBase::tr("Invalid property type")); } diff --git a/src/qml/compiler/qqmlpropertyvalidator.cpp b/src/qml/compiler/qqmlpropertyvalidator.cpp index 3aa8befa2c..00bb694ef4 100644 --- a/src/qml/compiler/qqmlpropertyvalidator.cpp +++ b/src/qml/compiler/qqmlpropertyvalidator.cpp @@ -58,7 +58,7 @@ QQmlPropertyValidator::QQmlPropertyValidator(QQmlEnginePrivate *enginePrivate, c QVector<QQmlCompileError> QQmlPropertyValidator::validate() { - return validateObject(/*root object*/0, /*instantiatingBinding*/0); + return validateObject(/*root object*/0, /*instantiatingBinding*/nullptr); } typedef QVarLengthArray<const QV4::CompiledData::Binding *, 8> GroupPropertyVector; @@ -94,7 +94,7 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, if (!propertyCache) return QVector<QQmlCompileError>(); - QQmlCustomParser *customParser = 0; + QQmlCustomParser *customParser = nullptr; if (auto typeRef = resolvedTypes.value(obj->inheritedTypeNameIndex)) { if (typeRef->type.isValid()) customParser = typeRef->type.customParser(); @@ -124,7 +124,7 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, QmlIR::PropertyResolver propertyResolver(propertyCache); QString defaultPropertyName; - QQmlPropertyData *defaultProperty = 0; + QQmlPropertyData *defaultProperty = nullptr; if (obj->indexOfDefaultPropertyOrAlias != -1) { QQmlPropertyCache *cache = propertyCache->parent(); defaultPropertyName = cache->defaultPropertyName(); @@ -157,7 +157,7 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, bool isGroupProperty = instantiatingBinding && instantiatingBinding->type == QV4::CompiledData::Binding::Type_GroupProperty; bool notInRevision = false; - QQmlPropertyData *pd = 0; + QQmlPropertyData *pd = nullptr; if (!name.isEmpty()) { if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression || binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject) @@ -188,8 +188,8 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, if (name.constData()->isUpper() && !binding->isAttachedProperty()) { QQmlType type; - QQmlImportNamespace *typeNamespace = 0; - imports.resolveType(stringAt(binding->propertyNameIndex), &type, 0, 0, &typeNamespace); + QQmlImportNamespace *typeNamespace = nullptr; + imports.resolveType(stringAt(binding->propertyNameIndex), &type, nullptr, nullptr, &typeNamespace); if (typeNamespace) return recordError(binding->location, tr("Invalid use of namespace")); return recordError(binding->location, tr("Invalid attached object assignment")); @@ -306,9 +306,9 @@ QVector<QQmlCompileError> QQmlPropertyValidator::validateObject(int objectIndex, customParser->engine = enginePrivate; customParser->imports = &imports; customParser->verifyBindings(qmlUnit, customBindings); - customParser->validator = 0; - customParser->engine = 0; - customParser->imports = (QQmlImports*)0; + customParser->validator = nullptr; + customParser->engine = nullptr; + customParser->imports = (QQmlImports*)nullptr; QVector<QQmlCompileError> parserErrors = customParser->errors(); if (!parserErrors.isEmpty()) return parserErrors; diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp index ac373aafb4..3415e1c073 100644 --- a/src/qml/compiler/qqmltypecompiler.cpp +++ b/src/qml/compiler/qqmltypecompiler.cpp @@ -332,7 +332,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio auto *typeRef = resolvedTypes.value(binding->propertyNameIndex); QQmlType type = typeRef ? typeRef->type : QQmlType(); if (!type.isValid()) { - if (imports->resolveType(propertyName, &type, 0, 0, 0)) { + if (imports->resolveType(propertyName, &type, nullptr, nullptr, nullptr)) { if (type.isComposite()) { QQmlTypeData *tdata = enginePrivate->typeLoader.getType(type.sourceUrl()); Q_ASSERT(tdata); @@ -397,7 +397,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio } else { if (notInRevision) { // Try assinging it as a property later - if (resolver.property(propertyName, /*notInRevision ptr*/0)) + if (resolver.property(propertyName, /*notInRevision ptr*/nullptr)) continue; const QString &originalPropertyName = stringAt(binding->propertyNameIndex); @@ -457,7 +457,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio QQmlJS::MemoryPool *pool = compiler->memoryPool(); - QQmlJS::AST::FormalParameterList *paramList = 0; + QQmlJS::AST::FormalParameterList *paramList = nullptr; for (const QString ¶m : qAsConst(parameters)) { QStringRef paramNameRef = compiler->newStringRef(param); @@ -471,7 +471,7 @@ bool SignalHandlerConverter::convertSignalHandlerExpressionsToFunctionDeclaratio paramList = paramList->finish(); QmlIR::CompiledFunctionOrExpression *foe = obj->functionsAndExpressions->slowAt(binding->value.compiledScriptIndex); - QQmlJS::AST::FunctionDeclaration *functionDeclaration = 0; + QQmlJS::AST::FunctionDeclaration *functionDeclaration = nullptr; if (QQmlJS::AST::ExpressionStatement *es = QQmlJS::AST::cast<QQmlJS::AST::ExpressionStatement*>(foe->node)) { if (QQmlJS::AST::FunctionExpression *fe = QQmlJS::AST::cast<QQmlJS::AST::FunctionExpression*>(es->expression)) { functionDeclaration = new (pool) QQmlJS::AST::FunctionDeclaration(fe->name, fe->formals, fe->body); @@ -611,7 +611,7 @@ bool QQmlEnumTypeResolver::tryQualifiedEnumAssignment(const QmlIR::Object *obj, return true; } QQmlType type; - imports->resolveType(typeName, &type, 0, 0, 0); + imports->resolveType(typeName, &type, nullptr, nullptr, nullptr); if (!type.isValid() && !isQtObject) return true; @@ -663,7 +663,7 @@ int QQmlEnumTypeResolver::evaluateEnum(const QString &scope, const QStringRef &e if (scope != QLatin1String("Qt")) { QQmlType type; - imports->resolveType(scope, &type, 0, 0, 0); + imports->resolveType(scope, &type, nullptr, nullptr, nullptr); if (!type.isValid()) return -1; if (!enumName.isEmpty()) @@ -814,7 +814,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI continue; } - QQmlPropertyData *pd = 0; + QQmlPropertyData *pd = nullptr; if (binding->propertyNameIndex != quint32(0)) { bool notInRevision = false; pd = propertyResolver.property(stringAt(binding->propertyNameIndex), ¬InRevision); @@ -825,7 +825,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(const QmlI continue; QQmlPropertyCache *pc = enginePrivate->rawPropertyCacheForType(pd->propType(), pd->typeMinorVersion()); - const QMetaObject *mo = pc ? pc->firstCppMetaObject() : 0; + const QMetaObject *mo = pc ? pc->firstCppMetaObject() : nullptr; while (mo) { if (mo == &QQmlComponent::staticMetaObject) break; @@ -1204,7 +1204,7 @@ bool QQmlDeferredAndCustomParserBindingScanner::scanObject(int objectIndex) return true; QString defaultPropertyName; - QQmlPropertyData *defaultProperty = 0; + QQmlPropertyData *defaultProperty = nullptr; if (obj->indexOfDefaultPropertyOrAlias != -1) { QQmlPropertyCache *cache = propertyCache->parent(); defaultPropertyName = cache->defaultPropertyName(); @@ -1229,7 +1229,7 @@ bool QQmlDeferredAndCustomParserBindingScanner::scanObject(int objectIndex) } for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) { - QQmlPropertyData *pd = 0; + QQmlPropertyData *pd = nullptr; QString name = stringAt(binding->propertyNameIndex); if (customParser) { @@ -1334,7 +1334,7 @@ bool QQmlJSCodeGenerator::compileComponent(int contextObject) auto *tref = resolvedTypes.value(obj->inheritedTypeNameIndex); if (tref && tref->isFullyDynamicType) - m.type = 0; + m.type = nullptr; idMapping << m; } @@ -1412,10 +1412,10 @@ void QQmlDefaultPropertyMerger::mergeDefaultProperties(int objectIndex) QmlIR::Object *object = qmlObjects.at(objectIndex); QString defaultProperty = object->indexOfDefaultPropertyOrAlias != -1 ? propertyCache->parent()->defaultPropertyName() : propertyCache->defaultPropertyName(); - QmlIR::Binding *bindingsToReinsert = 0; - QmlIR::Binding *tail = 0; + QmlIR::Binding *bindingsToReinsert = nullptr; + QmlIR::Binding *tail = nullptr; - QmlIR::Binding *previousBinding = 0; + QmlIR::Binding *previousBinding = nullptr; QmlIR::Binding *binding = object->firstBinding(); while (binding) { if (binding->propertyNameIndex == quint32(0) || stringAt(binding->propertyNameIndex) != defaultProperty) { @@ -1434,7 +1434,7 @@ void QQmlDefaultPropertyMerger::mergeDefaultProperties(int objectIndex) tail->next = toReinsert; tail = tail->next; } - tail->next = 0; + tail->next = nullptr; } binding = bindingsToReinsert; diff --git a/src/qml/compiler/qv4bytecodegenerator_p.h b/src/qml/compiler/qv4bytecodegenerator_p.h index 3d516da922..3b3c766bfe 100644 --- a/src/qml/compiler/qv4bytecodegenerator_p.h +++ b/src/qml/compiler/qv4bytecodegenerator_p.h @@ -94,7 +94,7 @@ public: generator->labels[index] = generator->instructions.size(); } - BytecodeGenerator *generator = 0; + BytecodeGenerator *generator = nullptr; int index = -1; }; diff --git a/src/qml/compiler/qv4codegen.cpp b/src/qml/compiler/qv4codegen.cpp index f236683506..eb5772e1bc 100644 --- a/src/qml/compiler/qv4codegen.cpp +++ b/src/qml/compiler/qv4codegen.cpp @@ -89,10 +89,10 @@ static inline void setJumpOutLocation(QV4::Moth::BytecodeGenerator *bytecodeGene } Codegen::Codegen(QV4::Compiler::JSUnitGenerator *jsUnitGenerator, bool strict) - : _module(0) + : _module(nullptr) , _returnAddress(0) - , _context(0) - , _labelledStatement(0) + , _context(nullptr) + , _labelledStatement(nullptr) , jsUnitGenerator(jsUnitGenerator) , _strictMode(strict) , _fileNameIsUrl(false) @@ -111,7 +111,7 @@ void Codegen::generateFromProgram(const QString &fileName, Q_ASSERT(node); _module = module; - _context = 0; + _context = nullptr; // ### should be set on the module outside of this method _module->fileName = fileName; @@ -120,7 +120,7 @@ void Codegen::generateFromProgram(const QString &fileName, ScanFunctions scan(this, sourceCode, mode); scan(node); - defineFunction(QStringLiteral("%entry"), node, 0, node->elements); + defineFunction(QStringLiteral("%entry"), node, nullptr, node->elements); } void Codegen::enterContext(Node *node) @@ -635,14 +635,14 @@ bool Codegen::visit(ArrayLiteral *ast) for (ElementList *it = ast->elements; it; it = it->next) { for (Elision *elision = it->elision; elision; elision = elision->next) - push(0); + push(nullptr); push(it->expression); if (hasError) return false; } for (Elision *elision = ast->elision; elision; elision = elision->next) - push(0); + push(nullptr); if (args == -1) { Q_ASSERT(argc == 0); @@ -1496,7 +1496,7 @@ bool Codegen::visit(FunctionExpression *ast) RegisterScope scope(this); - int function = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : 0); + int function = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : nullptr); loadClosure(function); _expr.setResult(Reference::fromAccumulator(this)); return false; @@ -1720,7 +1720,7 @@ bool Codegen::visit(ObjectLiteral *ast) v.rvalue = value.storeOnStack(); } else if (PropertyGetterSetter *gs = AST::cast<AST::PropertyGetterSetter *>(it->assignment)) { - const int function = defineFunction(name, gs, gs->formals, gs->functionBody ? gs->functionBody->elements : 0); + const int function = defineFunction(name, gs, gs->formals, gs->functionBody ? gs->functionBody->elements : nullptr); ObjectPropertyValue &v = valueMap[name]; if (v.rvalue.isValid() || (gs->type == PropertyGetterSetter::Getter && v.hasGetter()) || @@ -2142,7 +2142,7 @@ int Codegen::defineFunction(const QString &name, AST::Node *ast, for (const Context::Member &member : qAsConst(_context->members)) { if (member.function) { const int function = defineFunction(member.function->name.toString(), member.function, member.function->formals, - member.function->body ? member.function->body->elements : 0); + member.function->body ? member.function->body->elements : nullptr); loadClosure(function); if (! _context->parent) { Reference::fromName(this, member.function->name.toString()).storeConsumeAccumulator(); diff --git a/src/qml/compiler/qv4codegen_p.h b/src/qml/compiler/qv4codegen_p.h index e52f63e1f4..a46d47cb67 100644 --- a/src/qml/compiler/qv4codegen_p.h +++ b/src/qml/compiler/qv4codegen_p.h @@ -191,10 +191,7 @@ public: bool isLValue() const { return !isReadonly; } Reference(Codegen *cg, Type type = Invalid) : type(type), codegen(cg) {} - Reference() - : type(Invalid) - , codegen(nullptr) - {} + Reference() {} Reference(const Reference &other); Reference &operator =(const Reference &other); @@ -367,7 +364,7 @@ public: bool stackSlotIsLocalOrArgument = false; bool isVolatile = false; bool global = false; - Codegen *codegen; + Codegen *codegen = nullptr; private: void storeAccumulator() const; @@ -386,16 +383,12 @@ public: }; struct ObjectPropertyValue { - ObjectPropertyValue() - : getter(-1) - , setter(-1) - , keyAsIndex(UINT_MAX) - {} + ObjectPropertyValue() {} Reference rvalue; - int getter; // index in _module->functions or -1 if not set - int setter; - uint keyAsIndex; + int getter = -1; // index in _module->functions or -1 if not set + int setter = -1; + uint keyAsIndex = UINT_MAX; bool hasGetter() const { return getter >= 0; } bool hasSetter() const { return setter >= 0; } @@ -406,34 +399,26 @@ protected: class Result { Reference _result; - const BytecodeGenerator::Label *_iftrue; - const BytecodeGenerator::Label *_iffalse; - Format _format; + const BytecodeGenerator::Label *_iftrue = nullptr; + const BytecodeGenerator::Label *_iffalse = nullptr; + Format _format = ex; Format _requested; bool _trueBlockFollowsCondition = false; public: explicit Result(const Reference &lrvalue) : _result(lrvalue) - , _iftrue(nullptr) - , _iffalse(nullptr) - , _format(ex) , _requested(ex) - { - } + {} explicit Result(Format requested = ex) - : _iftrue(0) - , _iffalse(0) - , _format(ex) - , _requested(requested) {} + : _requested(requested) {} explicit Result(const BytecodeGenerator::Label *iftrue, const BytecodeGenerator::Label *iffalse, bool trueBlockFollowsCondition) : _iftrue(iftrue) , _iffalse(iffalse) - , _format(ex) , _requested(cx) , _trueBlockFollowsCondition(trueBlockFollowsCondition) { @@ -671,7 +656,7 @@ protected: Context *_context; AST::LabelledStatement *_labelledStatement; QV4::Compiler::JSUnitGenerator *jsUnitGenerator; - BytecodeGenerator *bytecodeGenerator = 0; + BytecodeGenerator *bytecodeGenerator = nullptr; bool _strictMode; bool useFastLookups = true; bool requiresReturnValue = false; diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index 05869c3287..cc11b250f3 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -109,7 +109,7 @@ CompilationUnit::~CompilationUnit() unlink(); if (data && !(data->flags & QV4::CompiledData::Unit::StaticData)) free(const_cast<Unit *>(data)); - data = 0; + data = nullptr; } QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) @@ -201,7 +201,7 @@ QV4::Function *CompilationUnit::linkToEngine(ExecutionEngine *engine) if (data->indexOfRootFunction != -1) return runtimeFunctions[data->indexOfRootFunction]; else - return 0; + return nullptr; } void CompilationUnit::unlink() @@ -228,16 +228,16 @@ void CompilationUnit::unlink() qDeleteAll(resolvedTypes); resolvedTypes.clear(); - engine = 0; - qmlEngine = 0; + engine = nullptr; + qmlEngine = nullptr; free(runtimeStrings); - runtimeStrings = 0; + runtimeStrings = nullptr; delete [] runtimeLookups; - runtimeLookups = 0; + runtimeLookups = nullptr; delete [] runtimeRegularExpressions; - runtimeRegularExpressions = 0; + runtimeRegularExpressions = nullptr; free(runtimeClasses); - runtimeClasses = 0; + runtimeClasses = nullptr; qDeleteAll(runtimeFunctions); runtimeFunctions.clear(); #if Q_BYTE_ORDER == Q_BIG_ENDIAN @@ -676,7 +676,7 @@ bool qtTypeInherits(const QMetaObject *mo) { void ResolvedTypeReference::doDynamicTypeCheck() { - const QMetaObject *mo = 0; + const QMetaObject *mo = nullptr; if (typePropertyCache) mo = typePropertyCache->firstCppMetaObject(); else if (type.isValid()) diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index bd68ea513e..a78a66db52 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -120,7 +120,7 @@ struct Context { int index = -1; QQmlJS::AST::VariableDeclaration::VariableScope scope = QQmlJS::AST::VariableDeclaration::FunctionScope; mutable bool canEscape = false; - QQmlJS::AST::FunctionExpression *function = 0; + QQmlJS::AST::FunctionExpression *function = nullptr; bool isLexicallyScoped() const { return this->scope != QQmlJS::AST::VariableDeclaration::FunctionScope; } }; @@ -128,12 +128,12 @@ struct Context { MemberMap members; QSet<QString> usedVariables; - QQmlJS::AST::FormalParameterList *formals = 0; + QQmlJS::AST::FormalParameterList *formals = nullptr; QStringList arguments; QStringList locals; QVector<Context *> nestedContexts; - ControlFlow *controlFlow = 0; + ControlFlow *controlFlow = nullptr; QByteArray code; QVector<CompiledData::CodeOffsetToLine> lineNumberMapping; @@ -173,10 +173,10 @@ struct Context { // Map from meta property index (existence implies dependency) to notify signal index struct KeyValuePair { - quint32 _key; - quint32 _value; + quint32 _key = 0; + quint32 _value = 0; - KeyValuePair(): _key(0), _value(0) {} + KeyValuePair() {} KeyValuePair(quint32 key, quint32 value): _key(key), _value(value) {} quint32 key() const { return _key; } @@ -245,7 +245,7 @@ struct Context { Q_ASSERT(m); MemberMap::const_iterator it = members.find(name); if (it == members.end()) { - *m = 0; + *m = nullptr; return false; } *m = &(*it); @@ -256,7 +256,7 @@ struct Context { usedVariables.insert(name); } - void addLocalVar(const QString &name, MemberType type, QQmlJS::AST::VariableDeclaration::VariableScope scope, QQmlJS::AST::FunctionExpression *function = 0) + void addLocalVar(const QString &name, MemberType type, QQmlJS::AST::VariableDeclaration::VariableScope scope, QQmlJS::AST::FunctionExpression *function = nullptr) { if (! name.isEmpty()) { if (type != FunctionDefinition) { diff --git a/src/qml/compiler/qv4compilercontrolflow_p.h b/src/qml/compiler/qv4compilercontrolflow_p.h index 13716fe29f..9bda20905a 100644 --- a/src/qml/compiler/qv4compilercontrolflow_p.h +++ b/src/qml/compiler/qv4compilercontrolflow_p.h @@ -159,7 +159,7 @@ struct ControlFlow { virtual Handler getHandler(HandlerType type, const QString &label = QString()) = 0; BytecodeGenerator::ExceptionHandler *parentExceptionHandler() { - return parent ? parent->exceptionHandler() : 0; + return parent ? parent->exceptionHandler() : nullptr; } virtual BytecodeGenerator::ExceptionHandler *exceptionHandler() { @@ -184,7 +184,7 @@ protected: QString label; if (cg->_labelledStatement) { label = cg->_labelledStatement->label.toString(); - cg->_labelledStatement = 0; + cg->_labelledStatement = nullptr; } return label; } @@ -196,10 +196,10 @@ protected: struct ControlFlowLoop : public ControlFlow { QString loopLabel; - BytecodeGenerator::Label *breakLabel = 0; - BytecodeGenerator::Label *continueLabel = 0; + BytecodeGenerator::Label *breakLabel = nullptr; + BytecodeGenerator::Label *continueLabel = nullptr; - ControlFlowLoop(Codegen *cg, BytecodeGenerator::Label *breakLabel, BytecodeGenerator::Label *continueLabel = 0) + ControlFlowLoop(Codegen *cg, BytecodeGenerator::Label *breakLabel, BytecodeGenerator::Label *continueLabel = nullptr) : ControlFlow(cg, Loop), loopLabel(ControlFlow::loopLabel()), breakLabel(breakLabel), continueLabel(continueLabel) { } @@ -407,7 +407,7 @@ struct ControlFlowFinally : public ControlFlowUnwind ControlFlowFinally(Codegen *cg, AST::Finally *finally) : ControlFlowUnwind(cg, Finally), finally(finally) { - Q_ASSERT(finally != 0); + Q_ASSERT(finally != nullptr); generator()->setExceptionHandler(&unwindLabel); } diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index 808e79959d..89f602b409 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -59,7 +59,7 @@ using namespace QQmlJS::AST; ScanFunctions::ScanFunctions(Codegen *cg, const QString &sourceCode, CompilationMode defaultProgramMode) : _cg(cg) , _sourceCode(sourceCode) - , _context(0) + , _context(nullptr) , _allowFuncDecls(true) , defaultProgramMode(defaultProgramMode) { @@ -208,7 +208,7 @@ bool ScanFunctions::visit(VariableDeclaration *ast) return false; } QString name = ast->name.toString(); - const Context::Member *m = 0; + const Context::Member *m = nullptr; if (_context->memberInfo(name, &m)) { if (m->isLexicallyScoped() || ast->isLexicallyScoped()) { _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Identifier %1 has already been declared").arg(name)); @@ -258,7 +258,7 @@ void ScanFunctions::enterFunction(FunctionExpression *ast, bool enterName) { if (_context->isStrict && (ast->name == QLatin1String("eval") || ast->name == QLatin1String("arguments"))) _cg->throwSyntaxError(ast->identifierToken, QStringLiteral("Function name may not be eval or arguments in strict mode")); - enterFunction(ast, ast->name.toString(), ast->formals, ast->body, enterName ? ast : 0); + enterFunction(ast, ast->name.toString(), ast->formals, ast->body, enterName ? ast : nullptr); } void ScanFunctions::endVisit(FunctionExpression *) @@ -287,7 +287,7 @@ bool ScanFunctions::visit(ObjectLiteral *ast) bool ScanFunctions::visit(PropertyGetterSetter *ast) { TemporaryBoolAssignment allowFuncDecls(_allowFuncDecls, true); - enterFunction(ast, QString(), ast->formals, ast->functionBody, /*FunctionExpression*/0); + enterFunction(ast, QString(), ast->formals, ast->functionBody, /*FunctionExpression*/nullptr); return true; } diff --git a/src/qml/compiler/qv4compilerscanfunctions_p.h b/src/qml/compiler/qv4compilerscanfunctions_p.h index 526278fdd8..745e9f8a73 100644 --- a/src/qml/compiler/qv4compilerscanfunctions_p.h +++ b/src/qml/compiler/qv4compilerscanfunctions_p.h @@ -88,7 +88,7 @@ public: void leaveEnvironment(); void enterQmlScope(AST::Node *ast, const QString &name) - { enterFunction(ast, name, /*formals*/0, /*body*/0, /*expr*/0); } + { enterFunction(ast, name, /*formals*/nullptr, /*body*/nullptr, /*expr*/nullptr); } void enterQmlFunction(AST::FunctionDeclaration *ast) { enterFunction(ast, false); } diff --git a/src/qml/debugger/qqmlabstractprofileradapter_p.h b/src/qml/debugger/qqmlabstractprofileradapter_p.h index 42515388e3..4a01c271ca 100644 --- a/src/qml/debugger/qqmlabstractprofileradapter_p.h +++ b/src/qml/debugger/qqmlabstractprofileradapter_p.h @@ -68,8 +68,8 @@ class Q_QML_PRIVATE_EXPORT QQmlAbstractProfilerAdapter : public QObject, public public: static const int s_numMessagesPerBatch = 1000; - QQmlAbstractProfilerAdapter(QObject *parent = 0) : - QObject(parent), service(0), waiting(true), featuresEnabled(0) {} + QQmlAbstractProfilerAdapter(QObject *parent = nullptr) : + QObject(parent), service(nullptr), waiting(true), featuresEnabled(0) {} virtual ~QQmlAbstractProfilerAdapter() {} void setService(QQmlProfilerService *new_service) { service = new_service; } diff --git a/src/qml/debugger/qqmlconfigurabledebugservice_p.h b/src/qml/debugger/qqmlconfigurabledebugservice_p.h index e09d5f779a..96ec46f475 100644 --- a/src/qml/debugger/qqmlconfigurabledebugservice_p.h +++ b/src/qml/debugger/qqmlconfigurabledebugservice_p.h @@ -63,7 +63,7 @@ template <class Base> class QQmlConfigurableDebugService : public Base { protected: - QQmlConfigurableDebugService(float version, QObject *parent = 0) : + QQmlConfigurableDebugService(float version, QObject *parent = nullptr) : Base(version, parent), m_configMutex(QMutex::Recursive) { init(); diff --git a/src/qml/debugger/qqmldebugconnector.cpp b/src/qml/debugger/qqmldebugconnector.cpp index 01f74f08be..d9f51ce09f 100644 --- a/src/qml/debugger/qqmldebugconnector.cpp +++ b/src/qml/debugger/qqmldebugconnector.cpp @@ -66,7 +66,7 @@ struct QQmlDebugConnectorParams { QString arguments; QQmlDebugConnector *instance; - QQmlDebugConnectorParams() : instance(0) + QQmlDebugConnectorParams() : instance(nullptr) { if (qApp) { QCoreApplicationPrivate *appD = @@ -109,7 +109,7 @@ QQmlDebugConnector *QQmlDebugConnector::instance() { QQmlDebugConnectorParams *params = qmlDebugConnectorParams(); if (!params) - return 0; + return nullptr; if (!QQmlEnginePrivate::qml_debugging_enabled) { if (!params->arguments.isEmpty()) { @@ -118,14 +118,14 @@ QQmlDebugConnector *QQmlDebugConnector::instance() "has not been enabled.").arg(params->arguments); params->arguments.clear(); } - return 0; + return nullptr; } if (!params->instance) { if (!params->pluginKey.isEmpty()) { params->instance = loadQQmlDebugConnector(params->pluginKey); } else if (params->arguments.isEmpty()) { - return 0; // no explicit class name given and no command line arguments + return nullptr; // no explicit class name given and no command line arguments } else if (params->arguments.startsWith(QLatin1String("connector:"))) { static const int connectorBegin = int(strlen("connector:")); @@ -169,7 +169,7 @@ QQmlDebugConnectorFactory::~QQmlDebugConnectorFactory() params->arguments.clear(); params->services.clear(); delete params->instance; - params->instance = 0; + params->instance = nullptr; } } diff --git a/src/qml/debugger/qqmldebugconnector_p.h b/src/qml/debugger/qqmldebugconnector_p.h index a2a6f5047d..cead6af338 100644 --- a/src/qml/debugger/qqmldebugconnector_p.h +++ b/src/qml/debugger/qqmldebugconnector_p.h @@ -114,7 +114,7 @@ public: static Service *service() { QQmlDebugConnector *inst = instance(); - return inst ? static_cast<Service *>(inst->service(Service::s_key)) : 0; + return inst ? static_cast<Service *>(inst->service(Service::s_key)) : nullptr; } protected: diff --git a/src/qml/debugger/qqmldebugserverconnection_p.h b/src/qml/debugger/qqmldebugserverconnection_p.h index 536ad830b4..9c4af4d225 100644 --- a/src/qml/debugger/qqmldebugserverconnection_p.h +++ b/src/qml/debugger/qqmldebugserverconnection_p.h @@ -61,7 +61,7 @@ class Q_QML_PRIVATE_EXPORT QQmlDebugServerConnection : public QObject { Q_OBJECT public: - QQmlDebugServerConnection(QObject *parent = 0) : QObject(parent) {} + QQmlDebugServerConnection(QObject *parent = nullptr) : QObject(parent) {} virtual void setServer(QQmlDebugServer *server) = 0; virtual bool setPortRange(int portFrom, int portTo, bool block, const QString &hostaddress) = 0; diff --git a/src/qml/debugger/qqmldebugservice_p.h b/src/qml/debugger/qqmldebugservice_p.h index 34bbd631ec..e9f7d2d396 100644 --- a/src/qml/debugger/qqmldebugservice_p.h +++ b/src/qml/debugger/qqmldebugservice_p.h @@ -93,7 +93,7 @@ public: static QObject *objectForId(int id) { return objectsForIds().value(id); } protected: - explicit QQmlDebugService(const QString &, float version, QObject *parent = 0); + explicit QQmlDebugService(const QString &, float version, QObject *parent = nullptr); signals: void attachedToEngine(QJSEngine *); diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h index c1038d2f76..44d208db41 100644 --- a/src/qml/debugger/qqmlprofiler_p.h +++ b/src/qml/debugger/qqmlprofiler_p.h @@ -450,7 +450,7 @@ struct QQmlCompilingProfiler : public QQmlProfilerHelper { struct QQmlVmeProfiler : public QQmlProfilerDefinitions { public: - QQmlVmeProfiler() : profiler(0) {} + QQmlVmeProfiler() : profiler(nullptr) {} void init(QQmlProfiler *p, int maxDepth) { diff --git a/src/qml/jit/qv4assembler.cpp b/src/qml/jit/qv4assembler.cpp index fdb795be92..186e5952da 100644 --- a/src/qml/jit/qv4assembler.cpp +++ b/src/qml/jit/qv4assembler.cpp @@ -1319,7 +1319,7 @@ class QIODevicePrintStream: public FilePrintStream public: explicit QIODevicePrintStream(QIODevice *dest) - : FilePrintStream(0) + : FilePrintStream(nullptr) , dest(dest) , buf(4096, '0') { @@ -1373,7 +1373,7 @@ void Assembler::link(Function *function) jumpTarget.jump.linkTo(pasm()->labelsByOffset[jumpTarget.offset], pasm()); JSC::JSGlobalData dummy(function->internalClass->engine->executableAllocator); - JSC::LinkBuffer<PlatformAssembler::MacroAssembler> linkBuffer(dummy, pasm(), 0); + JSC::LinkBuffer<PlatformAssembler::MacroAssembler> linkBuffer(dummy, pasm(), nullptr); for (const auto &ehTarget : pasm()->ehTargets) { auto targetLabel = pasm()->labelsByOffset.value(ehTarget.offset); diff --git a/src/qml/jsapi/qjsengine.cpp b/src/qml/jsapi/qjsengine.cpp index 017eabd850..924de14bc7 100644 --- a/src/qml/jsapi/qjsengine.cpp +++ b/src/qml/jsapi/qjsengine.cpp @@ -783,7 +783,7 @@ QJSEngine *qjsEngine(const QObject *object) { QQmlData *data = QQmlData::get(object, false); if (!data || data->jsWrapper.isNullOrUndefined()) - return 0; + return nullptr; return data->jsWrapper.engine()->jsEngine(); } diff --git a/src/qml/jsapi/qjsengine_p.h b/src/qml/jsapi/qjsengine_p.h index cbfe0f14a3..1ea1d77851 100644 --- a/src/qml/jsapi/qjsengine_p.h +++ b/src/qml/jsapi/qjsengine_p.h @@ -163,7 +163,7 @@ QQmlPropertyCache until the QQmlEngine is destroyed. QQmlPropertyCache *QJSEnginePrivate::cache(QObject *obj) { if (!obj || QObjectPrivate::get(obj)->metaObject || QObjectPrivate::get(obj)->wasDeleted) - return 0; + return nullptr; Locker locker(this); const QMetaObject *mo = obj->metaObject(); diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp index c4090ac482..b97468ab7b 100644 --- a/src/qml/jsapi/qjsvalue.cpp +++ b/src/qml/jsapi/qjsvalue.cpp @@ -662,7 +662,7 @@ QVariant QJSValue::toVariant() const return QVariant(val->asDouble()); } if (val->isNull()) - return QVariant(QMetaType::Nullptr, 0); + return QVariant(QMetaType::Nullptr, nullptr); Q_ASSERT(val->isUndefined()); return QVariant(); } @@ -831,7 +831,7 @@ QJSEngine* QJSValue::engine() const QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this); if (engine) return engine->jsEngine(); - return 0; + return nullptr; } #endif // QT_DEPRECATED @@ -884,7 +884,7 @@ void QJSValue::setPrototype(const QJSValue& prototype) if (!val) return; if (val->isNull()) { - o->setPrototype(0); + o->setPrototype(nullptr); return; } @@ -1308,11 +1308,11 @@ QObject *QJSValue::toQObject() const { QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this); if (!engine) - return 0; + return nullptr; QV4::Scope scope(engine); QV4::Scoped<QV4::QObjectWrapper> wrapper(scope, QJSValuePrivate::getValue(this)); if (!wrapper) - return 0; + return nullptr; return wrapper->object(); } @@ -1329,11 +1329,11 @@ const QMetaObject *QJSValue::toQMetaObject() const { QV4::ExecutionEngine *engine = QJSValuePrivate::engine(this); if (!engine) - return 0; + return nullptr; QV4::Scope scope(engine); QV4::Scoped<QV4::QMetaObjectWrapper> wrapper(scope, QJSValuePrivate::getValue(this)); if (!wrapper) - return 0; + return nullptr; return wrapper->metaObject(); } @@ -1389,7 +1389,7 @@ bool QJSValue::isRegExp() const bool QJSValue::isQObject() const { QV4::Value *val = QJSValuePrivate::getValue(this); - return val && val->as<QV4::QObjectWrapper>() != 0; + return val && val->as<QV4::QObjectWrapper>() != nullptr; } /*! @@ -1403,7 +1403,7 @@ bool QJSValue::isQObject() const bool QJSValue::isQMetaObject() const { QV4::Value *val = QJSValuePrivate::getValue(this); - return val && val->as<QV4::QMetaObjectWrapper>() != 0; + return val && val->as<QV4::QMetaObjectWrapper>() != nullptr; } QT_END_NAMESPACE diff --git a/src/qml/jsapi/qjsvalue_p.h b/src/qml/jsapi/qjsvalue_p.h index c4761ad6ea..62e09f72be 100644 --- a/src/qml/jsapi/qjsvalue_p.h +++ b/src/qml/jsapi/qjsvalue_p.h @@ -68,7 +68,7 @@ public: static inline QV4::Value *getValue(const QJSValue *jsval) { if (jsval->d & 3) - return 0; + return nullptr; return reinterpret_cast<QV4::Value *>(jsval->d); } @@ -76,7 +76,7 @@ public: { if (jsval->d & 1) return reinterpret_cast<QVariant *>(jsval->d & ~3); - return 0; + return nullptr; } static inline void setVariant(QJSValue *jsval, const QVariant &v) { @@ -153,14 +153,14 @@ public: *v = QV4::Encode(variant->toUInt()); break; default: - return 0; + return nullptr; } return v; } static QV4::ExecutionEngine *engine(const QJSValue *jsval) { QV4::Value *v = getValue(jsval); - return v ? QV4::PersistentValueStorage::getEngine(v) : 0; + return v ? QV4::PersistentValueStorage::getEngine(v) : nullptr; } static inline bool checkEngine(QV4::ExecutionEngine *e, const QJSValue &jsval) { diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp index f7b9e8acef..c4eddb6b2a 100644 --- a/src/qml/jsruntime/qv4arraybuffer.cpp +++ b/src/qml/jsruntime/qv4arraybuffer.cpp @@ -96,7 +96,7 @@ void Heap::ArrayBuffer::init(size_t length) Object::init(); data = QTypedArrayData<char>::allocate(length + 1); if (!data) { - data = 0; + data = nullptr; internalClass->engine->throwRangeError(QStringLiteral("ArrayBuffer: out of memory")); return; } @@ -152,7 +152,7 @@ void ArrayBufferPrototype::init(ExecutionEngine *engine, Object *ctor) ctor->defineReadonlyProperty(engine->id_prototype(), (o = this)); ctor->defineDefaultProperty(QStringLiteral("isView"), ArrayBufferCtor::method_isView, 1); defineDefaultProperty(engine->id_constructor(), (o = ctor)); - defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0); + defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, nullptr); defineDefaultProperty(QStringLiteral("slice"), method_slice, 2); defineDefaultProperty(QStringLiteral("toString"), method_toString, 0); } diff --git a/src/qml/jsruntime/qv4arraybuffer_p.h b/src/qml/jsruntime/qv4arraybuffer_p.h index e236a23d1f..59e78ee85f 100644 --- a/src/qml/jsruntime/qv4arraybuffer_p.h +++ b/src/qml/jsruntime/qv4arraybuffer_p.h @@ -93,8 +93,8 @@ struct Q_QML_PRIVATE_EXPORT ArrayBuffer : Object QByteArray asByteArray() const; uint byteLength() const { return d()->byteLength(); } - char *data() { detach(); return d()->data ? d()->data->data() : 0; } - const char *constData() { detach(); return d()->data ? d()->data->data() : 0; } + char *data() { detach(); return d()->data ? d()->data->data() : nullptr; } + const char *constData() { detach(); return d()->data ? d()->data->data() : nullptr; } private: void detach(); diff --git a/src/qml/jsruntime/qv4arraydata.cpp b/src/qml/jsruntime/qv4arraydata.cpp index 5e971c8e9b..30c8527f21 100644 --- a/src/qml/jsruntime/qv4arraydata.cpp +++ b/src/qml/jsruntime/qv4arraydata.cpp @@ -50,7 +50,7 @@ using namespace QV4; QT_WARNING_SUPPRESS_GCC_TAUTOLOGICAL_COMPARE_ON const QV4::VTable QV4::ArrayData::static_vtbl = { - 0, + nullptr, 0, 0, QV4::ArrayData::IsExecutionContext, @@ -69,7 +69,7 @@ const QV4::VTable QV4::ArrayData::static_vtbl = { const ArrayVTable SimpleArrayData::static_vtbl = { - DEFINE_MANAGED_VTABLE_INT(SimpleArrayData, 0), + DEFINE_MANAGED_VTABLE_INT(SimpleArrayData, nullptr), Heap::ArrayData::Simple, SimpleArrayData::reallocate, SimpleArrayData::get, @@ -85,7 +85,7 @@ const ArrayVTable SimpleArrayData::static_vtbl = const ArrayVTable SparseArrayData::static_vtbl = { - DEFINE_MANAGED_VTABLE_INT(SparseArrayData, 0), + DEFINE_MANAGED_VTABLE_INT(SparseArrayData, nullptr), Heap::ArrayData::Sparse, SparseArrayData::reallocate, SparseArrayData::get, @@ -170,7 +170,7 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt newData->setType(newType); if (d) newData->d()->needsMark = d->d()->needsMark; - newData->setAttrs(enforceAttributes ? reinterpret_cast<PropertyAttributes *>(newData->d()->values.values + alloc) : 0); + newData->setAttrs(enforceAttributes ? reinterpret_cast<PropertyAttributes *>(newData->d()->values.values + alloc) : nullptr); o->setArrayData(newData); if (d) { @@ -203,7 +203,7 @@ void ArrayData::realloc(Object *o, Type newType, uint requested, bool enforceAtt if (d && d->type() == Heap::ArrayData::Sparse) { Heap::SparseArrayData *old = static_cast<Heap::SparseArrayData *>(d->d()); sparse->sparse = old->sparse; - old->sparse = 0; + old->sparse = nullptr; lastFree = &sparse->sparse->freeList; } else { sparse->sparse = new SparseArray; @@ -779,7 +779,7 @@ void ArrayData::sort(ExecutionEngine *engine, Object *thisObject, const Value &c if (!sparse->sparse()->nEntries()) return; - thisObject->setArrayData(0); + thisObject->setArrayData(nullptr); ArrayData::realloc(thisObject, Heap::ArrayData::Simple, sparse->sparse()->nEntries(), sparse->attrs() ? true : false); Heap::SimpleArrayData *d = thisObject->d()->arrayData.cast<Heap::SimpleArrayData>(); diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h index d6549e44ee..9356670b6d 100644 --- a/src/qml/jsruntime/qv4arraydata_p.h +++ b/src/qml/jsruntime/qv4arraydata_p.h @@ -331,7 +331,7 @@ ArrayData::Index ArrayData::getValueOrSetter(uint index, PropertyAttributes *att uint idx = mappedIndex(index); if (idx == UINT_MAX) { *attrs = Attr_Invalid; - return { 0, 0 }; + return { nullptr, 0 }; } *attrs = attributes(index); diff --git a/src/qml/jsruntime/qv4context.cpp b/src/qml/jsruntime/qv4context.cpp index 00d816fe91..020e519e74 100644 --- a/src/qml/jsruntime/qv4context.cpp +++ b/src/qml/jsruntime/qv4context.cpp @@ -302,7 +302,7 @@ ReturnedValue ExecutionContext::getProperty(String *name) ReturnedValue ExecutionContext::getPropertyAndBase(String *name, Value *base) { - base->setM(0); + base->setM(nullptr); name->makeIdentifier(); Heap::ExecutionContext *ctx = d(); diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index dfac5534be..512bfa06d8 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -246,12 +246,12 @@ struct CatchContext : public ExecutionContext inline CallContext *ExecutionContext::asCallContext() { - return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<CallContext *>(this) : 0; + return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<CallContext *>(this) : nullptr; } inline const CallContext *ExecutionContext::asCallContext() const { - return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<const CallContext *>(this) : 0; + return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<const CallContext *>(this) : nullptr; } } // namespace QV4 diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp index 397ef1cfec..d894d909ff 100644 --- a/src/qml/jsruntime/qv4dataview.cpp +++ b/src/qml/jsruntime/qv4dataview.cpp @@ -88,9 +88,9 @@ void DataViewPrototype::init(ExecutionEngine *engine, Object *ctor) ctor->defineReadonlyProperty(engine->id_length(), Primitive::fromInt32(3)); ctor->defineReadonlyProperty(engine->id_prototype(), (o = this)); defineDefaultProperty(engine->id_constructor(), (o = ctor)); - defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, 0); - defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0); - defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, 0); + defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, nullptr); + defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, nullptr); + defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, nullptr); defineDefaultProperty(QStringLiteral("getInt8"), method_getChar<signed char>, 0); defineDefaultProperty(QStringLiteral("getUint8"), method_getChar<unsigned char>, 0); diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h index a4ab0a27ed..2b9a580288 100644 --- a/src/qml/jsruntime/qv4dateobject_p.h +++ b/src/qml/jsruntime/qv4dateobject_p.h @@ -101,7 +101,7 @@ struct DateObject: Object { template<> inline const DateObject *Value::as() const { - return isManaged() && m()->vtable()->type == Managed::Type_DateObject ? static_cast<const DateObject *>(this) : 0; + return isManaged() && m()->vtable()->type == Managed::Type_DateObject ? static_cast<const DateObject *>(this) : nullptr; } struct DateCtor: FunctionObject diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 903633df90..9aac5c4f70 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -133,14 +133,14 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) , bumperPointerAllocator(new WTF::BumpPointerAllocator) , jsStack(new WTF::PageAllocation) , gcStack(new WTF::PageAllocation) - , globalCode(0) - , v8Engine(0) + , globalCode(nullptr) + , v8Engine(nullptr) , publicEngine(jsEngine) - , argumentsAccessors(0) + , argumentsAccessors(nullptr) , nArgumentsAccessors(0) , m_engineId(engineSerial.fetchAndAddOrdered(1)) - , regExpCache(0) - , m_multiplyWrappedQObjects(0) + , regExpCache(nullptr) + , m_multiplyWrappedQObjects(nullptr) #if defined(V4_ENABLE_JIT) && !defined(V4_BOOTSTRAP) , m_canAllocateExecutableMemory(OSAllocator::canAllocateExecutableMemory()) #endif @@ -321,7 +321,7 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) internalClasses[EngineBase::Class_RegExpExecArray] = ic->addMember(id_input(), Attr_Data, &index); Q_ASSERT(index == RegExpObject::Index_ArrayInput); - ic = newInternalClass(ErrorObject::staticVTable(), 0); + ic = newInternalClass(ErrorObject::staticVTable(), nullptr); ic = ic->addMember((str = newIdentifier(QStringLiteral("stack"))), Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable, &index); Q_ASSERT(index == ErrorObject::Index_Stack); ic = ic->addMember((str = newIdentifier(QStringLiteral("fileName"))), Attr_Data|Attr_NotEnumerable, &index); @@ -406,8 +406,8 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) jsObjects[DataView_Ctor] = memoryManager->allocObject<DataViewCtor>(global); jsObjects[DataViewProto] = memoryManager->allocObject<DataViewPrototype>(); static_cast<DataViewPrototype *>(dataViewPrototype())->init(this, dataViewCtor()); - jsObjects[ValueTypeProto] = (Heap::Base *) 0; - jsObjects[SignalHandlerProto] = (Heap::Base *) 0; + jsObjects[ValueTypeProto] = (Heap::Base *) nullptr; + jsObjects[SignalHandlerProto] = (Heap::Base *) nullptr; for (int i = 0; i < Heap::TypedArray::NTypes; ++i) { static_cast<Value &>(typedArrayCtors[i]) = memoryManager->allocObject<TypedArrayCtor>(global, Heap::TypedArray::Type(i)); @@ -490,7 +490,7 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) ExecutionEngine::~ExecutionEngine() { delete m_multiplyWrappedQObjects; - m_multiplyWrappedQObjects = 0; + m_multiplyWrappedQObjects = nullptr; delete identifierTable; delete memoryManager; @@ -541,7 +541,7 @@ InternalClass *ExecutionEngine::newClass(InternalClass *other) InternalClass *ExecutionEngine::newInternalClass(const VTable *vtable, Object *prototype) { - return internalClasses[EngineBase::Class_Empty]->changeVTable(vtable)->changePrototype(prototype ? prototype->d() : 0); + return internalClasses[EngineBase::Class_Empty]->changeVTable(vtable)->changePrototype(prototype ? prototype->d() : nullptr); } Heap::Object *ExecutionEngine::newObject() @@ -743,18 +743,18 @@ Heap::Object *ExecutionEngine::newForEachIteratorObject(Object *o) Heap::QmlContext *ExecutionEngine::qmlContext() const { if (!currentStackFrame) - return 0; + return nullptr; Heap::ExecutionContext *ctx = currentContext()->d(); if (ctx->type != Heap::ExecutionContext::Type_QmlContext && !ctx->outer) - return 0; + return nullptr; while (ctx->outer && ctx->outer->type != Heap::ExecutionContext::Type_GlobalContext) ctx = ctx->outer; Q_ASSERT(ctx); if (ctx->type != Heap::ExecutionContext::Type_QmlContext) - return 0; + return nullptr; return static_cast<Heap::QmlContext *>(ctx); } @@ -763,7 +763,7 @@ QObject *ExecutionEngine::qmlScopeObject() const { Heap::QmlContext *ctx = qmlContext(); if (!ctx) - return 0; + return nullptr; return ctx->qml()->scopeObject; } @@ -793,7 +793,7 @@ QQmlContextData *ExecutionEngine::callingQmlContext() const { Heap::QmlContext *ctx = qmlContext(); if (!ctx) - return 0; + return nullptr; return ctx->qml()->context->contextData(); } @@ -1101,7 +1101,7 @@ QQmlError ExecutionEngine::catchExceptionAsQmlError() typedef QSet<QV4::Heap::Object *> V4ObjectSet; static QVariant toVariant(QV4::ExecutionEngine *e, const QV4::Value &value, int typeHint, bool createJSValueForObjects, V4ObjectSet *visitedObjects); static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const QV4::Value &value); -static QVariant objectToVariant(QV4::ExecutionEngine *e, const QV4::Object *o, V4ObjectSet *visitedObjects = 0); +static QVariant objectToVariant(QV4::ExecutionEngine *e, const QV4::Object *o, V4ObjectSet *visitedObjects = nullptr); static bool convertToNativeQObject(QV4::ExecutionEngine *e, const QV4::Value &value, const QByteArray &targetType, void **result); @@ -1115,7 +1115,7 @@ static QV4::ReturnedValue variantToJS(QV4::ExecutionEngine *v4, const QVariant & QVariant ExecutionEngine::toVariant(const Value &value, int typeHint, bool createJSValueForObjects) { - return ::toVariant(this, value, typeHint, createJSValueForObjects, 0); + return ::toVariant(this, value, typeHint, createJSValueForObjects, nullptr); } @@ -1492,7 +1492,7 @@ static QV4::ReturnedValue variantMapToJS(QV4::ExecutionEngine *v4, const QVarian // Returns the value if conversion succeeded, an empty handle otherwise. QV4::ReturnedValue ExecutionEngine::metaTypeToJS(int type, const void *data) { - Q_ASSERT(data != 0); + Q_ASSERT(data != nullptr); // check if it's one of the types we know switch (QMetaType::Type(type)) { @@ -1765,7 +1765,7 @@ bool ExecutionEngine::metaTypeFromJS(const Value *value, int type, void *data) QByteArray className = name.left(name.size()-1); QV4::ScopedObject p(scope, proto.getPointer()); if (QObject *qobject = qtObjectFromJS(this, p)) - canCast = qobject->qt_metacast(className) != 0; + canCast = qobject->qt_metacast(className) != nullptr; } if (canCast) { QByteArray varTypeName = QMetaType::typeName(var.userType()); @@ -1779,7 +1779,7 @@ bool ExecutionEngine::metaTypeFromJS(const Value *value, int type, void *data) } } } else if (value->isNull() && name.endsWith('*')) { - *reinterpret_cast<void* *>(data) = 0; + *reinterpret_cast<void* *>(data) = nullptr; return true; } else if (type == qMetaTypeId<QJSValue>()) { *reinterpret_cast<QJSValue*>(data) = QJSValue(this, value->asReturnedValue()); @@ -1807,7 +1807,7 @@ static bool convertToNativeQObject(QV4::ExecutionEngine *e, const QV4::Value &va static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const QV4::Value &value) { if (!value.isObject()) - return 0; + return nullptr; QV4::Scope scope(engine); QV4::Scoped<QV4::VariantObject> v(scope, value); @@ -1820,7 +1820,7 @@ static QObject *qtObjectFromJS(QV4::ExecutionEngine *engine, const QV4::Value &v } QV4::Scoped<QV4::QObjectWrapper> wrapper(scope, value); if (!wrapper) - return 0; + return nullptr; return wrapper->object(); } diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h index da404b748f..d21b623a1e 100644 --- a/src/qml/jsruntime/qv4engine_p.h +++ b/src/qml/jsruntime/qv4engine_p.h @@ -463,7 +463,7 @@ public: StackTrace exceptionStackTrace; ReturnedValue throwError(const Value &value); - ReturnedValue catchException(StackTrace *trace = 0); + ReturnedValue catchException(StackTrace *trace = nullptr); ReturnedValue throwError(const QString &message); ReturnedValue throwSyntaxError(const QString &message); diff --git a/src/qml/jsruntime/qv4errorobject_p.h b/src/qml/jsruntime/qv4errorobject_p.h index a5ee0eb886..6b578e8c38 100644 --- a/src/qml/jsruntime/qv4errorobject_p.h +++ b/src/qml/jsruntime/qv4errorobject_p.h @@ -180,7 +180,7 @@ struct ErrorObject: Object { template<> inline const ErrorObject *Value::as() const { - return isManaged() && m()->vtable()->isErrorObject ? reinterpret_cast<const ErrorObject *>(this) : 0; + return isManaged() && m()->vtable()->isErrorObject ? reinterpret_cast<const ErrorObject *>(this) : nullptr; } struct EvalErrorObject: ErrorObject { @@ -322,7 +322,7 @@ struct URIErrorPrototype : ErrorObject inline SyntaxErrorObject *ErrorObject::asSyntaxError() { - return d()->errorType == QV4::Heap::ErrorObject::SyntaxError ? static_cast<SyntaxErrorObject *>(this) : 0; + return d()->errorType == QV4::Heap::ErrorObject::SyntaxError ? static_cast<SyntaxErrorObject *>(this) : nullptr; } diff --git a/src/qml/jsruntime/qv4executableallocator.cpp b/src/qml/jsruntime/qv4executableallocator.cpp index 64ac1267ce..6f04a712e6 100644 --- a/src/qml/jsruntime/qv4executableallocator.cpp +++ b/src/qml/jsruntime/qv4executableallocator.cpp @@ -159,7 +159,7 @@ ExecutableAllocator::~ExecutableAllocator() ExecutableAllocator::Allocation *ExecutableAllocator::allocate(size_t size) { QMutexLocker locker(&mutex); - Allocation *allocation = 0; + Allocation *allocation = nullptr; // Code is best aligned to 16-byte boundaries. size = WTF::roundUpToMultipleOf(16, size); @@ -217,7 +217,7 @@ void ExecutableAllocator::free(Allocation *allocation) if (!merged) freeAllocations.insert(allocation->size, allocation); - allocation = 0; + allocation = nullptr; if (!chunk->firstAllocation->next) { freeAllocations.remove(chunk->firstAllocation->size, chunk->firstAllocation); @@ -235,7 +235,7 @@ ExecutableAllocator::ChunkOfPages *ExecutableAllocator::chunkForAllocation(Alloc if (it != chunks.begin()) --it; if (it == chunks.end()) - return 0; + return nullptr; return *it; } diff --git a/src/qml/jsruntime/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h index 353a6eacff..375c9a365f 100644 --- a/src/qml/jsruntime/qv4executableallocator_p.h +++ b/src/qml/jsruntime/qv4executableallocator_p.h @@ -82,11 +82,8 @@ public: struct Allocation { Allocation() - : addr(0) - , size(0) + : size(0) , free(true) - , next(0) - , prev(0) {} void *start() const; @@ -103,11 +100,11 @@ public: bool mergeNext(ExecutableAllocator *allocator); bool mergePrevious(ExecutableAllocator *allocator); - quintptr addr; + quintptr addr = 0; uint size : 31; // More than 2GB of function code? nah :) uint free : 1; - Allocation *next; - Allocation *prev; + Allocation *next = nullptr; + Allocation *prev = nullptr; }; // for debugging / unit-testing @@ -117,13 +114,12 @@ public: struct ChunkOfPages { ChunkOfPages() - : pages(0) - , firstAllocation(0) + {} ~ChunkOfPages(); - WTF::PageAllocation *pages; - Allocation *firstAllocation; + WTF::PageAllocation *pages = nullptr; + Allocation *firstAllocation = nullptr; bool contains(Allocation *alloc) const; }; diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 165f1801ea..a8c1640767 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -232,7 +232,7 @@ ReturnedValue FunctionCtor::callAsConstructor(const FunctionObject *f, const Val if (!fe) return scope.engine->throwSyntaxError(QLatin1String("Parse error")); - Compiler::Module module(scope.engine->debugger() != 0); + Compiler::Module module(scope.engine->debugger() != nullptr); Compiler::JSUnitGenerator jsGenerator(&module); RuntimeCodegen cg(scope.engine, &jsGenerator, false); @@ -351,7 +351,7 @@ ReturnedValue FunctionPrototype::method_bind(const FunctionObject *b, const Valu return scope.engine->throwTypeError(); ScopedValue boundThis(scope, argc ? argv[0] : Primitive::undefinedValue()); - Scoped<MemberData> boundArgs(scope, (Heap::MemberData *)0); + Scoped<MemberData> boundArgs(scope, (Heap::MemberData *)nullptr); if (argc > 1) { boundArgs = MemberData::allocate(scope.engine, argc - 1); boundArgs->d()->values.size = argc - 1; @@ -440,7 +440,7 @@ void Heap::BoundFunction::init(QV4::ExecutionContext *scope, QV4::FunctionObject Scope s(scope); Heap::FunctionObject::init(scope, QStringLiteral("__bound function__")); this->target.set(s.engine, target->d()); - this->boundArgs.set(s.engine, boundArgs ? boundArgs->d() : 0); + this->boundArgs.set(s.engine, boundArgs ? boundArgs->d() : nullptr); this->boundThis.set(scope->engine(), boundThis); ScopedObject f(s, this); diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index abd6f2dbcb..d6066ec648 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -84,7 +84,7 @@ DECLARE_HEAP_OBJECT(FunctionObject, Object) { }; Q_QML_PRIVATE_EXPORT void init(QV4::ExecutionContext *scope, QV4::String *name, ReturnedValue (*code)(const QV4::FunctionObject *, const Value *thisObject, const Value *argv, int argc)); - void init(QV4::ExecutionContext *scope, QV4::String *name = 0, bool createProto = false); + void init(QV4::ExecutionContext *scope, QV4::String *name = nullptr, bool createProto = false); void init(QV4::ExecutionContext *scope, QV4::Function *function, bool createProto = false); void init(QV4::ExecutionContext *scope, const QString &name, bool createProto = false); void init(); @@ -179,7 +179,7 @@ struct Q_QML_EXPORT FunctionObject: Object { template<> inline const FunctionObject *Value::as() const { - return isManaged() && m()->vtable()->isFunctionObject ? reinterpret_cast<const FunctionObject *>(this) : 0; + return isManaged() && m()->vtable()->isFunctionObject ? reinterpret_cast<const FunctionObject *>(this) : nullptr; } diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 3214a716e8..f419ab53fe 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -375,12 +375,12 @@ ReturnedValue EvalFunction::evalCall(const Value *, const Value *argv, int argc, if (function->isStrict() || isStrict) { ScopedFunctionObject e(scope, FunctionObject::createScriptFunction(ctx, function)); ScopedValue thisObject(scope, directCall ? scope.engine->currentStackFrame->thisObject() : scope.engine->globalObject->asReturnedValue()); - return e->call(thisObject, 0, 0); + return e->call(thisObject, nullptr, 0); } ScopedValue thisObject(scope, scope.engine->currentStackFrame->thisObject()); - return function->call(thisObject, 0, 0, ctx); + return function->call(thisObject, nullptr, 0, ctx); } @@ -507,7 +507,7 @@ ReturnedValue GlobalFunctions::method_parseFloat(const FunctionObject *b, const QByteArray ba = trimmed.toLatin1(); bool ok; const char *begin = ba.constData(); - const char *end = 0; + const char *end = nullptr; double d = qstrtod(begin, &end, &ok); if (end - begin == 0) RETURN_RESULT(Encode(std::numeric_limits<double>::quiet_NaN())); // 3 diff --git a/src/qml/jsruntime/qv4identifier.cpp b/src/qml/jsruntime/qv4identifier.cpp index 116d4ec201..c122bcb51a 100644 --- a/src/qml/jsruntime/qv4identifier.cpp +++ b/src/qml/jsruntime/qv4identifier.cpp @@ -132,13 +132,13 @@ IdentifierHashEntry *IdentifierHash::addEntry(const Identifier *identifier) const IdentifierHashEntry *IdentifierHash::lookup(const Identifier *identifier) const { if (!d) - return 0; + return nullptr; Q_ASSERT(d->entries); uint idx = identifier->hashValue % d->alloc; while (1) { if (!d->entries[idx].identifier) - return 0; + return nullptr; if (d->entries[idx].identifier == identifier) return d->entries + idx; ++idx; @@ -149,14 +149,14 @@ const IdentifierHashEntry *IdentifierHash::lookup(const Identifier *identifier) const IdentifierHashEntry *IdentifierHash::lookup(const QString &str) const { if (!d) - return 0; + return nullptr; Q_ASSERT(d->entries); uint hash = String::createHashValue(str.constData(), str.length(), nullptr); uint idx = hash % d->alloc; while (1) { if (!d->entries[idx].identifier) - return 0; + return nullptr; if (d->entries[idx].identifier->string == str) return d->entries + idx; ++idx; @@ -167,7 +167,7 @@ const IdentifierHashEntry *IdentifierHash::lookup(const QString &str) const const IdentifierHashEntry *IdentifierHash::lookup(String *str) const { if (!d) - return 0; + return nullptr; if (str->d()->identifier) return lookup(str->d()->identifier); return lookup(str->toQString()); diff --git a/src/qml/jsruntime/qv4identifier_p.h b/src/qml/jsruntime/qv4identifier_p.h index f0ff987608..82346d5f68 100644 --- a/src/qml/jsruntime/qv4identifier_p.h +++ b/src/qml/jsruntime/qv4identifier_p.h @@ -95,9 +95,9 @@ struct IdentifierHashData struct IdentifierHash { - IdentifierHashData *d; + IdentifierHashData *d = nullptr; - IdentifierHash() : d(0) {} + IdentifierHash() {} IdentifierHash(ExecutionEngine *engine); inline IdentifierHash(const IdentifierHash &other); inline ~IdentifierHash(); diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp index 3def6defbf..b77f9478d3 100644 --- a/src/qml/jsruntime/qv4identifiertable.cpp +++ b/src/qml/jsruntime/qv4identifiertable.cpp @@ -142,7 +142,7 @@ Identifier *IdentifierTable::identifierImpl(const Heap::String *str) return str->identifier; uint hash = str->hashValue(); if (str->subtype == Heap::String::StringType_ArrayIndex) - return 0; + return nullptr; uint idx = hash % alloc; while (Heap::String *e = entries[idx]) { @@ -161,7 +161,7 @@ Identifier *IdentifierTable::identifierImpl(const Heap::String *str) Heap::String *IdentifierTable::stringFromIdentifier(Identifier *i) { if (!i) - return 0; + return nullptr; uint idx = i->hashValue % alloc; while (1) { diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp index d1ceb0a892..aaf5e3b857 100644 --- a/src/qml/jsruntime/qv4include.cpp +++ b/src/qml/jsruntime/qv4include.cpp @@ -61,7 +61,7 @@ QV4Include::QV4Include(const QUrl &url, QV4::ExecutionEngine *engine, QV4::QmlContext *qmlContext, const QV4::Value &callback) : v4(engine), m_url(url) #if QT_CONFIG(qml_network) - , m_redirectCount(0), m_network(0) , m_reply(0) + , m_redirectCount(0), m_network(nullptr) , m_reply(nullptr) #endif { if (qmlContext) @@ -88,7 +88,7 @@ QV4Include::~QV4Include() { #if QT_CONFIG(qml_network) delete m_reply; - m_reply = 0; + m_reply = nullptr; #endif } diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp index 45c0b6cfbb..69ca62cb5c 100644 --- a/src/qml/jsruntime/qv4internalclass.cpp +++ b/src/qml/jsruntime/qv4internalclass.cpp @@ -278,7 +278,7 @@ InternalClass *InternalClass::changePrototypeImpl(Heap::Object *proto) Q_ASSERT(prototype != proto); Q_ASSERT(!proto || proto->internalClass->isUsedAsProto); - Transition temp = { { nullptr }, 0, Transition::PrototypeChange }; + Transition temp = { { nullptr }, nullptr, Transition::PrototypeChange }; temp.prototype = proto; Transition &t = lookupOrInsertTransition(temp); @@ -549,7 +549,7 @@ void InternalClass::destroy() destroyStack.pop_back(); if (!next->engine) continue; - next->engine = 0; + next->engine = nullptr; next->propertyTable.~PropertyHash(); next->nameMap.~SharedInternalClassData<Identifier *>(); next->propertyData.~SharedInternalClassData<PropertyAttributes>(); diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h index 2597ec9f3f..53fc25e42b 100644 --- a/src/qml/jsruntime/qv4internalclass_p.h +++ b/src/qml/jsruntime/qv4internalclass_p.h @@ -294,10 +294,10 @@ struct InternalClass : public QQmlJS::Managed { } static void addMember(Object *object, String *string, PropertyAttributes data, uint *index); - Q_REQUIRED_RESULT InternalClass *addMember(String *string, PropertyAttributes data, uint *index = 0); - Q_REQUIRED_RESULT InternalClass *addMember(Identifier *identifier, PropertyAttributes data, uint *index = 0); - Q_REQUIRED_RESULT InternalClass *changeMember(Identifier *identifier, PropertyAttributes data, uint *index = 0); - static void changeMember(Object *object, String *string, PropertyAttributes data, uint *index = 0); + Q_REQUIRED_RESULT InternalClass *addMember(String *string, PropertyAttributes data, uint *index = nullptr); + Q_REQUIRED_RESULT InternalClass *addMember(Identifier *identifier, PropertyAttributes data, uint *index = nullptr); + Q_REQUIRED_RESULT InternalClass *changeMember(Identifier *identifier, PropertyAttributes data, uint *index = nullptr); + static void changeMember(Object *object, String *string, PropertyAttributes data, uint *index = nullptr); static void removeMember(Object *object, Identifier *id); uint find(const String *string); uint find(const Identifier *id) diff --git a/src/qml/jsruntime/qv4jscall_p.h b/src/qml/jsruntime/qv4jscall_p.h index 6d641bf9c5..c676b57c51 100644 --- a/src/qml/jsruntime/qv4jscall_p.h +++ b/src/qml/jsruntime/qv4jscall_p.h @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE namespace QV4 { struct JSCallData { - JSCallData(const Scope &scope, int argc = 0, const Value *argv = 0, const Value *thisObject = 0) + JSCallData(const Scope &scope, int argc = 0, const Value *argv = nullptr, const Value *thisObject = nullptr) : scope(scope), argc(argc) { if (thisObject) @@ -124,7 +124,7 @@ struct ScopedStackFrame { return; frame.jsFrame = reinterpret_cast<CallData *>(scope.alloc(sizeof(CallData)/sizeof(Value))); frame.jsFrame->context = context; - frame.v4Function = frame.parent ? frame.parent->v4Function : 0; + frame.v4Function = frame.parent ? frame.parent->v4Function : nullptr; scope.engine->currentStackFrame = &frame; } ~ScopedStackFrame() { diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 51802d895b..99666806be 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -634,7 +634,7 @@ struct Stringify return false; } - Stringify(ExecutionEngine *e) : v4(e), replacerFunction(0), propertyList(0), propertyListSize(0) {} + Stringify(ExecutionEngine *e) : v4(e), replacerFunction(nullptr), propertyList(nullptr), propertyListSize(0) {} QString Str(const QString &key, const Value &v); QString JA(ArrayObject *a); @@ -920,11 +920,11 @@ ReturnedValue JsonObject::method_stringify(const FunctionObject *b, const Value if (v->as<NumberObject>() || v->as<StringObject>() || v->isNumber()) *v = v->toString(scope.engine); if (!v->isString()) { - v->setM(0); + v->setM(nullptr); } else { for (uint j = 0; j <i; ++j) { if (stringify.propertyList[j].m() == v->m()) { - v->setM(0); + v->setM(nullptr); break; } } diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp index 200380eda0..b50e5f0355 100644 --- a/src/qml/jsruntime/qv4managed.cpp +++ b/src/qml/jsruntime/qv4managed.cpp @@ -46,7 +46,7 @@ using namespace QV4; const VTable Managed::static_vtbl = { - 0, + nullptr, 0, 0, Managed::IsExecutionContext, @@ -58,15 +58,15 @@ const VTable Managed::static_vtbl = 0, Managed::MyType, "Managed", - 0, - 0 /*markObjects*/, + nullptr, + nullptr /*markObjects*/, isEqualTo }; QString Managed::className() const { - const char *s = 0; + const char *s = nullptr; switch (Type(d()->vtable()->type)) { case Type_Invalid: case Type_String: diff --git a/src/qml/jsruntime/qv4memberdata_p.h b/src/qml/jsruntime/qv4memberdata_p.h index 12eaf336b9..ac9671254d 100644 --- a/src/qml/jsruntime/qv4memberdata_p.h +++ b/src/qml/jsruntime/qv4memberdata_p.h @@ -93,7 +93,7 @@ struct MemberData : Managed inline uint size() const { return d()->values.size; } - static Heap::MemberData *allocate(QV4::ExecutionEngine *e, uint n, Heap::MemberData *old = 0); + static Heap::MemberData *allocate(QV4::ExecutionEngine *e, uint n, Heap::MemberData *old = nullptr); }; } diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp index aa8e850aed..8e9bf794a9 100644 --- a/src/qml/jsruntime/qv4object.cpp +++ b/src/qml/jsruntime/qv4object.cpp @@ -94,7 +94,7 @@ void Heap::Object::setUsedAsProto() bool Object::setPrototype(Object *proto) { - Heap::Object *p = proto ? proto->d() : 0; + Heap::Object *p = proto ? proto->d() : nullptr; Heap::Object *pp = p; while (pp) { if (pp == d()) @@ -193,8 +193,8 @@ void Object::defineAccessorProperty(String *name, ReturnedValue (*getter)(const QV4::Scope scope(v4); ScopedProperty p(scope); ExecutionContext *global = v4->rootContext(); - p->setGetter(ScopedFunctionObject(scope, (getter ? FunctionObject::createBuiltinFunction(global, name, getter) : 0))); - p->setSetter(ScopedFunctionObject(scope, (setter ? FunctionObject::createBuiltinFunction(global, name, setter) : 0))); + p->setGetter(ScopedFunctionObject(scope, (getter ? FunctionObject::createBuiltinFunction(global, name, getter) : nullptr))); + p->setSetter(ScopedFunctionObject(scope, (setter ? FunctionObject::createBuiltinFunction(global, name, setter) : nullptr))); insertMember(name, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); } @@ -321,7 +321,7 @@ MemberData::Index Object::getValueOrSetter(String *name, PropertyAttributes *att o = o->prototype(); } *attrs = Attr_Invalid; - return { 0, 0 }; + return { nullptr, nullptr }; } ArrayData::Index Object::getValueOrSetter(uint index, PropertyAttributes *attrs) @@ -346,7 +346,7 @@ ArrayData::Index Object::getValueOrSetter(uint index, PropertyAttributes *attrs) o = o->prototype(); } *attrs = Attr_Invalid; - return { 0, 0 }; + return { nullptr, 0 }; } bool Object::hasProperty(String *name) const @@ -484,7 +484,7 @@ bool Object::deleteIndexedProperty(Managed *m, uint index) void Object::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *pd, PropertyAttributes *attrs) { Object *o = static_cast<Object *>(m); - name->setM(0); + name->setM(nullptr); *index = UINT_MAX; if (o->arrayData()) { @@ -508,7 +508,7 @@ void Object::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint * return; } } - it->arrayNode = 0; + it->arrayNode = nullptr; it->arrayIndex = UINT_MAX; } // dense arrays @@ -628,7 +628,7 @@ bool Object::internalPut(String *name, const Value &value) name->makeIdentifier(); Identifier *id = name->identifier(); - MemberData::Index memberIndex{0, 0}; + MemberData::Index memberIndex{nullptr, nullptr}; uint member = internalClass()->find(id); PropertyAttributes attrs; if (member < UINT_MAX) { @@ -704,7 +704,7 @@ bool Object::internalPutIndexed(uint index, const Value &value) PropertyAttributes attrs; - ArrayData::Index arrayIndex = arrayData() ? arrayData()->getValueOrSetter(index, &attrs) : ArrayData::Index{ 0, 0 }; + ArrayData::Index arrayIndex = arrayData() ? arrayData()->getValueOrSetter(index, &attrs) : ArrayData::Index{ nullptr, 0 }; if (arrayIndex.isNull() && isStringObject()) { if (index < static_cast<StringObject *>(this)->length()) @@ -898,7 +898,7 @@ bool Object::defineOwnProperty2(ExecutionEngine *engine, uint index, const Prope return true; } - return __defineOwnProperty__(engine, index, 0, p, attrs); + return __defineOwnProperty__(engine, index, nullptr, p, attrs); } bool Object::__defineOwnProperty__(ExecutionEngine *engine, uint index, String *member, const Property *p, PropertyAttributes attrs) @@ -949,8 +949,8 @@ bool Object::__defineOwnProperty__(ExecutionEngine *engine, uint index, String * Q_ASSERT(arrayData()); setArrayAttributes(index, cattrs); } - current->setGetter(0); - current->setSetter(0); + current->setGetter(nullptr); + current->setSetter(nullptr); } else { // 9c cattrs.setType(PropertyAttributes::Data); diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h index db57d1cf3f..1731ae3c76 100644 --- a/src/qml/jsruntime/qv4object_p.h +++ b/src/qml/jsruntime/qv4object_p.h @@ -236,8 +236,8 @@ struct Q_QML_EXPORT Object: Managed { Heap::Object *prototype() const { return d()->prototype(); } bool setPrototype(Object *proto); - void getOwnProperty(String *name, PropertyAttributes *attrs, Property *p = 0); - void getOwnProperty(uint index, PropertyAttributes *attrs, Property *p = 0); + void getOwnProperty(String *name, PropertyAttributes *attrs, Property *p = nullptr); + void getOwnProperty(uint index, PropertyAttributes *attrs, Property *p = nullptr); MemberData::Index getValueOrSetter(String *name, PropertyAttributes *attrs); ArrayData::Index getValueOrSetter(uint index, PropertyAttributes *attrs); @@ -346,8 +346,8 @@ public: } void initSparseArray(); - SparseArrayNode *sparseBegin() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->begin() : 0; } - SparseArrayNode *sparseEnd() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->end() : 0; } + SparseArrayNode *sparseBegin() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->begin() : nullptr; } + SparseArrayNode *sparseEnd() { return arrayType() == Heap::ArrayData::Sparse ? d()->arrayData->sparse->end() : nullptr; } inline bool protoHasArray() { Scope scope(engine()); @@ -360,9 +360,9 @@ public: return false; } - inline ReturnedValue get(String *name, bool *hasProperty = 0) const + inline ReturnedValue get(String *name, bool *hasProperty = nullptr) const { return vtable()->get(this, name, hasProperty); } - inline ReturnedValue getIndexed(uint idx, bool *hasProperty = 0) const + inline ReturnedValue getIndexed(uint idx, bool *hasProperty = nullptr) const { return vtable()->getIndexed(this, idx, hasProperty); } // use the set variants instead, to customize throw behavior @@ -551,7 +551,7 @@ inline void Object::arraySet(uint index, const Value &value) template<> inline const ArrayObject *Value::as() const { - return isManaged() && m()->vtable()->type == Managed::Type_ArrayObject ? static_cast<const ArrayObject *>(this) : 0; + return isManaged() && m()->vtable()->type == Managed::Type_ArrayObject ? static_cast<const ArrayObject *>(this) : nullptr; } #ifndef V4_BOOTSTRAP diff --git a/src/qml/jsruntime/qv4objectiterator.cpp b/src/qml/jsruntime/qv4objectiterator.cpp index 0394c704f9..7bf7e1aa04 100644 --- a/src/qml/jsruntime/qv4objectiterator.cpp +++ b/src/qml/jsruntime/qv4objectiterator.cpp @@ -47,8 +47,8 @@ using namespace QV4; void ObjectIterator::init(const Object *o) { - object->setM(o ? o->m() : 0); - current->setM(o ? o->m() : 0); + object->setM(o ? o->m() : nullptr); + current->setM(o ? o->m() : nullptr); if (object->as<ArgumentsObject>()) { Scope scope(engine); @@ -58,7 +58,7 @@ void ObjectIterator::init(const Object *o) void ObjectIterator::next(Value *name, uint *index, Property *pd, PropertyAttributes *attrs) { - name->setM(0); + name->setM(nullptr); *index = UINT_MAX; if (!object->as<Object>()) { @@ -100,7 +100,7 @@ void ObjectIterator::next(Value *name, uint *index, Property *pd, PropertyAttrib if (flags & WithProtoChain) current->setM(co->prototype()); else - current->setM(0); + current->setM(nullptr); arrayIndex = 0; memberIndex = 0; diff --git a/src/qml/jsruntime/qv4objectiterator_p.h b/src/qml/jsruntime/qv4objectiterator_p.h index 3e501f23ce..744d16301a 100644 --- a/src/qml/jsruntime/qv4objectiterator_p.h +++ b/src/qml/jsruntime/qv4objectiterator_p.h @@ -101,7 +101,7 @@ struct Q_QML_EXPORT ObjectIterator: ObjectIteratorData init(o); } - void next(Value *name, uint *index, Property *pd, PropertyAttributes *attributes = 0); + void next(Value *name, uint *index, Property *pd, PropertyAttributes *attributes = nullptr); ReturnedValue nextPropertyName(Value *value); ReturnedValue nextPropertyNameAsString(Value *value); ReturnedValue nextPropertyNameAsString(); diff --git a/src/qml/jsruntime/qv4objectproto.cpp b/src/qml/jsruntime/qv4objectproto.cpp index a86352be40..b998b78520 100644 --- a/src/qml/jsruntime/qv4objectproto.cpp +++ b/src/qml/jsruntime/qv4objectproto.cpp @@ -638,7 +638,7 @@ ReturnedValue ObjectPrototype::method_set_proto(const FunctionObject *b, const V THROW_TYPE_ERROR(); if (argv[0].isNull()) { - o->setPrototype(0); + o->setPrototype(nullptr); RETURN_UNDEFINED(); } diff --git a/src/qml/jsruntime/qv4persistent.cpp b/src/qml/jsruntime/qv4persistent.cpp index 973541553a..7fc74173e3 100644 --- a/src/qml/jsruntime/qv4persistent.cpp +++ b/src/qml/jsruntime/qv4persistent.cpp @@ -172,7 +172,7 @@ Value &PersistentValueStorage::Iterator::operator *() PersistentValueStorage::PersistentValueStorage(ExecutionEngine *engine) : engine(engine), - firstPage(0) + firstPage(nullptr) { } @@ -185,9 +185,9 @@ PersistentValueStorage::~PersistentValueStorage() p->values[i] = Encode::undefined(); } Page *n = p->header.next; - p->header.engine = 0; - p->header.prev = 0; - p->header.next = 0; + p->header.engine = nullptr; + p->header.prev = nullptr; + p->header.next = nullptr; Q_ASSERT(p->header.refCount); p = n; } @@ -260,7 +260,7 @@ void PersistentValueStorage::freePage(void *page) PersistentValue::PersistentValue(const PersistentValue &other) - : val(0) + : val(nullptr) { if (other.val) { val = other.engine()->memoryManager->m_persistentValues->allocate(); @@ -281,7 +281,7 @@ PersistentValue::PersistentValue(ExecutionEngine *engine, ReturnedValue value) } PersistentValue::PersistentValue(ExecutionEngine *engine, Object *object) - : val(0) + : val(nullptr) { if (!object) return; @@ -358,7 +358,7 @@ void PersistentValue::set(ExecutionEngine *engine, Heap::Base *obj) } WeakValue::WeakValue(const WeakValue &other) - : val(0) + : val(nullptr) { if (other.val) { allocVal(other.engine()); @@ -418,6 +418,6 @@ void WeakValue::free() PersistentValueStorage::free(val); } - val = 0; + val = nullptr; } diff --git a/src/qml/jsruntime/qv4persistent_p.h b/src/qml/jsruntime/qv4persistent_p.h index 1f838f5531..55e8eefcb7 100644 --- a/src/qml/jsruntime/qv4persistent_p.h +++ b/src/qml/jsruntime/qv4persistent_p.h @@ -81,7 +81,7 @@ struct Q_QML_EXPORT PersistentValueStorage Value &operator *(); }; Iterator begin() { return Iterator(firstPage, 0); } - Iterator end() { return Iterator(0, 0); } + Iterator end() { return Iterator(nullptr, 0); } static ExecutionEngine *getEngine(Value *v); @@ -94,7 +94,7 @@ private: class Q_QML_EXPORT PersistentValue { public: - PersistentValue() : val(0) {} + PersistentValue() {} PersistentValue(const PersistentValue &other); PersistentValue &operator=(const PersistentValue &other); PersistentValue &operator=(const WeakValue &other); @@ -117,19 +117,19 @@ public: } Managed *asManaged() const { if (!val) - return 0; + return nullptr; return val->managed(); } template<typename T> T *as() const { if (!val) - return 0; + return nullptr; return val->as<T>(); } ExecutionEngine *engine() const { if (!val) - return 0; + return nullptr; return PersistentValueStorage::getEngine(val); } @@ -137,18 +137,18 @@ public: bool isNullOrUndefined() const { return !val || val->isNullOrUndefined(); } void clear() { PersistentValueStorage::free(val); - val = 0; + val = nullptr; } bool isEmpty() { return !val; } private: - Value *val; + Value *val = nullptr; }; class Q_QML_EXPORT WeakValue { public: - WeakValue() : val(0) {} + WeakValue() {} WeakValue(const WeakValue &other); WeakValue(ExecutionEngine *engine, const Value &value); WeakValue &operator=(const WeakValue &other); @@ -183,19 +183,19 @@ public: } Managed *asManaged() const { if (!val) - return 0; + return nullptr; return val->managed(); } template <typename T> T *as() const { if (!val) - return 0; + return nullptr; return val->as<T>(); } ExecutionEngine *engine() const { if (!val) - return 0; + return nullptr; return PersistentValueStorage::getEngine(val); } @@ -206,7 +206,7 @@ public: void markOnce(MarkStack *markStack); private: - Value *val; + Value *val = nullptr; private: Q_NEVER_INLINE void allocVal(ExecutionEngine *engine); diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h index 66227fe733..8461384e9a 100644 --- a/src/qml/jsruntime/qv4profiling_p.h +++ b/src/qml/jsruntime/qv4profiling_p.h @@ -139,7 +139,7 @@ struct MemoryAllocationProperties { class FunctionCall { public: - FunctionCall() : m_function(0), m_start(0), m_end(0) + FunctionCall() : m_function(nullptr), m_start(0), m_end(0) { Q_ASSERT_X(false, Q_FUNC_INFO, "Cannot construct a function call without function"); } FunctionCall(Function *function, qint64 start, qint64 end) : @@ -276,7 +276,7 @@ public: // It's enough to ref() the function in the destructor as it will probably not disappear while // it's executing ... FunctionCallProfiler(ExecutionEngine *engine, Function *f) - : profiler(0) + : profiler(nullptr) { Profiler *p = engine->profiler(); if (Q_UNLIKELY(p) && (p->featuresEnabled & (1 << Profiling::FeatureFunctionCall))) { diff --git a/src/qml/jsruntime/qv4property_p.h b/src/qml/jsruntime/qv4property_p.h index 2a5b6f7f74..7cb106c424 100644 --- a/src/qml/jsruntime/qv4property_p.h +++ b/src/qml/jsruntime/qv4property_p.h @@ -84,7 +84,7 @@ struct Property { inline Heap::FunctionObject *getter() const { return reinterpret_cast<Heap::FunctionObject *>(value.heapObject()); } inline Heap::FunctionObject *setter() const { return reinterpret_cast<Heap::FunctionObject *>(set.heapObject()); } inline void setGetter(FunctionObject *g) { value = reinterpret_cast<Managed *>(g); } - inline void setSetter(FunctionObject *s) { set = (s ? reinterpret_cast<Managed *>(s) : 0); } + inline void setSetter(FunctionObject *s) { set = (s ? reinterpret_cast<Managed *>(s) : nullptr); } void copy(const Property *other, PropertyAttributes attrs) { value = other->value; @@ -92,7 +92,7 @@ struct Property { set = other->set; } - explicit Property() { value = Encode::undefined(); set = Value::fromHeapObject(0); } + explicit Property() { value = Encode::undefined(); set = Value::fromHeapObject(nullptr); } Property(Heap::FunctionObject *getter, Heap::FunctionObject *setter) { value.setM(reinterpret_cast<Heap::Base *>(getter)); set.setM(reinterpret_cast<Heap::Base *>(setter)); diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp index cf4ef68bc0..040f060476 100644 --- a/src/qml/jsruntime/qv4qmlcontext.cpp +++ b/src/qml/jsruntime/qv4qmlcontext.cpp @@ -202,7 +202,7 @@ ReturnedValue QQmlContextWrapper::get(const Managed *m, String *name, bool *hasP return result->asReturnedValue(); } } - scopeObject = 0; + scopeObject = nullptr; // Search context object @@ -272,7 +272,7 @@ bool QQmlContextWrapper::put(Managed *m, String *name, const Value &value) if (scopeObject && QV4::QObjectWrapper::setQmlProperty(v4, context, scopeObject, name, QV4::QObjectWrapper::CheckRevision, value)) return true; - scopeObject = 0; + scopeObject = nullptr; // Search context object if (context->contextObject && @@ -312,7 +312,7 @@ Heap::QmlContext *QmlContext::createWorkerContext(ExecutionContext *parent, cons context->isInternal = true; context->isJSContext = true; - Scoped<QQmlContextWrapper> qml(scope, scope.engine->memoryManager->allocObject<QQmlContextWrapper>(context, (QObject*)0)); + Scoped<QQmlContextWrapper> qml(scope, scope.engine->memoryManager->allocObject<QQmlContextWrapper>(context, (QObject*)nullptr)); qml->d()->isNullWrapper = true; qml->setReadOnly(false); diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp index 33298f5d98..f555740455 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper.cpp +++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp @@ -103,7 +103,7 @@ QPair<QObject *, int> QObjectMethod::extractQtMethod(const QV4::FunctionObject * return qMakePair(method->object(), method->methodIndex()); } - return qMakePair((QObject *)0, -1); + return qMakePair((QObject *)nullptr, -1); } static QPair<QObject *, int> extractQtSignal(const Value &value) @@ -120,7 +120,7 @@ static QPair<QObject *, int> extractQtSignal(const Value &value) return qMakePair(handler->object(), handler->signalIndex()); } - return qMakePair((QObject *)0, -1); + return qMakePair((QObject *)nullptr, -1); } static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object, @@ -130,7 +130,7 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object QV4::Scope scope(v4); if (property.isQObject()) { - QObject *rv = 0; + QObject *rv = nullptr; property.readProperty(object, &rv); return QV4::QObjectWrapper::wrap(v4, rv); } else if (property.isQList()) { @@ -200,7 +200,7 @@ static QV4::ReturnedValue loadProperty(QV4::ExecutionEngine *v4, QObject *object "'%s::%s'", p.typeName(), object->metaObject()->className(), p.name()); return QV4::Encode::undefined(); } else { - QVariant v(property.propType(), (void *)0); + QVariant v(property.propType(), (void *)nullptr); property.readProperty(object, v.data()); return scope.engine->fromVariant(v); } @@ -223,7 +223,7 @@ QQmlPropertyData *QObjectWrapper::findProperty(ExecutionEngine *engine, QObject Q_UNUSED(revisionMode); QQmlData *ddata = QQmlData::get(o, false); - QQmlPropertyData *result = 0; + QQmlPropertyData *result = nullptr; if (ddata && ddata->propertyCache) result = ddata->propertyCache->property(name, o, qmlContext); else @@ -255,7 +255,7 @@ ReturnedValue QObjectWrapper::getProperty(ExecutionEngine *engine, QObject *obje } } - QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0; + QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : nullptr; if (captureRequired && ep && ep->propertyCapture && !property->isConstant()) ep->propertyCapture->captureProperty(object, property->coreIndex(), property->notifyIndex()); @@ -440,7 +440,7 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, QQmlP return; } - QQmlBinding *newBinding = 0; + QQmlBinding *newBinding = nullptr; QV4::Scope scope(engine); QV4::ScopedFunctionObject f(scope, value); if (f) { @@ -502,9 +502,9 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, QQmlP QMetaObject::metacall(object, QMetaObject::WriteProperty, property->coreIndex(), argv); if (value.isNull() && property->isQObject()) { - PROPERTY_STORE(QObject*, 0); + PROPERTY_STORE(QObject*, nullptr); } else if (value.isUndefined() && property->isResettable()) { - void *a[] = { 0 }; + void *a[] = { nullptr }; QMetaObject::metacall(object, QMetaObject::ResetProperty, property->coreIndex(), a); } else if (value.isUndefined() && property->propType() == qMetaTypeId<QVariant>()) { PROPERTY_STORE(QVariant, QVariant()); @@ -537,7 +537,7 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, QQmlP Q_ASSERT(vmemo); vmemo->setVMEProperty(property->coreIndex(), value); } else if (property->propType() == qMetaTypeId<QQmlScriptString>() && (value.isUndefined() || value.isPrimitive())) { - QQmlScriptString ss(value.toQStringNoThrow(), 0 /* context */, object); + QQmlScriptString ss(value.toQStringNoThrow(), nullptr /* context */, object); if (value.isNumber()) { ss.d->numberValue = value.toNumber(); ss.d->isNumberLiteral = true; @@ -555,7 +555,7 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, QQmlP QQmlContextData *callingQmlContext = scope.engine->callingQmlContext(); if (!QQmlPropertyPrivate::write(object, *property, v, callingQmlContext)) { - const char *valueType = 0; + const char *valueType = nullptr; if (v.userType() == QVariant::Invalid) valueType = "null"; else valueType = QMetaType::typeName(v.userType()); @@ -596,7 +596,7 @@ ReturnedValue QObjectWrapper::wrap_slowPath(ExecutionEngine *engine, QObject *ob } else { // If this object is tainted, we have to check to see if it is in our // tainted object list - ScopedObject alternateWrapper(scope, (Object *)0); + ScopedObject alternateWrapper(scope, (Object *)nullptr); if (engine->m_multiplyWrappedQObjects && ddata->hasTaintedV4Object) alternateWrapper = engine->m_multiplyWrappedQObjects->value(object); @@ -742,7 +742,7 @@ void QObjectWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value *name static const int destroyedIdx2 = QObject::staticMetaObject.indexOfSignal("destroyed()"); static const int deleteLaterIdx = QObject::staticMetaObject.indexOfSlot("deleteLater()"); - name->setM(0); + name->setM(nullptr); *index = UINT_MAX; QObjectWrapper *that = static_cast<QObjectWrapper*>(m); @@ -819,7 +819,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase break; QQmlMetaObject::ArgTypeStorage storage; - int *argsTypes = QQmlMetaObject(r).methodParameterTypes(This->signalIndex, &storage, 0); + int *argsTypes = QQmlMetaObject(r).methodParameterTypes(This->signalIndex, &storage, nullptr); int argCount = argsTypes ? argsTypes[0]:0; @@ -848,7 +848,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase QQmlEnginePrivate::get(qmlEngine)->warning(error); } else { QMessageLogger(error.url().toString().toLatin1().constData(), - error.line(), 0).warning().noquote() + error.line(), nullptr).warning().noquote() << error.toString(); } } @@ -1058,8 +1058,8 @@ void QObjectWrapper::destroyObject(bool lastCall) if (ddata && ddata->ownContext) { Q_ASSERT(ddata->ownContext == ddata->context); ddata->ownContext->emitDestruction(); - ddata->ownContext = 0; - ddata->context = 0; + ddata->ownContext = nullptr; + ddata->context = nullptr; } // This object is notionally destroyed now ddata->isQueuedForDeletion = true; @@ -1187,7 +1187,7 @@ static QV4::ReturnedValue CallMethod(const QQmlObjectOrGadget &object, int index } else { - void *args[] = { 0 }; + void *args[] = { nullptr }; object.metacall(callType, index, args); return Encode::undefined(); @@ -1360,7 +1360,7 @@ static const QQmlPropertyData * RelatedMethod(const QQmlObjectOrGadget &object, const QQmlPropertyCache *propertyCache) { if (!current->isOverload()) - return 0; + return nullptr; Q_ASSERT(!current->overrideIndexIsProperty()); @@ -1378,7 +1378,7 @@ static const QQmlPropertyData * RelatedMethod(const QQmlObjectOrGadget &object, // If we've been called before with the same override index, then // we can't go any further... if (&dummy == current && dummy.coreIndex() == current->overrideIndex()) - return 0; + return nullptr; QMetaMethod method = mo->method(current->overrideIndex()); dummy.load(method); @@ -1413,7 +1413,7 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ if (data.hasArguments()) { - int *args = 0; + int *args = nullptr; QQmlMetaObject::ArgTypeStorage storage; if (data.isConstructor()) @@ -1436,7 +1436,7 @@ static QV4::ReturnedValue CallPrecise(const QQmlObjectOrGadget &object, const QQ } else { - return CallMethod(object, data.coreIndex(), returnType, 0, 0, engine, callArgs, callType); + return CallMethod(object, data.coreIndex(), returnType, 0, nullptr, engine, callArgs, callType); } } @@ -1473,9 +1473,9 @@ static QV4::ReturnedValue CallOverloaded(const QQmlObjectOrGadget &object, const do { QQmlMetaObject::ArgTypeStorage storage; int methodArgumentCount = 0; - int *methodArgTypes = 0; + int *methodArgTypes = nullptr; if (attempt->hasArguments()) { - int *args = object.methodParameterTypes(attempt->coreIndex(), &storage, 0); + int *args = object.methodParameterTypes(attempt->coreIndex(), &storage, nullptr); if (!args) // Must be an unknown argument continue; @@ -1503,7 +1503,7 @@ static QV4::ReturnedValue CallOverloaded(const QQmlObjectOrGadget &object, const if (bestParameterScore == 0 && bestMatchScore == 0) break; // We can't get better than that - } while ((attempt = RelatedMethod(object, attempt, dummy, propertyCache)) != 0); + } while ((attempt = RelatedMethod(object, attempt, dummy, propertyCache)) != nullptr); if (best.isValid()) { return CallPrecise(object, best, engine, callArgs, callType); @@ -1570,7 +1570,7 @@ void *CallArgument::dataPtr() return stdVectorQModelIndexPtr; else if (type != 0) return (void *)&allocData; - return 0; + return nullptr; } void CallArgument::initAsType(int callType) @@ -1588,7 +1588,7 @@ void CallArgument::initAsType(int callType) callType == QMetaType::Float) { type = callType; } else if (callType == QMetaType::QObjectStar) { - qobjectPtr = 0; + qobjectPtr = nullptr; type = callType; } else if (callType == QMetaType::QString) { qstringPtr = new (&allocData) QString(); @@ -1613,7 +1613,7 @@ void CallArgument::initAsType(int callType) jsonValuePtr = new (&allocData) QJsonValue(); } else { type = -1; - qvariantPtr = new (&allocData) QVariant(callType, (void *)0); + qvariantPtr = new (&allocData) QVariant(callType, (void *)nullptr); } } @@ -1667,7 +1667,7 @@ void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q qstringPtr = new (&allocData) QString(value.toQStringNoThrow()); type = callType; } else if (callType == QMetaType::QObjectStar) { - qobjectPtr = 0; + qobjectPtr = nullptr; if (const QV4::QObjectWrapper *qobjectWrapper = value.as<QV4::QObjectWrapper>()) qobjectPtr = qobjectWrapper->object(); else if (const QV4::QQmlTypeWrapper *qmlTypeWrapper = value.as<QV4::QQmlTypeWrapper>()) @@ -1684,14 +1684,14 @@ void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q uint length = array->getLength(); for (uint ii = 0; ii < length; ++ii) { - QObject *o = 0; + QObject *o = nullptr; qobjectWrapper = array->getIndexed(ii); if (!!qobjectWrapper) o = qobjectWrapper->object(); qlistPtr->append(o); } } else { - QObject *o = 0; + QObject *o = nullptr; if (const QV4::QObjectWrapper *qobjectWrapper = value.as<QV4::QObjectWrapper>()) o = qobjectWrapper->object(); qlistPtr->append(o); @@ -1750,7 +1750,7 @@ void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q qvariantPtr = new (&allocData) QVariant(); type = -1; - QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0; + QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : nullptr; QVariant v = scope.engine->toVariant(value, callType); if (v.userType() == callType) { @@ -1763,12 +1763,12 @@ void CallArgument::fromValue(int callType, QV4::ExecutionEngine *engine, const Q if (!mo.isNull()) { QObject *obj = ep->toQObject(v); - if (obj != 0 && !QQmlMetaObject::canConvert(obj, mo)) - obj = 0; + if (obj != nullptr && !QQmlMetaObject::canConvert(obj, mo)) + obj = nullptr; *qvariantPtr = QVariant(callType, &obj); } else { - *qvariantPtr = QVariant(callType, (void *)0); + *qvariantPtr = QVariant(callType, (void *)nullptr); } } } @@ -1967,7 +1967,7 @@ ReturnedValue QObjectMethod::callInternal(const Value *thisObject, const Value * QQmlV4Function func(callData, rv, v4); QQmlV4Function *funcptr = &func; - void *args[] = { 0, &funcptr }; + void *args[] = { nullptr, &funcptr }; object.metacall(QMetaObject::InvokeMetaMethod, method.coreIndex(), args); return rv->asReturnedValue(); @@ -2099,9 +2099,9 @@ ReturnedValue QMetaObjectWrapper::callOverloadedConstructor(QV4::ExecutionEngine const QQmlPropertyData & attempt = d()->constructors[i]; QQmlMetaObject::ArgTypeStorage storage; int methodArgumentCount = 0; - int *methodArgTypes = 0; + int *methodArgTypes = nullptr; if (attempt.hasArguments()) { - int *args = object.constructorParameterTypes(attempt.coreIndex(), &storage, 0); + int *args = object.constructorParameterTypes(attempt.coreIndex(), &storage, nullptr); if (!args) // Must be an unknown argument continue; diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h index 28717b5d80..1455acc1b3 100644 --- a/src/qml/jsruntime/qv4qobjectwrapper_p.h +++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h @@ -166,8 +166,8 @@ struct Q_QML_EXPORT QObjectWrapper : public Object QObject *object() const { return d()->object(); } - ReturnedValue getQmlProperty(QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, bool *hasProperty = 0, bool includeImports = false) const; - static ReturnedValue getQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, bool *hasProperty = 0); + ReturnedValue getQmlProperty(QQmlContextData *qmlContext, String *name, RevisionMode revisionMode, bool *hasProperty = nullptr, bool includeImports = false) const; + static ReturnedValue getQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, bool *hasProperty = nullptr); static bool setQmlProperty(ExecutionEngine *engine, QQmlContextData *qmlContext, QObject *object, String *name, RevisionMode revisionMode, const Value &value); diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp index 36616bc024..d99536829b 100644 --- a/src/qml/jsruntime/qv4regexp.cpp +++ b/src/qml/jsruntime/qv4regexp.cpp @@ -48,7 +48,7 @@ RegExpCache::~RegExpCache() { for (RegExpCache::Iterator it = begin(), e = end(); it != e; ++it) { if (RegExp *re = it.value().as<RegExp>()) - re->d()->cache = 0; + re->d()->cache = nullptr; } } @@ -100,7 +100,7 @@ void Heap::RegExp::init(ExecutionEngine *engine, const QString &pattern, bool ig valid = false; - const char* error = 0; + const char* error = nullptr; JSC::Yarr::YarrPattern yarrPattern(WTF::String(pattern), ignoreCase, multiLine, &error); if (error) return; diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp index 9a5afdf308..000e2c3a7e 100644 --- a/src/qml/jsruntime/qv4regexpobject.cpp +++ b/src/qml/jsruntime/qv4regexpobject.cpp @@ -283,25 +283,25 @@ void RegExpPrototype::init(ExecutionEngine *engine, Object *constructor) ctor->defineReadonlyProperty(engine->id_length(), Primitive::fromInt32(2)); // Properties deprecated in the spec but required by "the web" :( - ctor->defineAccessorProperty(QStringLiteral("lastMatch"), method_get_lastMatch_n<0>, 0); - ctor->defineAccessorProperty(QStringLiteral("$&"), method_get_lastMatch_n<0>, 0); - ctor->defineAccessorProperty(QStringLiteral("$1"), method_get_lastMatch_n<1>, 0); - ctor->defineAccessorProperty(QStringLiteral("$2"), method_get_lastMatch_n<2>, 0); - ctor->defineAccessorProperty(QStringLiteral("$3"), method_get_lastMatch_n<3>, 0); - ctor->defineAccessorProperty(QStringLiteral("$4"), method_get_lastMatch_n<4>, 0); - ctor->defineAccessorProperty(QStringLiteral("$5"), method_get_lastMatch_n<5>, 0); - ctor->defineAccessorProperty(QStringLiteral("$6"), method_get_lastMatch_n<6>, 0); - ctor->defineAccessorProperty(QStringLiteral("$7"), method_get_lastMatch_n<7>, 0); - ctor->defineAccessorProperty(QStringLiteral("$8"), method_get_lastMatch_n<8>, 0); - ctor->defineAccessorProperty(QStringLiteral("$9"), method_get_lastMatch_n<9>, 0); - ctor->defineAccessorProperty(QStringLiteral("lastParen"), method_get_lastParen, 0); - ctor->defineAccessorProperty(QStringLiteral("$+"), method_get_lastParen, 0); - ctor->defineAccessorProperty(QStringLiteral("input"), method_get_input, 0); - ctor->defineAccessorProperty(QStringLiteral("$_"), method_get_input, 0); - ctor->defineAccessorProperty(QStringLiteral("leftContext"), method_get_leftContext, 0); - ctor->defineAccessorProperty(QStringLiteral("$`"), method_get_leftContext, 0); - ctor->defineAccessorProperty(QStringLiteral("rightContext"), method_get_rightContext, 0); - ctor->defineAccessorProperty(QStringLiteral("$'"), method_get_rightContext, 0); + ctor->defineAccessorProperty(QStringLiteral("lastMatch"), method_get_lastMatch_n<0>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$&"), method_get_lastMatch_n<0>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$1"), method_get_lastMatch_n<1>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$2"), method_get_lastMatch_n<2>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$3"), method_get_lastMatch_n<3>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$4"), method_get_lastMatch_n<4>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$5"), method_get_lastMatch_n<5>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$6"), method_get_lastMatch_n<6>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$7"), method_get_lastMatch_n<7>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$8"), method_get_lastMatch_n<8>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$9"), method_get_lastMatch_n<9>, nullptr); + ctor->defineAccessorProperty(QStringLiteral("lastParen"), method_get_lastParen, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$+"), method_get_lastParen, nullptr); + ctor->defineAccessorProperty(QStringLiteral("input"), method_get_input, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$_"), method_get_input, nullptr); + ctor->defineAccessorProperty(QStringLiteral("leftContext"), method_get_leftContext, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$`"), method_get_leftContext, nullptr); + ctor->defineAccessorProperty(QStringLiteral("rightContext"), method_get_rightContext, nullptr); + ctor->defineAccessorProperty(QStringLiteral("$'"), method_get_rightContext, nullptr); defineDefaultProperty(QStringLiteral("constructor"), (o = ctor)); defineDefaultProperty(QStringLiteral("exec"), method_exec, 1); diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index eb4f6a21fc..04cad8ddb7 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -382,11 +382,11 @@ double RuntimeHelpers::stringToNumber(const QString &string) { const QStringRef s = QStringRef(&string).trimmed(); if (s.startsWith(QLatin1String("0x")) || s.startsWith(QLatin1String("0X"))) - return s.toLong(0, 16); + return s.toLong(nullptr, 16); bool ok; QByteArray ba = s.toLatin1(); const char *begin = ba.constData(); - const char *end = 0; + const char *end = nullptr; double d = qstrtod(begin, &end, &ok); if (end - begin != ba.size()) { if (ba == "Infinity" || ba == "+Infinity") @@ -457,7 +457,7 @@ Heap::Object *RuntimeHelpers::convertToObject(ExecutionEngine *engine, const Val case Value::Undefined_Type: case Value::Null_Type: engine->throwTypeError(); - return 0; + return nullptr; case Value::Boolean_Type: return engine->newBooleanObject(value.booleanValue()); case Value::Managed_Type: @@ -680,7 +680,7 @@ bool Runtime::method_storeElement(ExecutionEngine *engine, const Value &object, ReturnedValue Runtime::method_foreachIterator(ExecutionEngine *engine, const Value &in) { Scope scope(engine); - ScopedObject o(scope, (Object *)0); + ScopedObject o(scope, (Object *)nullptr); if (!in.isNullOrUndefined()) o = in.toObject(engine); return engine->newForEachIteratorObject(o)->asReturnedValue(); @@ -1199,7 +1199,7 @@ ReturnedValue Runtime::method_createCatchContext(ExecutionContext *parent, int e { ExecutionEngine *e = parent->engine(); return parent->newCatchContext(e->currentStackFrame->v4Function->compilationUnit->runtimeStrings[exceptionVarNameIndex], - e->catchException(0))->asReturnedValue(); + e->catchException(nullptr))->asReturnedValue(); } void Runtime::method_declareVar(ExecutionEngine *engine, bool deletable, int nameIndex) @@ -1299,7 +1299,7 @@ ReturnedValue Runtime::method_loadQmlIdObject(ExecutionEngine *engine, const Val if (!context || index >= (uint)context->idValueCount) return Encode::undefined(); - QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : 0; + QQmlEnginePrivate *ep = engine->qmlEngine() ? QQmlEnginePrivate::get(engine->qmlEngine()) : nullptr; if (ep && ep->propertyCapture) ep->propertyCapture->captureProperty(&context->idValues[index].bindings); diff --git a/src/qml/jsruntime/qv4runtimecodegen.cpp b/src/qml/jsruntime/qv4runtimecodegen.cpp index 662a780e71..fe18ddf9ed 100644 --- a/src/qml/jsruntime/qv4runtimecodegen.cpp +++ b/src/qml/jsruntime/qv4runtimecodegen.cpp @@ -50,15 +50,15 @@ void RuntimeCodegen::generateFromFunctionExpression(const QString &fileName, _module = module; _module->fileName = fileName; _module->finalUrl = fileName; - _context = 0; + _context = nullptr; Compiler::ScanFunctions scan(this, sourceCode, Compiler::GlobalCode); // fake a global environment - scan.enterEnvironment(0, Compiler::FunctionCode); + scan.enterEnvironment(nullptr, Compiler::FunctionCode); scan(ast); scan.leaveEnvironment(); - int index = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : 0); + int index = defineFunction(ast->name.toString(), ast, ast->formals, ast->body ? ast->body->elements : nullptr); _module->rootContext = _module->functions.at(index); } diff --git a/src/qml/jsruntime/qv4scopedvalue_p.h b/src/qml/jsruntime/qv4scopedvalue_p.h index afb5c21d36..bb20f384b3 100644 --- a/src/qml/jsruntime/qv4scopedvalue_p.h +++ b/src/qml/jsruntime/qv4scopedvalue_p.h @@ -209,7 +209,7 @@ struct Scoped enum ConvertType { Convert }; QML_NEARLY_ALWAYS_INLINE void setPointer(const Managed *p) { - ptr->setM(p ? p->m() : 0); + ptr->setM(p ? p->m() : nullptr); } QML_NEARLY_ALWAYS_INLINE Scoped(const Scope &scope) @@ -244,7 +244,7 @@ struct Scoped QML_NEARLY_ALWAYS_INLINE Scoped(const Scope &scope, const Value *v) { ptr = scope.engine->jsAlloca(1); - setPointer(v ? v->as<T>() : 0); + setPointer(v ? v->as<T>() : nullptr); } QML_NEARLY_ALWAYS_INLINE Scoped(const Scope &scope, T *t) @@ -290,7 +290,7 @@ struct Scoped return *this; } Scoped<T> &operator=(Value *v) { - setPointer(v ? v->as<T>() : 0); + setPointer(v ? v->as<T>() : nullptr); return *this; } diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index 0c5f02bcfc..bb6608bec0 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -62,14 +62,14 @@ using namespace QV4; Script::Script(ExecutionEngine *v4, QmlContext *qml, CompiledData::CompilationUnit *compilationUnit) : line(1), column(0), context(v4->rootContext()), strictMode(false), inheritContext(true), parsed(false) - , compilationUnit(compilationUnit), vmFunction(0), parseAsBinding(true) + , compilationUnit(compilationUnit), vmFunction(nullptr), parseAsBinding(true) { if (qml) qmlContext.set(v4, *qml); parsed = true; - vmFunction = compilationUnit ? compilationUnit->linkToEngine(v4) : 0; + vmFunction = compilationUnit ? compilationUnit->linkToEngine(v4) : nullptr; } Script::~Script() @@ -88,7 +88,7 @@ void Script::parse() ExecutionEngine *v4 = context->engine(); Scope valueScope(v4); - Module module(v4->debugger() != 0); + Module module(v4->debugger() != nullptr); Engine ee, *engine = ⅇ Lexer lexer(engine); @@ -149,10 +149,10 @@ ReturnedValue Script::run() if (qmlContext.isUndefined()) { TemporaryAssignment<Function*> savedGlobalCode(engine->globalCode, vmFunction); - return vmFunction->call(engine->globalObject, 0, 0, context); + return vmFunction->call(engine->globalObject, nullptr, 0, context); } else { Scoped<QmlContext> qml(valueScope, qmlContext.value()); - return vmFunction->call(0, 0, 0, qml); + return vmFunction->call(nullptr, nullptr, 0, qml); } } @@ -199,14 +199,14 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(QV4::Compi if (!errors.isEmpty()) { if (reportedErrors) *reportedErrors << errors; - return 0; + return nullptr; } Program *program = AST::cast<Program *>(parser.rootNode()); if (!program) { // if parsing was successful, and we have no program, then // we're done...: - return 0; + return nullptr; } Codegen cg(unitGenerator, /*strict mode*/false); @@ -216,7 +216,7 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile(QV4::Compi if (!errors.isEmpty()) { if (reportedErrors) *reportedErrors << errors; - return 0; + return nullptr; } return cg.generateCompilationUnit(/*generate unit data*/false); diff --git a/src/qml/jsruntime/qv4script_p.h b/src/qml/jsruntime/qv4script_p.h index 6ba405f828..24291b9aa6 100644 --- a/src/qml/jsruntime/qv4script_p.h +++ b/src/qml/jsruntime/qv4script_p.h @@ -68,11 +68,11 @@ struct Q_QML_EXPORT Script { Script(ExecutionContext *scope, QV4::Compiler::CompilationMode mode, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) : sourceFile(source), line(line), column(column), sourceCode(sourceCode) , context(scope), strictMode(false), inheritContext(false), parsed(false), compilationMode(mode) - , vmFunction(0), parseAsBinding(false) {} + , vmFunction(nullptr), parseAsBinding(false) {} Script(ExecutionEngine *engine, QmlContext *qml, const QString &sourceCode, const QString &source = QString(), int line = 1, int column = 0) : sourceFile(source), line(line), column(column), sourceCode(sourceCode) , context(engine->rootContext()), strictMode(false), inheritContext(true), parsed(false) - , vmFunction(0), parseAsBinding(true) { + , vmFunction(nullptr), parseAsBinding(true) { if (qml) qmlContext.set(engine, *qml); } @@ -100,7 +100,7 @@ struct Q_QML_EXPORT Script { static QQmlRefPointer<CompiledData::CompilationUnit> precompile( QV4::Compiler::Module *module, Compiler::JSUnitGenerator *unitGenerator, const QString &fileName, const QString &finalUrl, const QString &source, - QList<QQmlError> *reportedErrors = 0, QQmlJS::Directives *directivesCollector = 0); + QList<QQmlError> *reportedErrors = nullptr, QQmlJS::Directives *directivesCollector = nullptr); static Script *createFromFileOrCache(ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, const QUrl &originalUrl); static ReturnedValue evaluate(ExecutionEngine *engine, const QString &script, QmlContext *qmlContext); diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 78413f1b0e..7d29d0b517 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -340,7 +340,7 @@ public: void containerAdvanceIterator(ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) { - name->setM(0); + name->setM(nullptr); *index = UINT_MAX; if (d()->isReference) { @@ -535,7 +535,7 @@ public: { Q_ASSERT(d()->object); Q_ASSERT(d()->isReference); - void *a[] = { d()->container, 0 }; + void *a[] = { d()->container, nullptr }; QMetaObject::metacall(d()->object, QMetaObject::ReadProperty, d()->propertyIndex, a); } @@ -545,7 +545,7 @@ public: Q_ASSERT(d()->isReference); int status = -1; QQmlPropertyData::WriteFlags flags = QQmlPropertyData::DontRemoveBinding; - void *a[] = { d()->container, 0, &status, &flags }; + void *a[] = { d()->container, nullptr, &status, &flags }; QMetaObject::metacall(d()->object, QMetaObject::WriteProperty, d()->propertyIndex, a); } diff --git a/src/qml/jsruntime/qv4sparsearray.cpp b/src/qml/jsruntime/qv4sparsearray.cpp index f295e74adc..2a3e28bf63 100644 --- a/src/qml/jsruntime/qv4sparsearray.cpp +++ b/src/qml/jsruntime/qv4sparsearray.cpp @@ -89,20 +89,20 @@ const SparseArrayNode *SparseArrayNode::previousNode() const SparseArrayNode *SparseArrayNode::copy(SparseArray *d) const { - SparseArrayNode *n = d->createNode(size_left, 0, false); + SparseArrayNode *n = d->createNode(size_left, nullptr, false); n->value = value; n->setColor(color()); if (left) { n->left = left->copy(d); n->left->setParent(n); } else { - n->left = 0; + n->left = nullptr; } if (right) { n->right = right->copy(d); n->right->setParent(n); } else { - n->right = 0; + n->right = nullptr; } return n; } @@ -119,7 +119,7 @@ void SparseArray::rotateLeft(SparseArrayNode *x) SparseArrayNode *&root = header.left; SparseArrayNode *y = x->right; x->right = y->left; - if (y->left != 0) + if (y->left != nullptr) y->left->setParent(x); y->setParent(x->parent()); if (x == root) @@ -146,7 +146,7 @@ void SparseArray::rotateRight(SparseArrayNode *x) SparseArrayNode *&root = header.left; SparseArrayNode *y = x->left; x->left = y->right; - if (y->right != 0) + if (y->right != nullptr) y->right->setParent(x); y->setParent(x->parent()); if (x == root) @@ -209,7 +209,7 @@ void SparseArray::deleteNode(SparseArrayNode *z) SparseArrayNode *y = z; SparseArrayNode *x; SparseArrayNode *x_parent; - if (y->left == 0) { + if (y->left == nullptr) { x = y->right; if (y == mostLeftNode) { if (x) @@ -217,11 +217,11 @@ void SparseArray::deleteNode(SparseArrayNode *z) else mostLeftNode = y->parent(); } - } else if (y->right == 0) { + } else if (y->right == nullptr) { x = y->left; } else { y = y->right; - while (y->left != 0) + while (y->left != nullptr) y = y->left; x = y->right; } @@ -261,7 +261,7 @@ void SparseArray::deleteNode(SparseArrayNode *z) y->size_left = 0; } if (y->color() != SparseArrayNode::Red) { - while (x != root && (x == 0 || x->color() == SparseArrayNode::Black)) { + while (x != root && (x == nullptr || x->color() == SparseArrayNode::Black)) { if (x == x_parent->left) { SparseArrayNode *w = x_parent->right; if (w->color() == SparseArrayNode::Red) { @@ -270,13 +270,13 @@ void SparseArray::deleteNode(SparseArrayNode *z) rotateLeft(x_parent); w = x_parent->right; } - if ((w->left == 0 || w->left->color() == SparseArrayNode::Black) && - (w->right == 0 || w->right->color() == SparseArrayNode::Black)) { + if ((w->left == nullptr || w->left->color() == SparseArrayNode::Black) && + (w->right == nullptr || w->right->color() == SparseArrayNode::Black)) { w->setColor(SparseArrayNode::Red); x = x_parent; x_parent = x_parent->parent(); } else { - if (w->right == 0 || w->right->color() == SparseArrayNode::Black) { + if (w->right == nullptr || w->right->color() == SparseArrayNode::Black) { if (w->left) w->left->setColor(SparseArrayNode::Black); w->setColor(SparseArrayNode::Red); @@ -298,13 +298,13 @@ void SparseArray::deleteNode(SparseArrayNode *z) rotateRight(x_parent); w = x_parent->left; } - if ((w->right == 0 || w->right->color() == SparseArrayNode::Black) && - (w->left == 0 || w->left->color() == SparseArrayNode::Black)) { + if ((w->right == nullptr || w->right->color() == SparseArrayNode::Black) && + (w->left == nullptr || w->left->color() == SparseArrayNode::Black)) { w->setColor(SparseArrayNode::Red); x = x_parent; x_parent = x_parent->parent(); } else { - if (w->left == 0 || w->left->color() == SparseArrayNode::Black) { + if (w->left == nullptr || w->left->color() == SparseArrayNode::Black) { if (w->right) w->right->setColor(SparseArrayNode::Black); w->setColor(SparseArrayNode::Red); @@ -363,8 +363,8 @@ SparseArrayNode *SparseArray::createNode(uint sl, SparseArrayNode *parent, bool Q_CHECK_PTR(node); node->p = (quintptr)parent; - node->left = 0; - node->right = 0; + node->left = nullptr; + node->right = nullptr; node->size_left = sl; node->value = UINT_MAX; ++numEntries; @@ -397,15 +397,15 @@ SparseArray::SparseArray() { freeList = Primitive::emptyValue(UINT_MAX).asReturnedValue(); header.p = 0; - header.left = 0; - header.right = 0; + header.left = nullptr; + header.right = nullptr; mostLeftNode = &header; } SparseArray::SparseArray(const SparseArray &other) { header.p = 0; - header.right = 0; + header.right = nullptr; if (other.header.left) { header.left = other.header.left->copy(this); header.left->setParent(&header); diff --git a/src/qml/jsruntime/qv4sparsearray_p.h b/src/qml/jsruntime/qv4sparsearray_p.h index ca6abcda89..51869b259f 100644 --- a/src/qml/jsruntime/qv4sparsearray_p.h +++ b/src/qml/jsruntime/qv4sparsearray_p.h @@ -109,7 +109,7 @@ struct SparseArrayNode inline SparseArrayNode *SparseArrayNode::lowerBound(uint akey) { SparseArrayNode *n = this; - SparseArrayNode *last = 0; + SparseArrayNode *last = nullptr; while (n) { if (akey <= n->size_left) { last = n; @@ -126,7 +126,7 @@ inline SparseArrayNode *SparseArrayNode::lowerBound(uint akey) inline SparseArrayNode *SparseArrayNode::upperBound(uint akey) { SparseArrayNode *n = this; - SparseArrayNode *last = 0; + SparseArrayNode *last = nullptr; while (n) { if (akey < n->size_left) { last = n; @@ -223,7 +223,7 @@ inline SparseArrayNode *SparseArray::findNode(uint akey) const } } - return 0; + return nullptr; } inline uint SparseArray::pop_front() diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp index 40280534c4..8f6f50338e 100644 --- a/src/qml/jsruntime/qv4string.cpp +++ b/src/qml/jsruntime/qv4string.cpp @@ -174,7 +174,7 @@ void Heap::String::simplifyString() const text = result.data_ptr(); text->ref.ref(); const ComplexString *cs = static_cast<const ComplexString *>(this); - identifier = 0; + identifier = nullptr; cs->left = cs->right = nullptr; internalClass->engine->memoryManager->changeUnmanagedHeapSizeUsage(qptrdiff(text->size) * (qptrdiff)sizeof(QChar)); diff --git a/src/qml/jsruntime/qv4string_p.h b/src/qml/jsruntime/qv4string_p.h index 679cb7329c..5466cc274d 100644 --- a/src/qml/jsruntime/qv4string_p.h +++ b/src/qml/jsruntime/qv4string_p.h @@ -282,7 +282,7 @@ struct ComplexString : String { template<> inline const String *Value::as() const { - return isManaged() && m()->vtable()->isString ? static_cast<const String *>(this) : 0; + return isManaged() && m()->vtable()->isString ? static_cast<const String *>(this) : nullptr; } template<> diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index 8125aa53b2..e5a02fdc22 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -86,7 +86,7 @@ Heap::String *Heap::StringObject::getIndex(uint index) const { QString str = string->toQString(); if (index >= (uint)str.length()) - return 0; + return nullptr; return internalClass->engine->newString(str.mid(index, 1)); } @@ -109,7 +109,7 @@ bool StringObject::deleteIndexedProperty(Managed *m, uint index) void StringObject::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) { - name->setM(0); + name->setM(nullptr); StringObject *s = static_cast<StringObject *>(m); uint slen = s->d()->string->toQString().length(); if (it->arrayIndex <= slen) { @@ -717,7 +717,7 @@ ReturnedValue StringPrototype::method_split(const FunctionObject *b, const Value Scoped<RegExpObject> re(scope, separatorValue); if (re) { if (re->value()->pattern->isEmpty()) { - re = (RegExpObject *)0; + re = (RegExpObject *)nullptr; separatorValue = scope.engine->newString(); } } diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp index 4ba31f9b6e..ea1532b8ce 100644 --- a/src/qml/jsruntime/qv4typedarray.cpp +++ b/src/qml/jsruntime/qv4typedarray.cpp @@ -399,10 +399,10 @@ void TypedArrayPrototype::init(ExecutionEngine *engine, TypedArrayCtor *ctor) ctor->defineReadonlyProperty(engine->id_prototype(), (o = this)); ctor->defineReadonlyProperty(QStringLiteral("BYTES_PER_ELEMENT"), Primitive::fromInt32(operations[ctor->d()->type].bytesPerElement)); defineDefaultProperty(engine->id_constructor(), (o = ctor)); - defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, 0); - defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0); - defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, 0); - defineAccessorProperty(QStringLiteral("length"), method_get_length, 0); + defineAccessorProperty(QStringLiteral("buffer"), method_get_buffer, nullptr); + defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, nullptr); + defineAccessorProperty(QStringLiteral("byteOffset"), method_get_byteOffset, nullptr); + defineAccessorProperty(QStringLiteral("length"), method_get_length, nullptr); defineReadonlyProperty(QStringLiteral("BYTES_PER_ELEMENT"), Primitive::fromInt32(operations[ctor->d()->type].bytesPerElement)); defineDefaultProperty(QStringLiteral("set"), method_set, 1); @@ -514,7 +514,7 @@ ReturnedValue TypedArrayPrototype::method_set(const FunctionObject *b, const Val RETURN_UNDEFINED(); } - char *srcCopy = 0; + char *srcCopy = nullptr; if (buffer->d() == srcBuffer->d()) { // same buffer, need to take a temporary copy, to not run into problems srcCopy = new char[srcTypedArray->d()->byteLength]; diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h index b3f04d69be..97ed13cd91 100644 --- a/src/qml/jsruntime/qv4value_p.h +++ b/src/qml/jsruntime/qv4value_p.h @@ -426,7 +426,7 @@ public: template <typename T> const T *as() const { if (!isManaged()) - return 0; + return nullptr; Q_ASSERT(m()->vtable()); #if !defined(QT_NO_QOBJECT_CHECK) @@ -438,7 +438,7 @@ public: return static_cast<const T *>(this); vt = vt->parent; } - return 0; + return nullptr; } template <typename T> T *as() { @@ -474,7 +474,7 @@ public: Value &operator=(ReturnedValue v) { _val = v; return *this; } Value &operator=(Managed *m) { if (!m) { - setM(0); + setM(nullptr); } else { _val = reinterpret_cast<Value *>(m)->_val; } diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index d44c219d18..feeeee527a 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -553,7 +553,7 @@ QV4::ReturnedValue VME::exec(const FunctionObject *fo, const Value *thisObject, Profiling::FunctionCallProfiler profiler(engine, function); // start execution profiling QV4::Debugging::Debugger *debugger = engine->debugger(); - const uchar *exceptionHandler = 0; + const uchar *exceptionHandler = nullptr; QV4::Value &accumulator = frame.jsFrame->accumulator; QV4::ReturnedValue acc = Encode::undefined(); diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp index 9c51013317..cdda0bf7ef 100644 --- a/src/qml/memory/qv4mm.cpp +++ b/src/qml/memory/qv4mm.cpp @@ -186,7 +186,7 @@ struct MemorySegment { } PageReservation pageReservation; - Chunk *base = 0; + Chunk *base = nullptr; quint64 allocatedMap = 0; size_t availableBytes = 0; uint nChunks = 0; @@ -203,14 +203,14 @@ Chunk *MemorySegment::allocate(size_t size) } size_t requiredChunks = (size + sizeof(Chunk) - 1)/sizeof(Chunk); uint sequence = 0; - Chunk *candidate = 0; + Chunk *candidate = nullptr; for (uint i = 0; i < nChunks; ++i) { if (!testBit(i)) { if (!candidate) candidate = base + i; ++sequence; } else { - candidate = 0; + candidate = nullptr; sequence = 0; } if (sequence == requiredChunks) { @@ -221,7 +221,7 @@ Chunk *MemorySegment::allocate(size_t size) return candidate; } } - return 0; + return nullptr; } struct ChunkAllocator { @@ -594,7 +594,7 @@ HeapItem *BlockAllocator::allocate(size_t size, bool forceAllocation) { if (!m) { if (!forceAllocation) - return 0; + return nullptr; Chunk *newChunk = chunkAllocator->allocate(); Q_V4_PROFILE_ALLOC(engine, Chunk::DataSize, Profiling::HeapPage); chunks.push_back(newChunk); @@ -617,7 +617,7 @@ done: void BlockAllocator::sweep() { - nextFree = 0; + nextFree = nullptr; nFree = 0; memset(freeBins, 0, sizeof(freeBins)); diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h index 7dc73bdacc..1ef54ffcc6 100644 --- a/src/qml/memory/qv4mm_p.h +++ b/src/qml/memory/qv4mm_p.h @@ -105,7 +105,7 @@ struct BlockAllocator { void collectGrayItems(MarkStack *markStack); // bump allocations - HeapItem *nextFree = 0; + HeapItem *nextFree = nullptr; size_t nFree = 0; size_t usedSlotsAfterLastSweep = 0; HeapItem *freeBins[NumBins]; @@ -229,7 +229,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : 0)); + Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : nullptr)); Q_UNUSED(prototype); t->d_unchecked()->init(); return t->d(); @@ -240,7 +240,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : 0)); + Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : nullptr)); Q_UNUSED(prototype); t->d_unchecked()->init(arg1); return t->d(); @@ -251,7 +251,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : 0)); + Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : nullptr)); Q_UNUSED(prototype); t->d_unchecked()->init(arg1, arg2); return t->d(); @@ -262,7 +262,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : 0)); + Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : nullptr)); Q_UNUSED(prototype); t->d_unchecked()->init(arg1, arg2, arg3); return t->d(); @@ -273,7 +273,7 @@ public: { Scope scope(engine); Scoped<ObjectType> t(scope, allocateObject<ObjectType>(ic)); - Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : 0)); + Q_ASSERT(t->internalClass()->prototype == (prototype ? prototype->d() : nullptr)); Q_UNUSED(prototype); t->d_unchecked()->init(arg1, arg2, arg3, arg4); return t->d(); diff --git a/src/qml/memory/qv4mmdefs_p.h b/src/qml/memory/qv4mmdefs_p.h index 4e64ba8118..3e2bae46c2 100644 --- a/src/qml/memory/qv4mmdefs_p.h +++ b/src/qml/memory/qv4mmdefs_p.h @@ -272,9 +272,9 @@ Q_STATIC_ASSERT((1 << Chunk::BitShift) == Chunk::Bits); struct MarkStack { MarkStack(ExecutionEngine *engine); - Heap::Base **top = 0; - Heap::Base **base = 0; - Heap::Base **limit = 0; + Heap::Base **top = nullptr; + Heap::Base **base = nullptr; + Heap::Base **limit = nullptr; ExecutionEngine *engine; void push(Heap::Base *m) { *top = m; diff --git a/src/qml/parser/qqmljsast.cpp b/src/qml/parser/qqmljsast.cpp index 2433522f42..34657a7d48 100644 --- a/src/qml/parser/qqmljsast.cpp +++ b/src/qml/parser/qqmljsast.cpp @@ -61,22 +61,22 @@ void Node::accept(Node *node, Visitor *visitor) ExpressionNode *Node::expressionCast() { - return 0; + return nullptr; } BinaryExpression *Node::binaryExpressionCast() { - return 0; + return nullptr; } Statement *Node::statementCast() { - return 0; + return nullptr; } UiObjectMember *Node::uiObjectMemberCast() { - return 0; + return nullptr; } ExpressionNode *ExpressionNode::expressionCast() diff --git a/src/qml/parser/qqmljsast_p.h b/src/qml/parser/qqmljsast_p.h index 7291cf0d3d..ed3c83badf 100644 --- a/src/qml/parser/qqmljsast_p.h +++ b/src/qml/parser/qqmljsast_p.h @@ -224,8 +224,7 @@ public: Kind_UiEnumMemberList }; - inline Node() - : kind(Kind_Undefined) {} + inline Node() {} // NOTE: node destructors are never called, // instead we block free the memory @@ -248,7 +247,7 @@ public: virtual SourceLocation lastSourceLocation() const = 0; // attributes - int kind; + int kind = Kind_Undefined; }; class QML_PARSER_EXPORT ExpressionNode: public Node @@ -457,11 +456,11 @@ public: QQMLJS_DECLARE_AST_NODE(ArrayLiteral) ArrayLiteral(Elision *e): - elements (0), elision (e) + elements (nullptr), elision (e) { kind = K; } ArrayLiteral(ElementList *elts): - elements (elts), elision (0) + elements (elts), elision (nullptr) { kind = K; } ArrayLiteral(ElementList *elts, Elision *e): @@ -489,8 +488,8 @@ class QML_PARSER_EXPORT ObjectLiteral: public ExpressionNode public: QQMLJS_DECLARE_AST_NODE(ObjectLiteral) - ObjectLiteral(): - properties (0) { kind = K; } + ObjectLiteral() + { kind = K; } ObjectLiteral(PropertyAssignmentList *plist): properties (plist) { kind = K; } @@ -504,7 +503,7 @@ public: { return rbraceToken; } // attributes - PropertyAssignmentList *properties; + PropertyAssignmentList *properties = nullptr; SourceLocation lbraceToken; SourceLocation rbraceToken; }; @@ -535,7 +534,7 @@ public: inline Elision *finish () { Elision *front = next; - next = 0; + next = nullptr; return front; } @@ -564,7 +563,7 @@ public: inline ElementList *finish () { ElementList *front = next; - next = 0; + next = nullptr; return front; } @@ -641,7 +640,7 @@ public: inline PropertyAssignmentList *finish () { PropertyAssignmentList *front = next; - next = 0; + next = nullptr; return front; } @@ -693,7 +692,7 @@ public: }; PropertyGetterSetter(PropertyName *n, FunctionBody *b) - : PropertyAssignment(n), type(Getter), formals(0), functionBody (b) + : PropertyAssignment(n), type(Getter), formals(nullptr), functionBody (b) { kind = K; } PropertyGetterSetter(PropertyName *n, FormalParameterList *f, FunctionBody *b) @@ -917,7 +916,7 @@ public: inline ArgumentList *finish () { ArgumentList *front = next; - next = 0; + next = nullptr; return front; } @@ -1281,7 +1280,7 @@ public: inline StatementList *finish () { StatementList *front = next; - next = 0; + next = nullptr; return front; } @@ -1377,9 +1376,9 @@ public: inline VariableDeclarationList *finish(VariableDeclaration::VariableScope s) { VariableDeclarationList *front = next; - next = 0; + next = nullptr; VariableDeclarationList *vdl; - for (vdl = front; vdl != 0; vdl = vdl->next) { + for (vdl = front; vdl != nullptr; vdl = vdl->next) { vdl->declaration->scope = s; } return front; @@ -1436,7 +1435,7 @@ class QML_PARSER_EXPORT IfStatement: public Statement public: QQMLJS_DECLARE_AST_NODE(IfStatement) - IfStatement(ExpressionNode *e, Statement *t, Statement *f = 0): + IfStatement(ExpressionNode *e, Statement *t, Statement *f = nullptr): expression (e), ok (t), ko (f) { kind = K; } @@ -1727,7 +1726,7 @@ class QML_PARSER_EXPORT CaseBlock: public Node public: QQMLJS_DECLARE_AST_NODE(CaseBlock) - CaseBlock(CaseClauses *c, DefaultClause *d = 0, CaseClauses *r = 0): + CaseBlock(CaseClauses *c, DefaultClause *d = nullptr, CaseClauses *r = nullptr): clauses (c), defaultClause (d), moreClauses (r) { kind = K; } @@ -1824,7 +1823,7 @@ public: inline CaseClauses *finish () { CaseClauses *front = next; - next = 0; + next = nullptr; return front; } @@ -1960,11 +1959,11 @@ public: { kind = K; } TryStatement(Statement *stmt, Finally *f): - statement (stmt), catchExpression (0), finallyExpression (f) + statement (stmt), catchExpression (nullptr), finallyExpression (f) { kind = K; } TryStatement(Statement *stmt, Catch *c): - statement (stmt), catchExpression (c), finallyExpression (0) + statement (stmt), catchExpression (c), finallyExpression (nullptr) { kind = K; } void accept0(Visitor *visitor) override; @@ -2058,7 +2057,7 @@ public: inline FormalParameterList *finish () { FormalParameterList *front = next; - next = 0; + next = nullptr; return front; } @@ -2106,7 +2105,7 @@ public: inline SourceElements *finish () { SourceElements *front = next; - next = 0; + next = nullptr; return front; } @@ -2240,7 +2239,7 @@ public: UiQualifiedId *finish() { UiQualifiedId *head = next; - next = 0; + next = nullptr; return head; } @@ -2264,7 +2263,7 @@ public: QQMLJS_DECLARE_AST_NODE(UiImport) UiImport(const QStringRef &fileName) - : fileName(fileName), importUri(0) + : fileName(fileName), importUri(nullptr) { kind = K; } UiImport(UiQualifiedId *uri) @@ -2328,7 +2327,7 @@ public: UiObjectMemberList *finish() { UiObjectMemberList *head = next; - next = 0; + next = nullptr; return head; } @@ -2357,7 +2356,7 @@ public: UiQualifiedPragmaId *finish() { UiQualifiedPragmaId *head = next; - next = 0; + next = nullptr; return head; } @@ -2430,7 +2429,7 @@ public: UiHeaderItemList *finish() { UiHeaderItemList *head = next; - next = 0; + next = nullptr; return head; } @@ -2509,7 +2508,7 @@ public: UiArrayMemberList *finish() { UiArrayMemberList *head = next; - next = 0; + next = nullptr; return head; } @@ -2570,7 +2569,7 @@ public: inline UiParameterList *finish () { UiParameterList *front = next; - next = 0; + next = nullptr; return front; } @@ -2590,13 +2589,13 @@ public: UiPublicMember(UiQualifiedId *memberType, const QStringRef &name) - : type(Property), memberType(memberType), name(name), statement(0), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) + : type(Property), memberType(memberType), name(name), statement(nullptr), binding(nullptr), isDefaultMember(false), isReadonlyMember(false), parameters(nullptr) { kind = K; } UiPublicMember(UiQualifiedId *memberType, const QStringRef &name, Statement *statement) - : type(Property), memberType(memberType), name(name), statement(statement), binding(0), isDefaultMember(false), isReadonlyMember(false), parameters(0) + : type(Property), memberType(memberType), name(name), statement(statement), binding(nullptr), isDefaultMember(false), isReadonlyMember(false), parameters(nullptr) { kind = K; } void accept0(Visitor *visitor) override; @@ -2825,7 +2824,7 @@ public: UiEnumMemberList *finish() { UiEnumMemberList *head = next; - next = 0; + next = nullptr; return head; } diff --git a/src/qml/parser/qqmljsengine_p.cpp b/src/qml/parser/qqmljsengine_p.cpp index 5b105bc60c..97ce6ebea3 100644 --- a/src/qml/parser/qqmljsengine_p.cpp +++ b/src/qml/parser/qqmljsengine_p.cpp @@ -113,7 +113,7 @@ double integerFromString(const char *buf, int size, int radix) } Engine::Engine() - : _lexer(0), _directives(0) + : _lexer(nullptr), _directives(nullptr) { } Engine::~Engine() diff --git a/src/qml/parser/qqmljsengine_p.h b/src/qml/parser/qqmljsengine_p.h index 8cbe69a0ba..af26bac0ff 100644 --- a/src/qml/parser/qqmljsengine_p.h +++ b/src/qml/parser/qqmljsengine_p.h @@ -71,8 +71,7 @@ class QML_PARSER_EXPORT DiagnosticMessage public: enum Kind { Warning, Error }; - DiagnosticMessage() - : kind(Error) {} + DiagnosticMessage() {} DiagnosticMessage(Kind kind, const AST::SourceLocation &loc, const QString &message) : kind(kind), loc(loc), message(message) {} @@ -83,7 +82,7 @@ public: bool isError() const { return kind == Error; } - Kind kind; + Kind kind = Error; AST::SourceLocation loc; QString message; }; diff --git a/src/qml/parser/qqmljsgrammar.cpp b/src/qml/parser/qqmljsgrammar.cpp index f345990ff9..2aaeb385e3 100644 --- a/src/qml/parser/qqmljsgrammar.cpp +++ b/src/qml/parser/qqmljsgrammar.cpp @@ -49,11 +49,11 @@ const char *const QQmlJSGrammar::spell [] = { "if", "in", "instanceof", "{", "[", "<=", "(", "<", "<<", "<<=", "-", "-=", "--", "new", "!", "!=", "!==", "numeric literal", "|", "|=", "||", "+", "+=", "++", "?", "}", "]", "%", "%=", "return", - ")", ";", 0, "*", "*=", "string literal", "property", "signal", "readonly", "switch", + ")", ";", nullptr, "*", "*=", "string literal", "property", "signal", "readonly", "switch", "this", "throw", "~", "try", "typeof", "var", "void", "while", "with", "^", "^=", "null", "true", "false", "const", "let", "debugger", "reserved word", "multiline string literal", "comment", - 0, "enum", "public", "import", "pragma", "as", "on", "get", "set", 0, - 0, 0, 0, 0, 0, 0, 0, 0 + nullptr, "enum", "public", "import", "pragma", "as", "on", "get", "set", nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; const short QQmlJSGrammar::lhs [] = { diff --git a/src/qml/parser/qqmljslexer.cpp b/src/qml/parser/qqmljslexer.cpp index 6a3bd6d887..2414f92e50 100644 --- a/src/qml/parser/qqmljslexer.cpp +++ b/src/qml/parser/qqmljslexer.cpp @@ -85,9 +85,9 @@ static inline QChar convertUnicode(QChar c1, QChar c2, QChar c3, QChar c4) Lexer::Lexer(Engine *engine) : _engine(engine) - , _codePtr(0) - , _endPtr(0) - , _tokenStartPtr(0) + , _codePtr(nullptr) + , _endPtr(nullptr) + , _tokenStartPtr(nullptr) , _char(QLatin1Char('\n')) , _errorCode(NoError) , _currentLineNumber(0) @@ -1043,7 +1043,7 @@ int Lexer::scanNumber(QChar ch) chars.append('\0'); const char *begin = chars.constData(); - const char *end = 0; + const char *end = nullptr; bool ok = false; _tokenValue = qstrtod(begin, &end, &ok); diff --git a/src/qml/parser/qqmljsmemorypool_p.h b/src/qml/parser/qqmljsmemorypool_p.h index 536f5d4239..ef443d96bc 100644 --- a/src/qml/parser/qqmljsmemorypool_p.h +++ b/src/qml/parser/qqmljsmemorypool_p.h @@ -71,13 +71,7 @@ class QML_PARSER_EXPORT MemoryPool : public QSharedData void operator =(const MemoryPool &other); public: - MemoryPool() - : _blocks(0), - _allocatedBlocks(0), - _blockCount(-1), - _ptr(0), - _end(0) - { } + MemoryPool() {} ~MemoryPool() { @@ -105,7 +99,7 @@ public: void reset() { _blockCount = -1; - _ptr = _end = 0; + _ptr = _end = nullptr; } template <typename Tp> Tp *New() { return new (this->allocate(sizeof(Tp))) Tp(); } @@ -125,7 +119,7 @@ private: Q_CHECK_PTR(_blocks); for (int index = _blockCount; index < _allocatedBlocks; ++index) - _blocks[index] = 0; + _blocks[index] = nullptr; } char *&block = _blocks[_blockCount]; @@ -144,11 +138,11 @@ private: } private: - char **_blocks; - int _allocatedBlocks; - int _blockCount; - char *_ptr; - char *_end; + char **_blocks = nullptr; + int _allocatedBlocks = 0; + int _blockCount = -1; + char *_ptr = nullptr; + char *_end = nullptr; enum { diff --git a/src/qml/parser/qqmljsparser.cpp b/src/qml/parser/qqmljsparser.cpp index df16a24bcc..f1beec6387 100644 --- a/src/qml/parser/qqmljsparser.cpp +++ b/src/qml/parser/qqmljsparser.cpp @@ -87,14 +87,14 @@ Parser::Parser(Engine *engine): pool(engine->pool()), tos(0), stack_size(0), - sym_stack(0), - state_stack(0), - location_stack(0), - string_stack(0), - program(0), + sym_stack(nullptr), + state_stack(nullptr), + location_stack(nullptr), + string_stack(nullptr), + program(nullptr), yylval(0), - first_token(0), - last_token(0) + first_token(nullptr), + last_token(nullptr) { } @@ -143,7 +143,7 @@ AST::UiQualifiedId *Parser::reparseAsQualifiedId(AST::ExpressionNode *expr) return currentId->finish(); } - return 0; + return nullptr; } AST::UiQualifiedPragmaId *Parser::reparseAsQualifiedPragmaId(AST::ExpressionNode *expr) @@ -155,7 +155,7 @@ AST::UiQualifiedPragmaId *Parser::reparseAsQualifiedPragmaId(AST::ExpressionNode return q->finish(); } - return 0; + return nullptr; } @@ -188,7 +188,7 @@ bool Parser::parse(int startToken) } tos = -1; - program = 0; + program = nullptr; do { if (++tos == stack_size) @@ -315,7 +315,7 @@ case 24: { } break; case 25: { - AST::UiPragma *node = 0; + AST::UiPragma *node = nullptr; if (AST::UiQualifiedPragmaId *qualifiedId = reparseAsQualifiedPragmaId(sym(2).Expression)) { node = new (pool) AST::UiPragma(qualifiedId); @@ -334,7 +334,7 @@ case 25: { } break; case 26: { - AST::UiImport *node = 0; + AST::UiImport *node = nullptr; if (AST::StringLiteral *importIdLiteral = AST::cast<AST::StringLiteral *>(sym(2).Expression)) { node = new (pool) AST::UiImport(importIdLiteral->value); @@ -357,7 +357,7 @@ case 26: { } break; case 27: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 28: { @@ -386,7 +386,7 @@ case 32: { } break; case 33: { - AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)0); + AST::UiObjectInitializer *node = new (pool) AST::UiObjectInitializer((AST::UiObjectMemberList*)nullptr); node->lbraceToken = loc(1); node->rbraceToken = loc(2); sym(1).Node = node; @@ -462,7 +462,7 @@ case 51: { } break; case 52: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 53: { @@ -594,7 +594,7 @@ case 71: { AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(6)); propertyName->identifierToken = loc(6); - propertyName->next = 0; + propertyName->next = nullptr; AST::UiArrayBinding *binding = new (pool) AST::UiArrayBinding( propertyName, sym(9).UiArrayMemberList->finish()); @@ -616,7 +616,7 @@ case 72: { AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(3)); propertyName->identifierToken = loc(3); - propertyName->next = 0; + propertyName->next = nullptr; AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( propertyName, sym(5).UiQualifiedId, sym(6).UiObjectInitializer); @@ -638,7 +638,7 @@ case 73: { AST::UiQualifiedId *propertyName = new (pool) AST::UiQualifiedId(stringRef(4)); propertyName->identifierToken = loc(4); - propertyName->next = 0; + propertyName->next = nullptr; AST::UiObjectBinding *binding = new (pool) AST::UiObjectBinding( propertyName, sym(6).UiQualifiedId, sym(7).UiObjectInitializer); @@ -770,7 +770,7 @@ case 97: { } break; case 98: { - AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral((AST::Elision *) 0); + AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral((AST::Elision *) nullptr); node->lbracketToken = loc(1); node->rbracketToken = loc(2); sym(1).Node = node; @@ -792,7 +792,7 @@ case 100: { case 101: { AST::ArrayLiteral *node = new (pool) AST::ArrayLiteral(sym(2).ElementList->finish (), - (AST::Elision *) 0); + (AST::Elision *) nullptr); node->lbracketToken = loc(1); node->commaToken = loc(3); node->rbracketToken = loc(4); @@ -809,7 +809,7 @@ case 102: { } break; case 103: { - AST::ObjectLiteral *node = 0; + AST::ObjectLiteral *node = nullptr; if (sym(2).Node) node = new (pool) AST::ObjectLiteral( sym(2).PropertyAssignmentList->finish ()); @@ -846,7 +846,7 @@ case 106: { if (AST::UiQualifiedId *qualifiedId = reparseAsQualifiedId(sym(1).Expression)) { sym(1).UiQualifiedId = qualifiedId; } else { - sym(1).UiQualifiedId = 0; + sym(1).UiQualifiedId = nullptr; diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, loc(1), QLatin1String("Expected a qualified name id"))); @@ -856,7 +856,7 @@ case 106: { } break; case 107: { - sym(1).Node = new (pool) AST::ElementList((AST::Elision *) 0, sym(1).Expression); + sym(1).Node = new (pool) AST::ElementList((AST::Elision *) nullptr, sym(1).Expression); } break; case 108: { @@ -865,7 +865,7 @@ case 108: { case 109: { AST::ElementList *node = new (pool) AST::ElementList(sym(1).ElementList, - (AST::Elision *) 0, sym(3).Expression); + (AST::Elision *) nullptr, sym(3).Expression); node->commaToken = loc(2); sym(1).Node = node; } break; @@ -1010,7 +1010,7 @@ case 167: { } break; case 168: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 169: { @@ -1437,7 +1437,7 @@ case 262: { } break; case 263: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 266: { @@ -1447,7 +1447,7 @@ case 266: { } break; case 267: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 284: { @@ -1466,7 +1466,7 @@ case 286: { } break; case 287: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 288: { @@ -1537,7 +1537,7 @@ case 300: { } break; case 301: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 303: { @@ -1546,7 +1546,7 @@ case 303: { } break; case 304: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 306: { @@ -1718,7 +1718,7 @@ case 334: { } break; case 335: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 336: { @@ -1840,7 +1840,7 @@ case 354: { } break; case 355: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 356: { @@ -1848,7 +1848,7 @@ case 356: { } break; case 357: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; case 359: { @@ -1876,7 +1876,7 @@ case 365: { } break; case 366: { - sym(1).Node = 0; + sym(1).Node = nullptr; } break; } // switch diff --git a/src/qml/parser/qqmljsparser_p.h b/src/qml/parser/qqmljsparser_p.h index 9dfee70f3a..b4aecd2f08 100644 --- a/src/qml/parser/qqmljsparser_p.h +++ b/src/qml/parser/qqmljsparser_p.h @@ -146,7 +146,7 @@ public: AST::Statement *statement() const { if (! program) - return 0; + return nullptr; return program->statementCast(); } @@ -154,7 +154,7 @@ public: AST::ExpressionNode *expression() const { if (! program) - return 0; + return nullptr; return program->expressionCast(); } @@ -162,7 +162,7 @@ public: AST::UiObjectMember *uiObjectMember() const { if (! program) - return 0; + return nullptr; return program->uiObjectMemberCast(); } diff --git a/src/qml/qml/ftw/qbitfield_p.h b/src/qml/qml/ftw/qbitfield_p.h index 8f35842249..92017580d6 100644 --- a/src/qml/qml/ftw/qbitfield_p.h +++ b/src/qml/qml/ftw/qbitfield_p.h @@ -77,12 +77,12 @@ private: }; QBitField::QBitField() -: bits(0), ownData(0), data(0) +: bits(0), ownData(nullptr), data(nullptr) { } QBitField::QBitField(const quint32 *bitData, int bitCount) -: bits((quint32)bitCount), ownData(0), data(bitData) +: bits((quint32)bitCount), ownData(nullptr), data(bitData) { } diff --git a/src/qml/qml/ftw/qfieldlist_p.h b/src/qml/qml/ftw/qfieldlist_p.h index d83d708b5e..2bf07fb20d 100644 --- a/src/qml/qml/ftw/qfieldlist_p.h +++ b/src/qml/qml/ftw/qfieldlist_p.h @@ -141,7 +141,7 @@ N *QForwardFieldList<N, nextMember>::takeFirst() N *value = *_first; if (value) { _first = next(value); - value->*nextMember = 0; + value->*nextMember = nullptr; } return value; } @@ -149,7 +149,7 @@ N *QForwardFieldList<N, nextMember>::takeFirst() template<class N, N *N::*nextMember> void QForwardFieldList<N, nextMember>::prepend(N *v) { - Q_ASSERT(v->*nextMember == 0); + Q_ASSERT(v->*nextMember == nullptr); v->*nextMember = *_first; _first = v; } @@ -229,7 +229,7 @@ void QForwardFieldList<N, nextMember>::setFlag2Value(bool v) template<class N, N *N::*nextMember> QFieldList<N, nextMember>::QFieldList() -: _first(0), _last(0), _flag(0), _count(0) +: _first(nullptr), _last(nullptr), _flag(0), _count(0) { } @@ -246,10 +246,10 @@ N *QFieldList<N, nextMember>::takeFirst() if (value) { _first = next(value); if (_last == value) { - Q_ASSERT(_first == 0); - _last = 0; + Q_ASSERT(_first == nullptr); + _last = nullptr; } - value->*nextMember = 0; + value->*nextMember = nullptr; --_count; } return value; @@ -258,7 +258,7 @@ N *QFieldList<N, nextMember>::takeFirst() template<class N, N *N::*nextMember> void QFieldList<N, nextMember>::append(N *v) { - Q_ASSERT(v->*nextMember == 0); + Q_ASSERT(v->*nextMember == nullptr); if (isEmpty()) { _first = v; _last = v; @@ -272,7 +272,7 @@ void QFieldList<N, nextMember>::append(N *v) template<class N, N *N::*nextMember> void QFieldList<N, nextMember>::prepend(N *v) { - Q_ASSERT(v->*nextMember == 0); + Q_ASSERT(v->*nextMember == nullptr); if (isEmpty()) { _first = v; _last = v; @@ -375,7 +375,7 @@ void QFieldList<N, nextMember>::copyAndClear(QFieldList<N, nextMember> &o) _first = o._first; _last = o._last; _count = o._count; - o._first = o._last = 0; + o._first = o._last = nullptr; o._count = 0; } @@ -391,8 +391,8 @@ void QFieldList<N, nextMember>::copyAndClearAppend(QForwardFieldList<N, nextMemb template<class N, N *N::*nextMember> void QFieldList<N, nextMember>::copyAndClearPrepend(QForwardFieldList<N, nextMember> &o) { - _first = 0; - _last = 0; + _first = nullptr; + _last = nullptr; _count = 0; while (N *n = o.takeFirst()) prepend(n); } diff --git a/src/qml/qml/ftw/qfinitestack_p.h b/src/qml/qml/ftw/qfinitestack_p.h index f1f1a551d5..9a74199137 100644 --- a/src/qml/qml/ftw/qfinitestack_p.h +++ b/src/qml/qml/ftw/qfinitestack_p.h @@ -81,7 +81,7 @@ private: template<typename T> QFiniteStack<T>::QFiniteStack() -: _array(0), _alloc(0), _size(0) +: _array(nullptr), _alloc(0), _size(0) { } @@ -156,7 +156,7 @@ T &QFiniteStack<T>::operator[](int index) template<typename T> void QFiniteStack<T>::allocate(int size) { - Q_ASSERT(_array == 0); + Q_ASSERT(_array == nullptr); Q_ASSERT(_alloc == 0); Q_ASSERT(_size == 0); @@ -177,7 +177,7 @@ void QFiniteStack<T>::deallocate() free(_array); - _array = 0; + _array = nullptr; _alloc = 0; _size = 0; } diff --git a/src/qml/qml/ftw/qflagpointer_p.h b/src/qml/qml/ftw/qflagpointer_p.h index 6954a8f09c..91ce74bec9 100644 --- a/src/qml/qml/ftw/qflagpointer_p.h +++ b/src/qml/qml/ftw/qflagpointer_p.h @@ -83,7 +83,7 @@ public: inline T *data() const; private: - quintptr ptr_value; + quintptr ptr_value = 0; static const quintptr FlagBit = 0x1; static const quintptr Flag2Bit = 0x2; @@ -115,7 +115,7 @@ public: inline T2 *asT2() const; private: - quintptr ptr_value; + quintptr ptr_value = 0; static const quintptr FlagBit = 0x1; static const quintptr Flag2Bit = 0x2; @@ -124,7 +124,6 @@ private: template<typename T> QFlagPointer<T>::QFlagPointer() -: ptr_value(0) { } @@ -233,7 +232,6 @@ T *QFlagPointer<T>::data() const template<typename T, typename T2> QBiPointer<T, T2>::QBiPointer() -: ptr_value(0) { } diff --git a/src/qml/qml/ftw/qhashedstring_p.h b/src/qml/qml/ftw/qhashedstring_p.h index 956805d696..2d6c25bdd3 100644 --- a/src/qml/qml/ftw/qhashedstring_p.h +++ b/src/qml/qml/ftw/qhashedstring_p.h @@ -94,7 +94,7 @@ private: friend class QStringHashNode; inline void computeHash() const; - mutable quint32 m_hash; + mutable quint32 m_hash = 0; }; class QHashedCStringRef; @@ -142,9 +142,9 @@ private: inline void computeHash() const; - const QChar *m_data; - int m_length; - mutable quint32 m_hash; + const QChar *m_data = nullptr; + int m_length = 0; + mutable quint32 m_hash = 0; }; class Q_AUTOTEST_EXPORT QHashedCStringRef @@ -169,9 +169,9 @@ private: inline void computeHash() const; - const char *m_data; - int m_length; - mutable quint32 m_hash; + const char *m_data = nullptr; + int m_length = 0; + mutable quint32 m_hash = 0; }; class QStringHashData; @@ -179,7 +179,7 @@ class Q_AUTOTEST_EXPORT QStringHashNode { public: QStringHashNode() - : length(0), hash(0), symbolId(0), ckey(0) + : ckey(nullptr) { } @@ -210,9 +210,9 @@ public: QFlagPointer<QStringHashNode> next; - qint32 length; - quint32 hash; - quint32 symbolId; + qint32 length = 0; + quint32 hash = 0; + quint32 symbolId = 0; union { const char *ckey; @@ -276,25 +276,20 @@ public: class Q_AUTOTEST_EXPORT QStringHashData { public: - QStringHashData() - : buckets(0), numBuckets(0), size(0), numBits(0) -#ifdef QSTRINGHASH_LINK_DEBUG - , linkCount(0) -#endif - {} + QStringHashData() {} - QStringHashNode **buckets; - int numBuckets; - int size; - short numBits; + QStringHashNode **buckets = nullptr; + int numBuckets = 0; + int size = 0; + short numBits = 0; #ifdef QSTRINGHASH_LINK_DEBUG - int linkCount; + int linkCount = 0; #endif struct IteratorData { - IteratorData() : n(0), p(0) {} - QStringHashNode *n; - void *p; + IteratorData() {} + QStringHashNode *n = nullptr; + void *p = nullptr; }; void rehashToBits(short); void rehashToSize(int); @@ -362,17 +357,17 @@ public: T value; }; struct NewedNode : public Node { - NewedNode(const QHashedString &key, const T &value) : Node(key, value), nextNewed(0) {} - NewedNode(const QHashedCStringRef &key, const T &value) : Node(key, value), nextNewed(0) {} - NewedNode(const Node &o) : Node(o), nextNewed(0) {} + NewedNode(const QHashedString &key, const T &value) : Node(key, value), nextNewed(nullptr) {} + NewedNode(const QHashedCStringRef &key, const T &value) : Node(key, value), nextNewed(nullptr) {} + NewedNode(const Node &o) : Node(o), nextNewed(nullptr) {} NewedNode *nextNewed; }; struct ReservedNodePool { - ReservedNodePool() : count(0), used(0), nodes(0) {} + ReservedNodePool() : nodes(nullptr) {} ~ReservedNodePool() { delete [] nodes; } - int count; - int used; + int count = 0; + int used = 0; Node *nodes; }; @@ -475,13 +470,13 @@ public: template<class T> QStringHash<T>::QStringHash() -: newedNodes(0), nodePool(0), link(0) +: newedNodes(nullptr), nodePool(nullptr), link(nullptr) { } template<class T> QStringHash<T>::QStringHash(const QStringHash<T> &other) -: newedNodes(0), nodePool(0), link(0) +: newedNodes(nullptr), nodePool(nullptr), link(nullptr) { data.numBits = other.data.numBits; data.size = other.data.size; @@ -579,14 +574,14 @@ void QStringHash<T>::clear() if (nodePool) delete nodePool; delete [] data.buckets; - data.buckets = 0; + data.buckets = nullptr; data.numBuckets = 0; data.numBits = 0; data.size = 0; - newedNodes = 0; - nodePool = 0; - link = 0; + newedNodes = nullptr; + nodePool = nullptr; + link = nullptr; } template<class T> @@ -716,16 +711,16 @@ QStringHash<T>::iterateNext(const QStringHashData::IteratorData &d) node < (This->nodePool->nodes + This->nodePool->used)) { node--; if (node < This->nodePool->nodes) - node = 0; + node = nullptr; } else { NewedNode *nn = (NewedNode *)node; node = nn->nextNewed; - if (node == 0 && This->nodePool && This->nodePool->used) + if (node == nullptr && This->nodePool && This->nodePool->used) node = This->nodePool->nodes + This->nodePool->used - 1; } - if (node == 0 && This->link) + if (node == nullptr && This->link) return This->link->iterateFirst(); QStringHashData::IteratorData rv; @@ -737,13 +732,13 @@ QStringHash<T>::iterateNext(const QStringHashData::IteratorData &d) template<class T> QStringHashData::IteratorData QStringHash<T>::iterateFirst() const { - Node *n = 0; + Node *n = nullptr; if (newedNodes) n = newedNodes; else if (nodePool && nodePool->used) n = nodePool->nodes + nodePool->used - 1; - if (n == 0 && link) + if (n == nullptr && link) return link->iterateFirst(); QStringHashData::IteratorData rv; @@ -822,7 +817,7 @@ void QStringHash<T>::insert(const K &key, const T &value) { // If this is a linked hash, we can't rely on owning the node, so we always // create a new one. - Node *n = link?0:findNode(key); + Node *n = link?nullptr:findNode(key); if (n) n->value = value; else createNode(key, value); } @@ -837,7 +832,7 @@ template<class T> template<class K> typename QStringHash<T>::Node *QStringHash<T>::findNode(const K &key) const { - QStringHashNode *node = data.numBuckets?data.buckets[hashOf(key) % data.numBuckets]:0; + QStringHashNode *node = data.numBuckets?data.buckets[hashOf(key) % data.numBuckets]:nullptr; typename HashedForm<K>::Type hashedKey(hashedString(key)); while (node && !node->equals(hashedKey)) @@ -851,7 +846,7 @@ template<class K> T *QStringHash<T>::value(const K &key) const { Node *n = findNode(key); - return n?&n->value:0; + return n?&n->value:nullptr; } template<class T> @@ -865,14 +860,14 @@ template<class T> T *QStringHash<T>::value(const QV4::String *string) const { Node *n = findNode(string); - return n?&n->value:0; + return n?&n->value:nullptr; } template<class T> template<class K> bool QStringHash<T>::contains(const K &key) const { - return 0 != value(key); + return nullptr != value(key); } template<class T> @@ -1038,7 +1033,7 @@ inline uint qHash(const QHashedStringRef &string) } QHashedString::QHashedString() -: QString(), m_hash(0) +: QString() { } @@ -1089,7 +1084,6 @@ quint32 QHashedString::existingHash() const } QHashedStringRef::QHashedStringRef() -: m_data(0), m_length(0), m_hash(0) { } @@ -1236,7 +1230,6 @@ quint32 QHashedStringRef::hash() const } QHashedCStringRef::QHashedCStringRef() -: m_data(0), m_length(0), m_hash(0) { } diff --git a/src/qml/qml/ftw/qintrusivelist_p.h b/src/qml/qml/ftw/qintrusivelist_p.h index 3d749e697e..8992be9f93 100644 --- a/src/qml/qml/ftw/qintrusivelist_p.h +++ b/src/qml/qml/ftw/qintrusivelist_p.h @@ -95,7 +95,7 @@ public: private: static inline N *nodeToN(QIntrusiveListNode *node); - QIntrusiveListNode *__first; + QIntrusiveListNode *__first = nullptr; }; class QIntrusiveListNode @@ -107,13 +107,13 @@ public: inline void remove(); inline bool isInList() const; - QIntrusiveListNode *_next; - QIntrusiveListNode**_prev; + QIntrusiveListNode *_next = nullptr; + QIntrusiveListNode**_prev = nullptr; }; template<class N, QIntrusiveListNode N::*member> QIntrusiveList<N, member>::iterator::iterator() -: _value(0) +: _value(nullptr) { } @@ -165,7 +165,7 @@ typename QIntrusiveList<N, member>::iterator &QIntrusiveList<N, member>::iterato template<class N, QIntrusiveListNode N::*member> QIntrusiveList<N, member>::QIntrusiveList() -: __first(0) + { } @@ -178,7 +178,7 @@ QIntrusiveList<N, member>::~QIntrusiveList() template<class N, QIntrusiveListNode N::*member> bool QIntrusiveList<N, member>::isEmpty() const { - return __first == 0; + return __first == nullptr; } template<class N, QIntrusiveListNode N::*member> @@ -215,14 +215,14 @@ bool QIntrusiveList<N, member>::contains(N *n) const template<class N, QIntrusiveListNode N::*member> N *QIntrusiveList<N, member>::first() const { - return __first?nodeToN(__first):0; + return __first?nodeToN(__first):nullptr; } template<class N, QIntrusiveListNode N::*member> N *QIntrusiveList<N, member>::next(N *current) { QIntrusiveListNode *nextnode = (current->*member)._next; - N *nextstruct = nextnode?nodeToN(nextnode):0; + N *nextstruct = nextnode?nodeToN(nextnode):nullptr; return nextstruct; } @@ -241,11 +241,10 @@ typename QIntrusiveList<N, member>::iterator QIntrusiveList<N, member>::end() template<class N, QIntrusiveListNode N::*member> N *QIntrusiveList<N, member>::nodeToN(QIntrusiveListNode *node) { - return (N *)((char *)node - ((char *)&(((N *)0)->*member) - (char *)0)); + return (N *)((char *)node - ((char *)&(((N *)nullptr)->*member) - (char *)nullptr)); } QIntrusiveListNode::QIntrusiveListNode() -: _next(0), _prev(0) { } @@ -258,13 +257,13 @@ void QIntrusiveListNode::remove() { if (_prev) *_prev = _next; if (_next) _next->_prev = _prev; - _prev = 0; - _next = 0; + _prev = nullptr; + _next = nullptr; } bool QIntrusiveListNode::isInList() const { - return _prev != 0; + return _prev != nullptr; } QT_END_NAMESPACE diff --git a/src/qml/qml/ftw/qpodvector_p.h b/src/qml/qml/ftw/qpodvector_p.h index cafe3367de..d0e4f89741 100644 --- a/src/qml/qml/ftw/qpodvector_p.h +++ b/src/qml/qml/ftw/qpodvector_p.h @@ -61,7 +61,7 @@ class QPODVector { public: QPODVector() - : m_count(0), m_capacity(0), m_data(0) {} + : m_count(0), m_capacity(0), m_data(nullptr) {} ~QPODVector() { if (m_data) ::free(m_data); } const T &at(int idx) const { @@ -154,7 +154,7 @@ public: other.m_data = m_data; m_count = 0; m_capacity = 0; - m_data = 0; + m_data = nullptr; } QPODVector<T,Increment> &operator<<(const T &v) { append(v); return *this; } diff --git a/src/qml/qml/ftw/qqmlnullablevalue_p.h b/src/qml/qml/ftw/qqmlnullablevalue_p.h index 7a9e4d7b8a..5b3d2fc456 100644 --- a/src/qml/qml/ftw/qqmlnullablevalue_p.h +++ b/src/qml/qml/ftw/qqmlnullablevalue_p.h @@ -57,7 +57,7 @@ template<typename T> struct QQmlNullableValue { QQmlNullableValue() - : isNull(true), value(T()) {} + : value(T()) {} QQmlNullableValue(const QQmlNullableValue<T> &o) : isNull(o.isNull), value(o.value) {} QQmlNullableValue(const T &t) @@ -70,7 +70,7 @@ struct QQmlNullableValue void invalidate() { isNull = true; } bool isValid() const { return !isNull; } - bool isNull; + bool isNull = true; T value; }; diff --git a/src/qml/qml/ftw/qqmlrefcount_p.h b/src/qml/qml/ftw/qqmlrefcount_p.h index 225e18156c..3cfb345b30 100644 --- a/src/qml/qml/ftw/qqmlrefcount_p.h +++ b/src/qml/qml/ftw/qqmlrefcount_p.h @@ -137,7 +137,7 @@ void QQmlRefCount::destroy() template<class T> QQmlRefPointer<T>::QQmlRefPointer() -: o(0) +: o(nullptr) { } diff --git a/src/qml/qml/ftw/qqmlthread.cpp b/src/qml/qml/ftw/qqmlthread.cpp index cae7088840..78b477b472 100644 --- a/src/qml/qml/ftw/qqmlthread.cpp +++ b/src/qml/qml/ftw/qqmlthread.cpp @@ -123,7 +123,7 @@ bool QQmlThreadPrivate::MainObject::event(QEvent *e) QQmlThreadPrivate::QQmlThreadPrivate(QQmlThread *q) : q(q), m_threadProcessing(false), m_mainProcessing(false), m_shutdown(false), - m_mainThreadWaiting(false), mainSync(0), m_mainObject(this) + m_mainThreadWaiting(false), mainSync(nullptr), m_mainObject(this) { setObjectName(QStringLiteral("QQmlThread")); } @@ -155,7 +155,7 @@ void QQmlThreadPrivate::mainEvent() m_mainProcessing = true; while (!mainList.isEmpty() || mainSync) { - bool isSync = mainSync != 0; + bool isSync = mainSync != nullptr; QQmlThread::Message *message = isSync?mainSync:mainList.takeFirst(); unlock(); @@ -165,7 +165,7 @@ void QQmlThreadPrivate::mainEvent() lock(); if (isSync) { - mainSync = 0; + mainSync = nullptr; wakeOne(); } } @@ -328,7 +328,7 @@ void QQmlThread::internalCallMethodInThread(Message *message) message->call(this); delete message; lock(); - d->mainSync = 0; + d->mainSync = nullptr; wakeOne(); } else { d->wait(); @@ -345,7 +345,7 @@ void QQmlThread::internalCallMethodInMain(Message *message) d->lock(); - Q_ASSERT(d->mainSync == 0); + Q_ASSERT(d->mainSync == nullptr); d->mainSync = message; if (d->m_mainThreadWaiting) { @@ -359,7 +359,7 @@ void QQmlThread::internalCallMethodInMain(Message *message) while (d->mainSync) { if (d->m_shutdown) { delete d->mainSync; - d->mainSync = 0; + d->mainSync = nullptr; break; } d->wait(); @@ -405,7 +405,7 @@ void QQmlThread::waitForNextMessage() message->call(this); delete message; lock(); - d->mainSync = 0; + d->mainSync = nullptr; wakeOne(); } else { d->wait(); diff --git a/src/qml/qml/ftw/qqmlthread_p.h b/src/qml/qml/ftw/qqmlthread_p.h index 295235e255..0ed12a2972 100644 --- a/src/qml/qml/ftw/qqmlthread_p.h +++ b/src/qml/qml/ftw/qqmlthread_p.h @@ -124,7 +124,7 @@ private: friend class QQmlThreadPrivate; struct Message { - Message() : next(0) {} + Message() : next(nullptr) {} virtual ~Message() {} Message *next; virtual void call(QQmlThread *) = 0; diff --git a/src/qml/qml/ftw/qrecursionwatcher_p.h b/src/qml/qml/ftw/qrecursionwatcher_p.h index 99228b9583..56b714f922 100644 --- a/src/qml/qml/ftw/qrecursionwatcher_p.h +++ b/src/qml/qml/ftw/qrecursionwatcher_p.h @@ -74,7 +74,7 @@ private: }; QRecursionNode::QRecursionNode() -: _r(0) +: _r(nullptr) { } @@ -89,7 +89,7 @@ QRecursionWatcher<T, Node>::QRecursionWatcher(T *t) template<class T, QRecursionNode T::*Node> QRecursionWatcher<T, Node>::~QRecursionWatcher() { - if ((_t->*Node)._r == &_r) (_t->*Node)._r = 0; + if ((_t->*Node)._r == &_r) (_t->*Node)._r = nullptr; } template<class T, QRecursionNode T::*Node> diff --git a/src/qml/qml/ftw/qrecyclepool_p.h b/src/qml/qml/ftw/qrecyclepool_p.h index 42a2f13729..39f4f88512 100644 --- a/src/qml/qml/ftw/qrecyclepool_p.h +++ b/src/qml/qml/ftw/qrecyclepool_p.h @@ -61,7 +61,7 @@ class QRecyclePoolPrivate public: QRecyclePoolPrivate() : recyclePoolHold(true), outstandingItems(0), cookie(QRECYCLEPOOLCOOKIE), - currentPage(0), nextAllocated(0) + currentPage(nullptr), nextAllocated(nullptr) { } @@ -178,7 +178,7 @@ void QRecyclePoolPrivate<T, Step>::releaseIfPossible() template<typename T, int Step> T *QRecyclePoolPrivate<T, Step>::allocate() { - PoolType *rv = 0; + PoolType *rv = nullptr; if (nextAllocated) { rv = nextAllocated; nextAllocated = rv->nextAllocated; diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index 219df264be..213f23cd98 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -354,7 +354,7 @@ int qmlRegisterRevision(const char *uri, int versionMajor, int versionMinor) sizeof(T), QQmlPrivate::createInto<T>, QString(), - uri, versionMajor, versionMinor, 0, &T::staticMetaObject, + uri, versionMajor, versionMinor, nullptr, &T::staticMetaObject, QQmlPrivate::attachedPropertiesFunc<T>(), QQmlPrivate::attachedPropertiesMetaObject<T>(), diff --git a/src/qml/qml/qqmlabstractbinding.cpp b/src/qml/qml/qqmlabstractbinding.cpp index b1c320afd4..42891c1a8e 100644 --- a/src/qml/qml/qqmlabstractbinding.cpp +++ b/src/qml/qml/qqmlabstractbinding.cpp @@ -83,7 +83,7 @@ void QQmlAbstractBinding::addToObject() // Value type // Find the value type proxy (if there is one) - QQmlValueTypeProxyBinding *proxy = 0; + QQmlValueTypeProxyBinding *proxy = nullptr; if (data->hasBindingBit(coreIndex)) { QQmlAbstractBinding *b = data->bindings; while (b && (b->targetPropertyIndex().coreIndex() != coreIndex || @@ -137,7 +137,7 @@ void QQmlAbstractBinding::removeFromObject() QQmlAbstractBinding::Ptr next; next = nextBinding(); - setNextBinding(0); + setNextBinding(nullptr); int coreIndex = targetPropertyIndex().coreIndex(); if (targetPropertyIndex().hasValueTypeIndex()) { diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h index bea2d253e4..fc53be3e7b 100644 --- a/src/qml/qml/qqmlabstractbinding_p.h +++ b/src/qml/qml/qqmlabstractbinding_p.h @@ -95,8 +95,8 @@ public: { return m_nextBinding.flag2(); } struct RefCount { - RefCount() : refCount(0) {} - int refCount; + RefCount() {} + int refCount = 0; void ref() { ++refCount; } int deref() { return --refCount; } operator int() const { return refCount; } diff --git a/src/qml/qml/qqmlapplicationengine.cpp b/src/qml/qml/qqmlapplicationengine.cpp index faab8bf926..a0517e4558 100644 --- a/src/qml/qml/qqmlapplicationengine.cpp +++ b/src/qml/qml/qqmlapplicationengine.cpp @@ -128,7 +128,7 @@ void QQmlApplicationEnginePrivate::finishLoad(QQmlComponent *c) case QQmlComponent::Error: qWarning() << "QQmlApplicationEngine failed to load component"; qWarning() << qPrintable(c->errorString()); - q->objectCreated(0, c->url()); + q->objectCreated(nullptr, c->url()); break; case QQmlComponent::Ready: { auto newObj = c->create(); diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index a968aa908d..ca3bff43a4 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -70,7 +70,7 @@ QQmlBinding *QQmlBinding::create(const QQmlPropertyData *property, const QQmlScr return b; QString url; - QV4::Function *runtimeFunction = 0; + QV4::Function *runtimeFunction = nullptr; QQmlContextData *ctxtdata = QQmlContextData::get(scriptPrivate->context); QQmlEnginePrivate *engine = QQmlEnginePrivate::get(scriptPrivate->context->engine()); @@ -150,7 +150,7 @@ void QQmlBinding::update(QQmlPropertyData::WriteFlags flags) QQmlPropertyData vtd; getPropertyData(&d, &vtd); Q_ASSERT(d); - QQmlProperty p = QQmlPropertyPrivate::restore(targetObject(), *d, &vtd, 0); + QQmlProperty p = QQmlPropertyPrivate::restore(targetObject(), *d, &vtd, nullptr); QQmlAbstractBinding::printBindingLoopError(p); return; } @@ -364,7 +364,7 @@ Q_NEVER_INLINE bool QQmlBinding::slowWrite(const QQmlPropertyData &core, } else if (core.isQList()) { value = v4engine->toVariant(result, qMetaTypeId<QList<QObject *> >()); } else if (result.isNull() && core.isQObject()) { - value = QVariant::fromValue((QObject *)0); + value = QVariant::fromValue((QObject *)nullptr); } else if (core.propType() == qMetaTypeId<QList<QUrl> >()) { value = QQmlPropertyPrivate::resolvedUrlSequence(v4engine->toVariant(result, qMetaTypeId<QList<QUrl> >()), context()); } else if (!isVarProperty && type != qMetaTypeId<QJSValue>()) { @@ -386,7 +386,7 @@ Q_NEVER_INLINE bool QQmlBinding::slowWrite(const QQmlPropertyData &core, Q_ASSERT(vmemo); vmemo->setVMEProperty(core.coreIndex(), result); } else if (isUndefined && core.isResettable()) { - void *args[] = { 0 }; + void *args[] = { nullptr }; QMetaObject::metacall(m_target.data(), QMetaObject::ResetProperty, core.coreIndex(), args); } else if (isUndefined && type == qMetaTypeId<QVariant>()) { QQmlPropertyPrivate::writeValueProperty(m_target.data(), core, valueTypeData, QVariant(), context(), flags); @@ -417,8 +417,8 @@ Q_NEVER_INLINE bool QQmlBinding::slowWrite(const QQmlPropertyData &core, if (watcher.wasDeleted()) return true; - const char *valueType = 0; - const char *propertyType = 0; + const char *valueType = nullptr; + const char *propertyType = nullptr; const int userType = value.userType(); if (userType == QMetaType::QObjectStar) { @@ -530,7 +530,7 @@ void QQmlBinding::setTarget(QObject *object, const QQmlPropertyData &core, const int aValueTypeIndex; if (!vme->aliasTarget(coreIndex, &object, &coreIndex, &aValueTypeIndex)) { - m_target = 0; + m_target = nullptr; m_targetIndex = QQmlPropertyIndex(); return; } @@ -539,7 +539,7 @@ void QQmlBinding::setTarget(QObject *object, const QQmlPropertyData &core, const QQmlData *data = QQmlData::get(object, false); if (!data || !data->propertyCache) { - m_target = 0; + m_target = nullptr; m_targetIndex = QQmlPropertyIndex(); return; } diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 501184b630..060706ac50 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -191,7 +191,7 @@ void QQmlBoundSignalExpression::evaluate(void **a) QQmlMetaObject::ArgTypeStorage storage; //TODO: lookup via signal index rather than method index as an optimization int methodIndex = QMetaObjectPrivate::signal(m_target->metaObject(), m_index).methodIndex(); - int *argsTypes = QQmlMetaObject(m_target).methodParameterTypes(methodIndex, &storage, 0); + int *argsTypes = QQmlMetaObject(m_target).methodParameterTypes(methodIndex, &storage, nullptr); int argCount = argsTypes ? *argsTypes : 0; QV4::JSCallData jsCall(scope, argCount); @@ -222,7 +222,7 @@ void QQmlBoundSignalExpression::evaluate(void **a) } } - QQmlJavaScriptExpression::evaluate(jsCall.callData(), 0); + QQmlJavaScriptExpression::evaluate(jsCall.callData(), nullptr); ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete. } @@ -245,7 +245,7 @@ void QQmlBoundSignalExpression::evaluate(const QList<QVariant> &args) jsCall->args[ii] = scope.engine->fromVariant(args[ii]); } - QQmlJavaScriptExpression::evaluate(jsCall.callData(), 0); + QQmlJavaScriptExpression::evaluate(jsCall.callData(), nullptr); ep->dereferenceScarceResources(); // "release" scarce resources if top-level expression evaluation is complete. } @@ -260,8 +260,8 @@ void QQmlBoundSignalExpression::evaluate(const QList<QVariant> &args) QQmlBoundSignal::QQmlBoundSignal(QObject *target, int signal, QObject *owner, QQmlEngine *engine) : QQmlNotifierEndpoint(QQmlNotifierEndpoint::QQmlBoundSignal), - m_prevSignal(0), m_nextSignal(0), - m_enabled(true), m_expression(0) + m_prevSignal(nullptr), m_nextSignal(nullptr), + m_enabled(true), m_expression(nullptr) { addToObject(owner); @@ -298,8 +298,8 @@ void QQmlBoundSignal::removeFromObject() if (m_prevSignal) { *m_prevSignal = m_nextSignal; if (m_nextSignal) m_nextSignal->m_prevSignal = m_prevSignal; - m_prevSignal = 0; - m_nextSignal = 0; + m_prevSignal = nullptr; + m_nextSignal = nullptr; } } diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h index 3a0b8aed59..d3e584fd13 100644 --- a/src/qml/qml/qqmlboundsignal_p.h +++ b/src/qml/qml/qqmlboundsignal_p.h @@ -89,14 +89,14 @@ public: QString expression() const; QObject *target() const { return m_target; } - QQmlEngine *engine() const { return context() ? context()->engine : 0; } + QQmlEngine *engine() const { return context() ? context()->engine : nullptr; } private: ~QQmlBoundSignalExpression(); void init(QQmlContextData *ctxt, QObject *scope); - bool expressionFunctionValid() const { return function() != 0; } + bool expressionFunctionValid() const { return function() != nullptr; } int m_index; QObject *m_target; diff --git a/src/qml/qml/qqmlboundsignalexpressionpointer_p.h b/src/qml/qml/qqmlboundsignalexpressionpointer_p.h index de651315f8..eabe6666b4 100644 --- a/src/qml/qml/qqmlboundsignalexpressionpointer_p.h +++ b/src/qml/qml/qqmlboundsignalexpressionpointer_p.h @@ -58,7 +58,7 @@ class QQmlBoundSignalExpression; class Q_QML_PRIVATE_EXPORT QQmlBoundSignalExpressionPointer { public: - inline QQmlBoundSignalExpressionPointer() : o(0) {} + inline QQmlBoundSignalExpressionPointer() {} QQmlBoundSignalExpressionPointer(QQmlBoundSignalExpression *); QQmlBoundSignalExpressionPointer(const QQmlBoundSignalExpressionPointer &); ~QQmlBoundSignalExpressionPointer(); @@ -73,7 +73,7 @@ public: QQmlBoundSignalExpressionPointer &take(QQmlBoundSignalExpression *); private: - QQmlBoundSignalExpression *o; + QQmlBoundSignalExpression *o = nullptr; }; QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlcleanup.cpp b/src/qml/qml/qqmlcleanup.cpp index 708537a303..0d57ef5fe8 100644 --- a/src/qml/qml/qqmlcleanup.cpp +++ b/src/qml/qml/qqmlcleanup.cpp @@ -58,7 +58,7 @@ called by QQmlEngine just before it destroys the context. Create a QQmlCleanup that is not associated with any engine. */ QQmlCleanup::QQmlCleanup() -: prev(0), next(0), engine(0) +: prev(nullptr), next(nullptr), engine(nullptr) { } @@ -66,7 +66,7 @@ QQmlCleanup::QQmlCleanup() Create a QQmlCleanup for \a engine */ QQmlCleanup::QQmlCleanup(QQmlEngine *engine) -: prev(0), next(0), engine(0) +: prev(nullptr), next(nullptr), engine(nullptr) { if (!engine) return; @@ -109,8 +109,8 @@ QQmlCleanup::~QQmlCleanup() if (prev) *prev = next; if (next) next->prev = prev; - prev = 0; - next = 0; + prev = nullptr; + next = nullptr; } QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlcleanup_p.h b/src/qml/qml/qqmlcleanup_p.h index a1db656477..0e15c28b9d 100644 --- a/src/qml/qml/qqmlcleanup_p.h +++ b/src/qml/qml/qqmlcleanup_p.h @@ -64,7 +64,7 @@ public: QQmlCleanup(QQmlEngine *); virtual ~QQmlCleanup(); - bool hasEngine() const { return prev != 0; } + bool hasEngine() const { return prev != nullptr; } void addToEngine(QQmlEngine *); protected: virtual void clear() = 0; diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 481507946d..061f3b54a5 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -315,7 +315,7 @@ void QQmlComponentPrivate::typeDataReady(QQmlTypeData *) Q_ASSERT(typeData); fromTypeData(typeData); - typeData = 0; + typeData = nullptr; progress = 1.0; emit q->statusChanged(q->status()); @@ -349,7 +349,7 @@ void QQmlComponentPrivate::clear() if (typeData) { typeData->unregisterCallback(this); typeData->release(); - typeData = 0; + typeData = nullptr; } compilationUnit = nullptr; @@ -820,27 +820,27 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context) Q_Q(QQmlComponent); if (!context) { qWarning("QQmlComponent: Cannot create a component in a null context"); - return 0; + return nullptr; } if (!context->isValid()) { qWarning("QQmlComponent: Cannot create a component in an invalid context"); - return 0; + return nullptr; } if (context->engine != engine) { qWarning("QQmlComponent: Must create component in context from the same QQmlEngine"); - return 0; + return nullptr; } if (state.completePending) { qWarning("QQmlComponent: Cannot create new component instance before completing the previous"); - return 0; + return nullptr; } if (!q->isReady()) { qWarning("QQmlComponent: Component is not ready"); - return 0; + return nullptr; } // Do not create infinite recursion in object creation @@ -848,7 +848,7 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context) if (++creationDepth.localData() >= maxCreationDepth) { qWarning("QQmlComponent: Component creation is recursing - aborting"); --creationDepth.localData(); - return 0; + return nullptr; } Q_ASSERT(creationDepth.localData() >= 1); depthIncreased = true; @@ -860,7 +860,7 @@ QQmlComponentPrivate::beginCreate(QQmlContextData *context) state.completePending = true; enginePriv->referenceScarceResources(); - QObject *rv = 0; + QObject *rv = nullptr; state.creator.reset(new QQmlObjectCreator(context, compilationUnit, creationContext)); rv = state.creator->create(start); if (!rv) @@ -965,7 +965,7 @@ void QQmlComponentPrivate::completeCreate() } QQmlComponentAttached::QQmlComponentAttached(QObject *parent) -: QObject(parent), prev(0), next(0) +: QObject(parent), prev(nullptr), next(nullptr) { } @@ -973,8 +973,8 @@ QQmlComponentAttached::~QQmlComponentAttached() { if (prev) *prev = next; if (next) next->prev = prev; - prev = 0; - next = 0; + prev = nullptr; + next = nullptr; } /*! @@ -1269,7 +1269,7 @@ void QQmlComponent::createObject(QQmlV4Function *args) Q_ASSERT(d->engine); Q_ASSERT(args); - QObject *parent = 0; + QObject *parent = nullptr; QV4::ExecutionEngine *v4 = args->v4engine(); QV4::Scope scope(v4); QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue()); @@ -1386,7 +1386,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args) QV4::ExecutionEngine *v4 = args->v4engine(); QV4::Scope scope(v4); - QObject *parent = 0; + QObject *parent = nullptr; QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue()); QQmlIncubator::IncubationMode mode = QQmlIncubator::Asynchronous; @@ -1457,8 +1457,8 @@ QQmlComponentExtension::QQmlComponentExtension(QV4::ExecutionEngine *v4) QV4::ScopedObject proto(scope, v4->newObject()); proto->defineAccessorProperty(QStringLiteral("onStatusChanged"), QV4::QmlIncubatorObject::method_get_statusChanged, QV4::QmlIncubatorObject::method_set_statusChanged); - proto->defineAccessorProperty(QStringLiteral("status"), QV4::QmlIncubatorObject::method_get_status, 0); - proto->defineAccessorProperty(QStringLiteral("object"), QV4::QmlIncubatorObject::method_get_object, 0); + proto->defineAccessorProperty(QStringLiteral("status"), QV4::QmlIncubatorObject::method_get_status, nullptr); + proto->defineAccessorProperty(QStringLiteral("object"), QV4::QmlIncubatorObject::method_get_object, nullptr); proto->defineDefaultProperty(QStringLiteral("forceCompletion"), QV4::QmlIncubatorObject::method_forceCompletion); incubationProto.set(v4, proto); diff --git a/src/qml/qml/qqmlcomponent_p.h b/src/qml/qml/qqmlcomponent_p.h index 8a58a1ada0..2a8d36f317 100644 --- a/src/qml/qml/qqmlcomponent_p.h +++ b/src/qml/qml/qqmlcomponent_p.h @@ -79,7 +79,7 @@ class Q_QML_PRIVATE_EXPORT QQmlComponentPrivate : public QObjectPrivate, public public: QQmlComponentPrivate() - : typeData(0), progress(0.), start(-1), engine(0), creationContext(0), depthIncreased(false) {} + : typeData(nullptr), progress(0.), start(-1), engine(nullptr), creationContext(nullptr), depthIncreased(false) {} void loadUrl(const QUrl &newUrl, QQmlComponent::CompilationMode mode = QQmlComponent::PreferSynchronous); diff --git a/src/qml/qml/qqmlcomponentattached_p.h b/src/qml/qml/qqmlcomponentattached_p.h index 8236aac1af..e3bca18857 100644 --- a/src/qml/qml/qqmlcomponentattached_p.h +++ b/src/qml/qml/qqmlcomponentattached_p.h @@ -62,7 +62,7 @@ class Q_QML_PRIVATE_EXPORT QQmlComponentAttached : public QObject { Q_OBJECT public: - QQmlComponentAttached(QObject *parent = 0); + QQmlComponentAttached(QObject *parent = nullptr); ~QQmlComponentAttached(); void add(QQmlComponentAttached **a) { @@ -72,7 +72,7 @@ public: void rem() { if (next) next->prev = prev; *prev = next; - next = 0; prev = 0; + next = nullptr; prev = nullptr; } QQmlComponentAttached **prev; QQmlComponentAttached *next; diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index 82b8d06dc4..6e43bc735f 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE QQmlContextPrivate::QQmlContextPrivate() -: data(0), notifyIndex(-1) +: data(nullptr), notifyIndex(-1) { } @@ -177,7 +177,7 @@ QQmlContext::QQmlContext(QQmlEngine *engine, QObject *parent) d->data = new QQmlContextData(this); ++d->data->refCount; - d->data->setParent(engine?QQmlContextData::get(engine->rootContext()):0); + d->data->setParent(engine?QQmlContextData::get(engine->rootContext()):nullptr); } /*! @@ -191,14 +191,14 @@ QQmlContext::QQmlContext(QQmlContext *parentContext, QObject *parent) d->data = new QQmlContextData(this); ++d->data->refCount; - d->data->setParent(parentContext?QQmlContextData::get(parentContext):0); + d->data->setParent(parentContext?QQmlContextData::get(parentContext):nullptr); } /*! \internal */ QQmlContext::QQmlContext(QQmlContextData *data) -: QObject(*(new QQmlContextPrivate), 0) +: QObject(*(new QQmlContextPrivate), nullptr) { Q_D(QQmlContext); d->data = data; @@ -216,7 +216,7 @@ QQmlContext::~QQmlContext() { Q_D(QQmlContext); - d->data->publicContext = 0; + d->data->publicContext = nullptr; if (!--d->data->refCount) d->data->destroy(); } @@ -250,7 +250,7 @@ QQmlEngine *QQmlContext::engine() const QQmlContext *QQmlContext::parentContext() const { Q_D(const QQmlContext); - return d->data->parent?d->data->parent->asQQmlContext():0; + return d->data->parent?d->data->parent->asQQmlContext():nullptr; } /*! @@ -315,7 +315,7 @@ void QQmlContext::setContextProperty(const QString &name, const QVariant &value) data->refreshExpressions(); } else { d->propertyValues[idx] = value; - QMetaObject::activate(this, d->notifyIndex, idx, 0); + QMetaObject::activate(this, d->notifyIndex, idx, nullptr); } } @@ -349,8 +349,8 @@ void QQmlContext::setContextProperties(const QVector<PropertyPair> &properties) QQmlJavaScriptExpression *expressions = data->expressions; QQmlContextData *childContexts = data->childContexts; - data->expressions = 0; - data->childContexts = 0; + data->expressions = nullptr; + data->childContexts = nullptr; for (auto property : properties) setContextProperty(property.name, property.value); @@ -521,7 +521,7 @@ QObject *QQmlContextPrivate::context_at(QQmlListProperty<QObject> *prop, int ind int contextProperty = (int)(quintptr)prop->data; if (d->propertyValues.at(contextProperty).userType() != qMetaTypeId<QList<QObject*> >()) { - return 0; + return nullptr; } else { return ((const QList<QObject*> *)d->propertyValues.at(contextProperty).constData())->at(index); } @@ -534,12 +534,12 @@ QQmlContextData::QQmlContextData() } QQmlContextData::QQmlContextData(QQmlContext *ctxt) - : engine(0), isInternal(false), isJSContext(false), + : engine(nullptr), isInternal(false), isJSContext(false), isPragmaLibraryContext(false), unresolvedNames(false), hasEmittedDestruction(false), isRootObjectInCreation(false), - publicContext(ctxt), incubator(0), componentObjectIndex(-1), - contextObject(0), nextChild(0), prevChild(0), - expressions(0), contextObjects(0), idValues(0), idValueCount(0), - componentAttached(0) + publicContext(ctxt), incubator(nullptr), componentObjectIndex(-1), + contextObject(nullptr), nextChild(nullptr), prevChild(nullptr), + expressions(nullptr), contextObjects(nullptr), idValues(nullptr), idValueCount(0), + componentAttached(nullptr) { } @@ -556,8 +556,8 @@ void QQmlContextData::emitDestruction() componentAttached = a->next; if (componentAttached) componentAttached->prev = &componentAttached; - a->next = 0; - a->prev = 0; + a->next = nullptr; + a->prev = nullptr; emit a->destruction(); } @@ -583,14 +583,14 @@ void QQmlContextData::invalidate() if (prevChild) { *prevChild = nextChild; if (nextChild) nextChild->prevChild = prevChild; - nextChild = 0; - prevChild = 0; + nextChild = nullptr; + prevChild = nullptr; } importedScripts.clear(); - engine = 0; - parent = 0; + engine = nullptr; + parent = nullptr; } void QQmlContextData::clearContext() @@ -601,20 +601,20 @@ void QQmlContextData::clearContext() while (expression) { QQmlJavaScriptExpression *nextExpression = expression->m_nextExpression; - expression->m_prevExpression = 0; - expression->m_nextExpression = 0; + expression->m_prevExpression = nullptr; + expression->m_nextExpression = nullptr; - expression->setContext(0); + expression->setContext(nullptr); expression = nextExpression; } - expressions = 0; + expressions = nullptr; } void QQmlContextData::destroy() { Q_ASSERT(refCount == 0); - linkedContext = 0; + linkedContext = nullptr; // avoid recursion ++refCount; @@ -629,26 +629,26 @@ void QQmlContextData::destroy() QQmlData *co = contextObjects; contextObjects = contextObjects->nextContextObject; - co->context = 0; - co->outerContext = 0; - co->nextContextObject = 0; - co->prevContextObject = 0; + co->context = nullptr; + co->outerContext = nullptr; + co->nextContextObject = nullptr; + co->prevContextObject = nullptr; } Q_ASSERT(refCount == 1); QQmlGuardedContextData *contextGuard = contextGuards; while (contextGuard) { QQmlGuardedContextData *next = contextGuard->m_next; - contextGuard->m_next = 0; - contextGuard->m_prev = 0; - contextGuard->m_contextData = 0; + contextGuard->m_next = nullptr; + contextGuard->m_prev = nullptr; + contextGuard->m_contextData = nullptr; contextGuard = next; } - contextGuards = 0; + contextGuards = nullptr; Q_ASSERT(refCount == 1); delete [] idValues; - idValues = 0; + idValues = nullptr; Q_ASSERT(refCount == 1); if (publicContext) { @@ -746,7 +746,7 @@ void QQmlContextData::refreshExpressionsRecursive(bool isGlobal) // *structure* (not values) changes. void QQmlContextData::refreshExpressions() { - bool isGlobal = (parent == 0); + bool isGlobal = (parent == nullptr); // For efficiency, we try and minimize the number of guards we have to create if (expressions_to_run(this, isGlobal) && childContexts) { @@ -772,7 +772,7 @@ void QQmlContextData::addObject(QObject *o) { QQmlData *data = QQmlData::get(o, true); - Q_ASSERT(data->context == 0); + Q_ASSERT(data->context == nullptr); data->context = this; data->outerContext = this; diff --git a/src/qml/qml/qqmlcontext_p.h b/src/qml/qml/qqmlcontext_p.h index 8939c810fe..ff36d6c9a8 100644 --- a/src/qml/qml/qqmlcontext_p.h +++ b/src/qml/qml/qqmlcontext_p.h @@ -178,7 +178,7 @@ public: QQmlRefPointer<QQmlTypeNameCache> imports; // My children - QQmlContextData *childContexts = 0; + QQmlContextData *childContexts = nullptr; // My peers in parent's childContexts list QQmlContextData *nextChild; @@ -191,7 +191,7 @@ public: QQmlData *contextObjects; // Doubly-linked list of context guards (XXX merge with contextObjects) - QQmlGuardedContextData *contextGuards = 0; + QQmlGuardedContextData *contextGuards = nullptr; // id guards struct ContextGuard : public QQmlGuard<QObject> @@ -261,9 +261,9 @@ private: inline void clear(); - QQmlContextData *m_contextData = 0; - QQmlGuardedContextData *m_next = 0; - QQmlGuardedContextData **m_prev = 0; + QQmlContextData *m_contextData = nullptr; + QQmlGuardedContextData *m_next = nullptr; + QQmlGuardedContextData **m_prev = nullptr; }; @@ -287,14 +287,14 @@ void QQmlGuardedContextData::clear() if (m_prev) { *m_prev = m_next; if (m_next) m_next->m_prev = m_prev; - m_contextData = 0; - m_next = 0; - m_prev = 0; + m_contextData = nullptr; + m_next = nullptr; + m_prev = nullptr; } } QQmlContextDataRef::QQmlContextDataRef() - : m_contextData(0) + : m_contextData(nullptr) { } @@ -338,7 +338,7 @@ void QQmlContextDataRef::clear() { if (m_contextData && !--m_contextData->refCount) m_contextData->destroy(); - m_contextData = 0; + m_contextData = nullptr; } QQmlContextDataRef & @@ -356,7 +356,7 @@ QQmlContextDataRef::operator=(const QQmlContextDataRef &other) } QQmlContextData::ContextGuard::ContextGuard() -: context(0) +: context(nullptr) { } diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp index cc6e75a39c..5cf87f5264 100644 --- a/src/qml/qml/qqmlcustomparser.cpp +++ b/src/qml/qml/qqmlcustomparser.cpp @@ -138,7 +138,7 @@ int QQmlCustomParser::evaluateEnum(const QByteArray& script, bool *ok) const QQmlType type; if (imports.isT1()) { - imports.asT1()->resolveType(scope, &type, 0, 0, 0); + imports.asT1()->resolveType(scope, &type, nullptr, nullptr, nullptr); } else { QQmlTypeNameCache::Result result = imports.asT2()->query(scope); if (result.isValid()) @@ -178,7 +178,7 @@ const QMetaObject *QQmlCustomParser::resolveType(const QString& name) const if (!imports.isT1()) return nullptr; QQmlType qmltype; - if (!imports.asT1()->resolveType(name, &qmltype, 0, 0, 0)) + if (!imports.asT1()->resolveType(name, &qmltype, nullptr, nullptr, nullptr)) return nullptr; return qmltype.metaObject(); } diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h index 5eb409990d..2a0f805014 100644 --- a/src/qml/qml/qqmlcustomparser_p.h +++ b/src/qml/qml/qqmlcustomparser_p.h @@ -74,8 +74,8 @@ public: }; Q_DECLARE_FLAGS(Flags, Flag) - QQmlCustomParser() : engine(0), validator(0), m_flags(NoFlag) {} - QQmlCustomParser(Flags f) : engine(0), validator(0), m_flags(f) {} + QQmlCustomParser() : engine(nullptr), validator(nullptr), m_flags(NoFlag) {} + QQmlCustomParser(Flags f) : engine(nullptr), validator(nullptr), m_flags(f) {} virtual ~QQmlCustomParser() {} void clearErrors(); diff --git a/src/qml/qml/qqmldata_p.h b/src/qml/qml/qqmldata_p.h index 17d145f939..20b96d2c4b 100644 --- a/src/qml/qml/qqmldata_p.h +++ b/src/qml/qml/qqmldata_p.h @@ -195,9 +195,9 @@ public: void disconnectNotifiers(); // The context that created the C++ object - QQmlContextData *context = 0; + QQmlContextData *context = nullptr; // The outermost context in which this object lives - QQmlContextData *outerContext = 0; + QQmlContextData *outerContext = nullptr; QQmlContextDataRef ownContext; QQmlAbstractBinding *bindings; @@ -247,13 +247,13 @@ public: // to be avoided because QObjectPrivate::currentChildBeingDeleted is in use. if (priv->isDeletingChildren || priv->wasDeleted) { Q_ASSERT(!create); - return 0; + return nullptr; } else if (priv->declarativeData) { return static_cast<QQmlData *>(priv->declarativeData); } else if (create) { return createQQmlData(priv); } else { - return 0; + return nullptr; } } @@ -264,7 +264,7 @@ public: return false; } - bool hasExtendedData() const { return extendedData != 0; } + bool hasExtendedData() const { return extendedData != nullptr; } QHash<int, QObject *> *attachedProperties() const; static inline bool wasDeleted(const QObject *); @@ -325,7 +325,7 @@ QQmlNotifierEndpoint *QQmlData::notify(int index) Q_ASSERT(index <= 0xFFFF); if (!notifyList || !(notifyList->connectionMask & (1ULL << quint64(index % 64)))) { - return 0; + return nullptr; } else if (index < notifyList->notifiesSize) { return notifyList->notifies[index]; } else if (index <= notifyList->maximumTodoIndex) { @@ -335,7 +335,7 @@ QQmlNotifierEndpoint *QQmlData::notify(int index) if (index < notifyList->notifiesSize) { return notifyList->notifies[index]; } else { - return 0; + return nullptr; } } diff --git a/src/qml/qml/qqmldelayedcallqueue.cpp b/src/qml/qml/qqmldelayedcallqueue.cpp index 268f91c8ba..5bcf5cd586 100644 --- a/src/qml/qml/qqmldelayedcallqueue.cpp +++ b/src/qml/qml/qqmldelayedcallqueue.cpp @@ -89,7 +89,7 @@ void QQmlDelayedCallQueue::DelayedFunctionCall::execute(QV4::ExecutionEngine *en // QQmlDelayedCallQueue::QQmlDelayedCallQueue() - : QObject(0), m_engine(0), m_callbackOutstanding(false) + : QObject(nullptr), m_engine(nullptr), m_callbackOutstanding(false) { } diff --git a/src/qml/qml/qqmldirparser_p.h b/src/qml/qml/qqmldirparser_p.h index 1530b7a6cf..95370398ad 100644 --- a/src/qml/qml/qqmldirparser_p.h +++ b/src/qml/qml/qqmldirparser_p.h @@ -91,8 +91,7 @@ public: struct Component { - Component() - : majorVersion(0), minorVersion(0), internal(false), singleton(false) {} + Component() {} Component(const QString &typeName, const QString &fileName, int majorVersion, int minorVersion) : typeName(typeName), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion), @@ -100,24 +99,23 @@ public: QString typeName; QString fileName; - int majorVersion; - int minorVersion; - bool internal; - bool singleton; + int majorVersion = 0; + int minorVersion = 0; + bool internal = false; + bool singleton = false; }; struct Script { - Script() - : majorVersion(0), minorVersion(0) {} + Script() {} Script(const QString &nameSpace, const QString &fileName, int majorVersion, int minorVersion) : nameSpace(nameSpace), fileName(fileName), majorVersion(majorVersion), minorVersion(minorVersion) {} QString nameSpace; QString fileName; - int majorVersion; - int minorVersion; + int majorVersion = 0; + int minorVersion = 0; }; QHash<QString,Component> components() const; diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 3de2f736cd..0e74baf684 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -676,19 +676,19 @@ the same object as is returned from the Qt.include() call. // Qt.include() is implemented in qv4include.cpp QQmlEnginePrivate::QQmlEnginePrivate(QQmlEngine *e) -: propertyCapture(0), rootContext(0), +: propertyCapture(nullptr), rootContext(nullptr), #if QT_CONFIG(qml_debug) - profiler(0), + profiler(nullptr), #endif outputWarningsToMsgLog(true), - cleanup(0), erroredBindings(0), inProgressCreations(0), - workerScriptEngine(0), - activeObjectCreator(0), + cleanup(nullptr), erroredBindings(nullptr), inProgressCreations(0), + workerScriptEngine(nullptr), + activeObjectCreator(nullptr), #if QT_CONFIG(qml_network) - networkAccessManager(0), networkAccessManagerFactory(0), + networkAccessManager(nullptr), networkAccessManagerFactory(nullptr), #endif - urlInterceptor(0), scarceResourcesRefCount(0), importDatabase(e), typeLoader(e), - uniqueId(1), incubatorCount(0), incubationController(0) + urlInterceptor(nullptr), scarceResourcesRefCount(0), importDatabase(e), typeLoader(e), + uniqueId(1), incubatorCount(0), incubationController(nullptr) { } @@ -701,15 +701,15 @@ QQmlEnginePrivate::~QQmlEnginePrivate() QQmlCleanup *c = cleanup; cleanup = c->next; if (cleanup) cleanup->prev = &cleanup; - c->next = 0; - c->prev = 0; + c->next = nullptr; + c->prev = nullptr; c->clear(); } doDeleteInEngineThread(); - if (incubationController) incubationController->d = 0; - incubationController = 0; + if (incubationController) incubationController->d = nullptr; + incubationController = nullptr; QQmlMetaType::freeUnusedTypesAndCaches(); @@ -738,8 +738,8 @@ void QQmlPrivate::qdeclarativeelement_destructor(QObject *o) d->ownContext->invalidate(); if (d->ownContext->contextObject == o) d->ownContext->contextObject = nullptr; - d->ownContext = 0; - d->context = 0; + d->ownContext = nullptr; + d->context = nullptr; } // Mark this object as in the process of deletion to @@ -757,10 +757,10 @@ QQmlData::QQmlData() : ownedByQml1(false), ownMemory(true), indestructible(true), explicitIndestructibleSet(false), hasTaintedV4Object(false), isQueuedForDeletion(false), rootObjectInCreation(false), hasInterceptorMetaObject(false), hasVMEMetaObject(false), parentFrozen(false), - bindingBitsArraySize(InlineBindingArraySize), notifyList(0), - bindings(0), signalHandlers(0), nextContextObject(0), prevContextObject(0), + bindingBitsArraySize(InlineBindingArraySize), notifyList(nullptr), + bindings(nullptr), signalHandlers(nullptr), nextContextObject(nullptr), prevContextObject(nullptr), lineNumber(0), columnNumber(0), jsEngineId(0), - propertyCache(0), guards(0), extendedData(0) + propertyCache(nullptr), guards(nullptr), extendedData(nullptr) { memset(bindingBitsValue, 0, sizeof(bindingBitsValue)); init(); @@ -833,7 +833,7 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in void **args = (void **) malloc((parameterTypes.count() + 1) *sizeof(void *)); types[0] = 0; // return type - args[0] = 0; // return value + args[0] = nullptr; // return value for (int ii = 0; ii < parameterTypes.count(); ++ii) { const QByteArray &typeName = parameterTypes.at(ii); @@ -854,7 +854,7 @@ void QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *object, int in args[ii + 1] = QMetaType::create(types[ii + 1], a[ii + 1]); } - QMetaCallEvent *ev = new QMetaCallEvent(m.methodIndex(), 0, 0, object, index, + QMetaCallEvent *ev = new QMetaCallEvent(m.methodIndex(), 0, nullptr, object, index, parameterTypes.count() + 1, types, args); QQmlThreadNotifierProxyObject *mpo = new QQmlThreadNotifierProxyObject; @@ -917,8 +917,8 @@ void QQmlData::setQueuedForDeletion(QObject *object) ddata->context->emitDestruction(); if (ddata->ownContext->contextObject == object) ddata->ownContext->contextObject = nullptr; - ddata->ownContext = 0; - ddata->context = 0; + ddata->ownContext = nullptr; + ddata->context = nullptr; } ddata->isQueuedForDeletion = true; } @@ -1071,7 +1071,7 @@ QQmlEngine::~QQmlEngine() currType.singletonInstanceInfo()->destroy(this); delete d->rootContext; - d->rootContext = 0; + d->rootContext = nullptr; } /*! \fn void QQmlEngine::quit() @@ -1184,7 +1184,7 @@ void QQmlEnginePrivate::registerFinalizeCallback(QObject *obj, int index) if (activeObjectCreator) { activeObjectCreator->finalizeCallbacks()->append(qMakePair(QPointer<QObject>(obj), index)); } else { - void *args[] = { 0 }; + void *args[] = { nullptr }; QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, index, args); } } @@ -1401,13 +1401,13 @@ void QQmlEngine::retranslate() QQmlContext *QQmlEngine::contextForObject(const QObject *object) { if(!object) - return 0; + return nullptr; QQmlData *data = QQmlData::get(object); if (data && data->outerContext) return data->outerContext->asQQmlContext(); - return 0; + return nullptr; } /*! @@ -1555,7 +1555,7 @@ QQmlEngine *qmlEngine(const QObject *obj) { QQmlData *data = QQmlData::get(obj, false); if (!data || !data->context) - return 0; + return nullptr; return data->context->engine; } @@ -1563,7 +1563,7 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre { QQmlData *data = QQmlData::get(object, create); if (!data) - return 0; // Attached properties are only on objects created by QML, unless explicitly requested (create==true) + return nullptr; // Attached properties are only on objects created by QML, unless explicitly requested (create==true) QObject *rv = data->hasExtendedData()?data->attachedProperties()->value(id):0; if (rv || !create) @@ -1572,7 +1572,7 @@ QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool cre QQmlEnginePrivate *engine = QQmlEnginePrivate::get(data->context); QQmlAttachedPropertiesFunc pf = QQmlMetaType::attachedPropertiesFuncById(engine, id); if (!pf) - return 0; + return nullptr; rv = pf(const_cast<QObject *>(object)); @@ -1586,12 +1586,12 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object, const QMetaObject *attachedMetaObject, bool create) { if (*idCache == -1) { - QQmlEngine *engine = object ? qmlEngine(object) : 0; - *idCache = QQmlMetaType::attachedPropertiesFuncId(engine ? QQmlEnginePrivate::get(engine) : 0, attachedMetaObject); + QQmlEngine *engine = object ? qmlEngine(object) : nullptr; + *idCache = QQmlMetaType::attachedPropertiesFuncId(engine ? QQmlEnginePrivate::get(engine) : nullptr, attachedMetaObject); } if (*idCache == -1 || !object) - return 0; + return nullptr; return qmlAttachedPropertiesObjectById(*idCache, object, create); } @@ -1651,7 +1651,7 @@ void QQmlData::NotifyList::layout(QQmlNotifierEndpoint *endpoint) { // Add a temporary sentinel at beginning of list. This will be overwritten // when the end point is inserted into the notifies further down. - endpoint->prev = 0; + endpoint->prev = nullptr; while (endpoint->next) { Q_ASSERT(reinterpret_cast<QQmlNotifierEndpoint *>(endpoint->next->prev) == endpoint); @@ -1697,7 +1697,7 @@ void QQmlData::NotifyList::layout() } maximumTodoIndex = 0; - todo = 0; + todo = nullptr; } void QQmlData::deferData(int objectIndex, QV4::CompiledData::CompilationUnit *compilationUnit, QQmlContextData *context) @@ -1741,8 +1741,8 @@ void QQmlData::addNotify(int index, QQmlNotifierEndpoint *endpoint) notifyList->connectionMask = 0; notifyList->maximumTodoIndex = 0; notifyList->notifiesSize = 0; - notifyList->todo = 0; - notifyList->notifies = 0; + notifyList->todo = nullptr; + notifyList->notifies = nullptr; } Q_ASSERT(!endpoint->isConnected()); @@ -1778,7 +1778,7 @@ void QQmlData::disconnectNotifiers() } free(notifyList->notifies); free(notifyList); - notifyList = 0; + notifyList = nullptr; } } @@ -1840,8 +1840,8 @@ void QQmlData::destroyed(QObject *object) } QQmlBoundSignal *next = signalHandler->m_nextSignal; - signalHandler->m_prevSignal = 0; - signalHandler->m_nextSignal = 0; + signalHandler->m_prevSignal = nullptr; + signalHandler->m_nextSignal = nullptr; delete signalHandler; signalHandler = next; } @@ -1852,11 +1852,11 @@ void QQmlData::destroyed(QObject *object) if (propertyCache) propertyCache->release(); - ownContext = 0; + ownContext = nullptr; while (guards) { QQmlGuard<QObject> *guard = static_cast<QQmlGuard<QObject> *>(guards); - *guard = (QObject *)0; + *guard = (QObject *)nullptr; guard->objectDestroyed(object); } @@ -1994,23 +1994,23 @@ static void dumpwarning(const QQmlError &error) switch (error.messageType()) { case QtDebugMsg: QMessageLogger(error.url().toString().toLatin1().constData(), - error.line(), 0).debug().nospace() + error.line(), nullptr).debug().nospace() << qPrintable(error.toString()); break; case QtInfoMsg: QMessageLogger(error.url().toString().toLatin1().constData(), - error.line(), 0).info().nospace() + error.line(), nullptr).info().nospace() << qPrintable(error.toString()); break; case QtWarningMsg: case QtFatalMsg: // fatal does not support streaming, and furthermore, is actually fatal. Probably not desirable for QML. QMessageLogger(error.url().toString().toLatin1().constData(), - error.line(), 0).warning().nospace() + error.line(), nullptr).warning().nospace() << qPrintable(error.toString()); break; case QtCriticalMsg: QMessageLogger(error.url().toString().toLatin1().constData(), - error.line(), 0).critical().nospace() + error.line(), nullptr).critical().nospace() << qPrintable(error.toString()); break; } @@ -2347,7 +2347,7 @@ QQmlPropertyCache *QQmlEnginePrivate::propertyCacheForType(int t) } else { QQmlType type = QQmlMetaType::qmlType(t); locker.unlock(); - return type.isValid() ? cache(type.metaObject()) : 0; + return type.isValid() ? cache(type.metaObject()) : nullptr; } } @@ -2362,9 +2362,9 @@ QQmlPropertyCache *QQmlEnginePrivate::rawPropertyCacheForType(int t, int minorVe locker.unlock(); if (minorVersion >= 0) - return type.isValid() ? cache(type, minorVersion) : 0; + return type.isValid() ? cache(type, minorVersion) : nullptr; else - return type.isValid() ? cache(type.baseMetaObject()) : 0; + return type.isValid() ? cache(type.baseMetaObject()) : nullptr; } } diff --git a/src/qml/qml/qqmlengine_p.h b/src/qml/qml/qqmlengine_p.h index f12409ed9a..2dfbd42e57 100644 --- a/src/qml/qml/qqmlengine_p.h +++ b/src/qml/qml/qqmlengine_p.h @@ -213,7 +213,7 @@ public: // These methods may be called from the loader thread bool isQObject(int); - QObject *toQObject(const QVariant &, bool *ok = 0) const; + QObject *toQObject(const QVariant &, bool *ok = nullptr) const; QQmlMetaType::TypeCategory typeCategory(int) const; bool isList(int) const; int listType(int) const; @@ -265,7 +265,7 @@ private: static bool s_designerMode; // These members is protected by the full QQmlEnginePrivate::mutex mutex - struct Deletable { Deletable():next(0) {} virtual ~Deletable() {} Deletable *next; }; + struct Deletable { Deletable():next(nullptr) {} virtual ~Deletable() {} Deletable *next; }; QFieldList<Deletable, &Deletable::next> toDeleteInEngineThread; void doDeleteInEngineThread(); @@ -411,12 +411,12 @@ const QQmlEnginePrivate *QQmlEnginePrivate::get(const QQmlEngine *e) QQmlEnginePrivate *QQmlEnginePrivate::get(QQmlContext *c) { - return (c && c->engine()) ? QQmlEnginePrivate::get(c->engine()) : 0; + return (c && c->engine()) ? QQmlEnginePrivate::get(c->engine()) : nullptr; } QQmlEnginePrivate *QQmlEnginePrivate::get(QQmlContextData *c) { - return (c && c->engine) ? QQmlEnginePrivate::get(c->engine) : 0; + return (c && c->engine) ? QQmlEnginePrivate::get(c->engine) : nullptr; } QQmlEngine *QQmlEnginePrivate::get(QQmlEnginePrivate *p) @@ -430,7 +430,7 @@ QQmlEnginePrivate *QQmlEnginePrivate::get(QV4::ExecutionEngine *e) { QQmlEngine *qmlEngine = e->qmlEngine(); if (!qmlEngine) - return 0; + return nullptr; return get(qmlEngine); } diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp index 1b264b025c..fc5b186b29 100644 --- a/src/qml/qml/qqmlerror.cpp +++ b/src/qml/qml/qqmlerror.cpp @@ -99,7 +99,7 @@ QQmlErrorPrivate::QQmlErrorPrivate() Creates an empty error object. */ QQmlError::QQmlError() -: d(0) +: d(nullptr) { } @@ -107,7 +107,7 @@ QQmlError::QQmlError() Creates a copy of \a other. */ QQmlError::QQmlError(const QQmlError &other) -: d(0) +: d(nullptr) { *this = other; } @@ -119,7 +119,7 @@ QQmlError &QQmlError::operator=(const QQmlError &other) { if (!other.d) { delete d; - d = 0; + d = nullptr; } else { if (!d) d = new QQmlErrorPrivate; @@ -138,7 +138,7 @@ QQmlError &QQmlError::operator=(const QQmlError &other) */ QQmlError::~QQmlError() { - delete d; d = 0; + delete d; d = nullptr; } /*! @@ -146,7 +146,7 @@ QQmlError::~QQmlError() */ bool QQmlError::isValid() const { - return d != 0; + return d != nullptr; } /*! @@ -239,7 +239,7 @@ QObject *QQmlError::object() const { if (d) return d->object; - return 0; + return nullptr; } /*! diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp index 3ba0afc7bd..59cc9bb09f 100644 --- a/src/qml/qml/qqmlexpression.cpp +++ b/src/qml/qml/qqmlexpression.cpp @@ -121,7 +121,7 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, QV4::Function *runtimeFu null expression object and its value will always be an invalid QVariant. */ QQmlExpression::QQmlExpression() -: QObject(*new QQmlExpressionPrivate, 0) +: QObject(*new QQmlExpressionPrivate, nullptr) { } @@ -147,7 +147,7 @@ QQmlExpression::QQmlExpression(const QQmlScriptString &script, QQmlContext *ctxt QQmlContextData *evalCtxtData = QQmlContextData::get(ctxt ? ctxt : scriptPrivate->context); QObject *scopeObject = scope ? scope : scriptPrivate->scope; - QV4::Function *runtimeFunction = 0; + QV4::Function *runtimeFunction = nullptr; if (scriptPrivate->context) { QQmlContextData *ctxtdata = QQmlContextData::get(scriptPrivate->context); @@ -191,7 +191,7 @@ QQmlExpression::QQmlExpression(QQmlContext *ctxt, */ QQmlExpression::QQmlExpression(QQmlContextData *ctxt, QObject *scope, const QString &expression) -: QObject(*new QQmlExpressionPrivate, 0) +: QObject(*new QQmlExpressionPrivate, nullptr) { Q_D(QQmlExpression); d->init(ctxt, expression, scope); @@ -211,7 +211,7 @@ QQmlExpression::~QQmlExpression() QQmlEngine *QQmlExpression::engine() const { Q_D(const QQmlExpression); - return d->context()?d->context()->engine:0; + return d->context()?d->context()->engine:nullptr; } /*! @@ -222,7 +222,7 @@ QQmlContext *QQmlExpression::context() const { Q_D(const QQmlExpression); QQmlContextData *data = d->context(); - return data?data->asQQmlContext():0; + return data?data->asQQmlContext():nullptr; } /*! diff --git a/src/qml/qml/qqmlexpression_p.h b/src/qml/qml/qqmlexpression_p.h index a94ca0fc2d..55059575e1 100644 --- a/src/qml/qml/qqmlexpression_p.h +++ b/src/qml/qml/qqmlexpression_p.h @@ -73,9 +73,9 @@ public: void init(QQmlContextData *, const QString &, QObject *); void init(QQmlContextData *, QV4::Function *runtimeFunction, QObject *); - QVariant value(bool *isUndefined = 0); + QVariant value(bool *isUndefined = nullptr); - QV4::ReturnedValue v4value(bool *isUndefined = 0); + QV4::ReturnedValue v4value(bool *isUndefined = nullptr); static inline QQmlExpressionPrivate *get(QQmlExpression *expr); static inline QQmlExpression *get(QQmlExpressionPrivate *expr); diff --git a/src/qml/qml/qqmlfile.cpp b/src/qml/qml/qqmlfile.cpp index 93c3e8e00c..99031e1e74 100644 --- a/src/qml/qml/qqmlfile.cpp +++ b/src/qml/qml/qqmlfile.cpp @@ -131,7 +131,7 @@ int QQmlFileNetworkReply::replyFinishedIndex = -1; int QQmlFileNetworkReply::replyDownloadProgressIndex = -1; QQmlFileNetworkReply::QQmlFileNetworkReply(QQmlEngine *e, QQmlFilePrivate *p, const QUrl &url) -: m_engine(e), m_p(p), m_redirectCount(0), m_reply(0) +: m_engine(e), m_p(p), m_redirectCount(0), m_reply(nullptr) { if (finishedIndex == -1) { finishedIndex = QMetaMethod::fromSignal(&QQmlFileNetworkReply::finished).methodIndex(); @@ -194,9 +194,9 @@ void QQmlFileNetworkReply::networkFinished() } m_reply->deleteLater(); - m_reply = 0; + m_reply = nullptr; - m_p->reply = 0; + m_p->reply = nullptr; emit finished(); delete this; } @@ -210,7 +210,7 @@ void QQmlFileNetworkReply::networkDownloadProgress(qint64 a, qint64 b) QQmlFilePrivate::QQmlFilePrivate() : error(None) #if QT_CONFIG(qml_network) -, reply(0) +, reply(nullptr) #endif { } @@ -237,7 +237,7 @@ QQmlFile::~QQmlFile() delete d->reply; #endif delete d; - d = 0; + d = nullptr; } bool QQmlFile::isNull() const diff --git a/src/qml/qml/qqmlfileselector.cpp b/src/qml/qml/qqmlfileselector.cpp index be6216d3ff..8666144096 100644 --- a/src/qml/qml/qqmlfileselector.cpp +++ b/src/qml/qml/qqmlfileselector.cpp @@ -115,8 +115,8 @@ QQmlFileSelector::~QQmlFileSelector() { Q_D(QQmlFileSelector); if (d->engine && QQmlFileSelector::get(d->engine) == this) { - d->engine->setUrlInterceptor(0); - d->engine = 0; + d->engine->setUrlInterceptor(nullptr); + d->engine = nullptr; } interceptorInstances()->remove(d->myInstance.data()); } @@ -200,7 +200,7 @@ QQmlFileSelector* QQmlFileSelector::get(QQmlEngine* engine) QQmlAbstractUrlInterceptor* current = engine->urlInterceptor(); if (current && interceptorInstances()->contains(current)) return interceptorInstances()->value(current); - return 0; + return nullptr; } /*! diff --git a/src/qml/qml/qqmlglobal.cpp b/src/qml/qml/qqmlglobal.cpp index 6418812bae..1d60c518c4 100644 --- a/src/qml/qml/qqmlglobal.cpp +++ b/src/qml/qml/qqmlglobal.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QQmlValueTypeProvider::QQmlValueTypeProvider() - : next(0) + : next(nullptr) { } @@ -65,7 +65,7 @@ const QMetaObject *QQmlValueTypeProvider::metaObjectForMetaType(int type) return mo; } while ((p = p->next)); - return 0; + return nullptr; } bool QQmlValueTypeProvider::initValueType(int type, QVariant& dst) @@ -218,7 +218,7 @@ bool QQmlValueTypeProvider::writeValueType(int type, const void *src, QVariant& return false; } -const QMetaObject *QQmlValueTypeProvider::getMetaObjectForMetaType(int) { return 0; } +const QMetaObject *QQmlValueTypeProvider::getMetaObjectForMetaType(int) { return nullptr; } bool QQmlValueTypeProvider::init(int, QVariant&) { return false; } bool QQmlValueTypeProvider::create(int, int, const void *[], QVariant *) { return false; } bool QQmlValueTypeProvider::createFromString(int, const QString &, void *, size_t) { return false; } @@ -232,11 +232,11 @@ bool QQmlValueTypeProvider::read(const QVariant&, void *, int) { return false; } bool QQmlValueTypeProvider::write(int, const void *, QVariant&) { return false; } Q_GLOBAL_STATIC(QQmlValueTypeProvider, nullValueTypeProvider) -static QQmlValueTypeProvider *valueTypeProvider = 0; +static QQmlValueTypeProvider *valueTypeProvider = nullptr; static QQmlValueTypeProvider **getValueTypeProvider(void) { - if (valueTypeProvider == 0) { + if (valueTypeProvider == nullptr) { valueTypeProvider = nullValueTypeProvider; } @@ -294,7 +294,7 @@ QVariant QQmlColorProvider::lighter(const QVariant &, qreal) { return QVariant() QVariant QQmlColorProvider::darker(const QVariant &, qreal) { return QVariant(); } QVariant QQmlColorProvider::tint(const QVariant &, const QVariant &) { return QVariant(); } -static QQmlColorProvider *colorProvider = 0; +static QQmlColorProvider *colorProvider = nullptr; Q_QML_PRIVATE_EXPORT QQmlColorProvider *QQml_setColorProvider(QQmlColorProvider *newProvider) { @@ -305,7 +305,7 @@ Q_QML_PRIVATE_EXPORT QQmlColorProvider *QQml_setColorProvider(QQmlColorProvider static QQmlColorProvider **getColorProvider(void) { - if (colorProvider == 0) { + if (colorProvider == nullptr) { qWarning() << "Warning: QQml_colorProvider: no color provider has been set!"; static QQmlColorProvider nullColorProvider; colorProvider = &nullColorProvider; @@ -345,7 +345,7 @@ QObject *QQmlGuiProvider::styleHints() QString QQmlGuiProvider::pluginName() const { return QString(); } -static QQmlGuiProvider *guiProvider = 0; +static QQmlGuiProvider *guiProvider = nullptr; Q_QML_PRIVATE_EXPORT QQmlGuiProvider *QQml_setGuiProvider(QQmlGuiProvider *newProvider) { @@ -356,7 +356,7 @@ Q_QML_PRIVATE_EXPORT QQmlGuiProvider *QQml_setGuiProvider(QQmlGuiProvider *newPr static QQmlGuiProvider **getGuiProvider(void) { - if (guiProvider == 0) { + if (guiProvider == nullptr) { static QQmlGuiProvider nullGuiProvider; //Still provides an application with no GUI support guiProvider = &nullGuiProvider; } diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h index 5c46da0ea4..302fdd56c4 100644 --- a/src/qml/qml/qqmlglobal_p.h +++ b/src/qml/qml/qqmlglobal_p.h @@ -323,7 +323,7 @@ class Q_QML_PRIVATE_EXPORT QQmlApplication : public QObject Q_PROPERTY(QString organization READ organization WRITE setOrganization NOTIFY organizationChanged) Q_PROPERTY(QString domain READ domain WRITE setDomain NOTIFY domainChanged) public: - QQmlApplication(QObject* parent=0); + QQmlApplication(QObject* parent=nullptr); QStringList args(); @@ -347,7 +347,7 @@ Q_SIGNALS: void domainChanged(); protected: - QQmlApplication(QQmlApplicationPrivate &dd, QObject* parent=0); + QQmlApplication(QQmlApplicationPrivate &dd, QObject* parent=nullptr); private: Q_DISABLE_COPY(QQmlApplication) @@ -368,12 +368,12 @@ public: struct QQmlSourceLocation { - QQmlSourceLocation() : line(0), column(0) {} + QQmlSourceLocation() {} QQmlSourceLocation(const QString &sourceFile, quint16 line, quint16 column) : sourceFile(sourceFile), line(line), column(column) {} QString sourceFile; - quint16 line; - quint16 column; + quint16 line = 0; + quint16 column = 0; }; QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlguard_p.h b/src/qml/qml/qqmlguard_p.h index 52526276be..808bf4c709 100644 --- a/src/qml/qml/qqmlguard_p.h +++ b/src/qml/qml/qqmlguard_p.h @@ -65,9 +65,9 @@ public: inline QQmlGuardImpl(const QQmlGuardImpl &); inline ~QQmlGuardImpl(); - QObject *o; - QQmlGuardImpl *next; - QQmlGuardImpl **prev; + QObject *o = nullptr; + QQmlGuardImpl *next = nullptr; + QQmlGuardImpl **prev = nullptr; inline void addGuard(); inline void remGuard(); @@ -113,18 +113,17 @@ Q_DECLARE_METATYPE(QQmlGuard<QObject>) QT_BEGIN_NAMESPACE QQmlGuardImpl::QQmlGuardImpl() -: o(0), next(0), prev(0) { } QQmlGuardImpl::QQmlGuardImpl(QObject *g) -: o(g), next(0), prev(0) +: o(g) { if (o) addGuard(); } QQmlGuardImpl::QQmlGuardImpl(const QQmlGuardImpl &g) -: o(g.o), next(0), prev(0) +: o(g.o) { if (o) addGuard(); } @@ -132,7 +131,7 @@ QQmlGuardImpl::QQmlGuardImpl(const QQmlGuardImpl &g) QQmlGuardImpl::~QQmlGuardImpl() { if (prev) remGuard(); - o = 0; + o = nullptr; } void QQmlGuardImpl::addGuard() @@ -155,8 +154,8 @@ void QQmlGuardImpl::remGuard() if (next) next->prev = prev; *prev = next; - next = 0; - prev = 0; + next = nullptr; + prev = nullptr; } template<class T> diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index a9113603b8..8e6cbcbd7e 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -728,7 +728,7 @@ bool QQmlImports::resolveType(QQmlImportNamespace *ns, const QHashedStringRef &t QQmlType *type_return, int *vmaj, int *vmin, QQmlType::RegistrationType registrationType) const { - return ns->resolveType(d->typeLoader, type, vmaj, vmin, type_return, 0, 0, registrationType); + return ns->resolveType(d->typeLoader, type, vmaj, vmin, type_return, nullptr, nullptr, registrationType); } bool QQmlImportInstance::resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef& type, @@ -803,7 +803,7 @@ bool QQmlImportInstance::resolveType(QQmlTypeLoader *typeLoader, const QHashedSt int major = vmajor ? *vmajor : -1; int minor = vminor ? *vminor : -1; QQmlType returnType = fetchOrCreateTypeForUrl(componentUrl, type, isCompositeSingleton, - 0, major, minor); + nullptr, major, minor); if (type_return) *type_return = returnType; return returnType.isValid(); @@ -831,7 +831,7 @@ bool QQmlImportInstance::resolveType(QQmlTypeLoader *typeLoader, const QHashedSt *typeRecursionDetected = true; } else { QQmlType returnType = fetchOrCreateTypeForUrl( - qmlUrl, type, registrationType == QQmlType::CompositeSingletonType, 0); + qmlUrl, type, registrationType == QQmlType::CompositeSingletonType, nullptr); if (type_return) *type_return = returnType; return returnType.isValid(); @@ -847,7 +847,7 @@ bool QQmlImportsPrivate::resolveType(const QHashedStringRef& type, int *vmajor, QQmlType::RegistrationType registrationType, QQmlImport::RecursionRestriction recursionRestriction) { - QQmlImportNamespace *s = 0; + QQmlImportNamespace *s = nullptr; int dot = type.indexOf(Dot); if (dot >= 0) { QHashedStringRef namespaceName(type.constData(), dot); @@ -978,7 +978,7 @@ QQmlImportNamespace *QQmlImportsPrivate::findQualifiedNamespace(const QHashedStr if (prefix == ns->prefix) return ns; } - return 0; + return nullptr; } /* @@ -1257,7 +1257,7 @@ bool QQmlImportsPrivate::locateQmldir(const QString &uri, int vmaj, int vmin, QQ // Check cache first - QQmlImportDatabase::QmldirCache *cacheHead = 0; + QQmlImportDatabase::QmldirCache *cacheHead = nullptr; { QQmlImportDatabase::QmldirCache **cachePtr = database->qmldirCache.value(uri); if (cachePtr) { @@ -1389,7 +1389,7 @@ bool QQmlImportsPrivate::validateQmldirVersion(const QQmlTypeLoaderQmldirContent QQmlImportNamespace *QQmlImportsPrivate::importNamespace(const QString &prefix) const { - QQmlImportNamespace *nameSpace = 0; + QQmlImportNamespace *nameSpace = nullptr; if (prefix.isEmpty()) { nameSpace = &unqualifiedset; @@ -1446,7 +1446,7 @@ bool QQmlImportsPrivate::addLibraryImport(const QString& uri, const QString &pre Q_ASSERT(inserted); if (!incomplete) { - const QQmlTypeLoaderQmldirContent *qmldir = 0; + const QQmlTypeLoaderQmldirContent *qmldir = nullptr; if (!qmldirIdentifier.isEmpty()) { if (!getQmldirContent(qmldirIdentifier, uri, &qmldir, errors)) @@ -1565,7 +1565,7 @@ bool QQmlImportsPrivate::addFileImport(const QString& uri, const QString &prefix Q_ASSERT(inserted); if (!incomplete && !qmldirIdentifier.isEmpty()) { - const QQmlTypeLoaderQmldirContent *qmldir = 0; + const QQmlTypeLoaderQmldirContent *qmldir = nullptr; if (!getQmldirContent(qmldirIdentifier, importUri, &qmldir, errors)) return false; @@ -1589,7 +1589,7 @@ bool QQmlImportsPrivate::updateQmldirContent(const QString &uri, const QString & Q_ASSERT(nameSpace); if (QQmlImportInstance *import = nameSpace->findImport(uri)) { - const QQmlTypeLoaderQmldirContent *qmldir = 0; + const QQmlTypeLoaderQmldirContent *qmldir = nullptr; if (!getQmldirContent(qmldirIdentifier, uri, &qmldir, errors)) return false; @@ -2095,7 +2095,7 @@ bool QQmlImportDatabase::importStaticPlugin(QObject *instance, const QString &ba } else { RegisteredPlugin plugin; plugin.uri = uri; - plugin.loader = 0; + plugin.loader = nullptr; plugins->insert(uniquePluginID, plugin); if (!registerPluginTypes(instance, basePath, uri, typeNamespace, vmaj, errors)) @@ -2156,7 +2156,7 @@ bool QQmlImportDatabase::importDynamicPlugin(const QString &filePath, const QStr return false; } - QPluginLoader* loader = 0; + QPluginLoader* loader = nullptr; if (!typesRegistered) { loader = new QPluginLoader(absoluteFilePath); diff --git a/src/qml/qml/qqmlimport_p.h b/src/qml/qml/qqmlimport_p.h index 6298dd9c22..b70bb5253c 100644 --- a/src/qml/qml/qqmlimport_p.h +++ b/src/qml/qml/qqmlimport_p.h @@ -92,7 +92,7 @@ struct QQmlImportInstance bool resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef &type, int *vmajor, int *vminor, QQmlType* type_return, - QString *base = 0, bool *typeRecursionDetected = 0, + QString *base = nullptr, bool *typeRecursionDetected = nullptr, QQmlType::RegistrationType = QQmlType::AnyRegistrationType, QQmlImport::RecursionRestriction recursionRestriction = QQmlImport::PreventRecursion) const; }; @@ -100,7 +100,7 @@ struct QQmlImportInstance class QQmlImportNamespace { public: - QQmlImportNamespace() : nextNamespace(0) {} + QQmlImportNamespace() : nextNamespace(nullptr) {} ~QQmlImportNamespace() { qDeleteAll(imports); } QList<QQmlImportInstance *> imports; @@ -109,7 +109,7 @@ public: bool resolveType(QQmlTypeLoader *typeLoader, const QHashedStringRef& type, int *vmajor, int *vminor, QQmlType* type_return, - QString *base = 0, QList<QQmlError> *errors = 0, + QString *base = nullptr, QList<QQmlError> *errors = nullptr, QQmlType::RegistrationType registrationType = QQmlType::AnyRegistrationType, QQmlImport::RecursionRestriction recursionRestriction = QQmlImport::PreventRecursion); @@ -137,7 +137,7 @@ public: QQmlType *type_return, int *version_major, int *version_minor, QQmlImportNamespace **ns_return, - QList<QQmlError> *errors = 0, + QList<QQmlError> *errors = nullptr, QQmlType::RegistrationType registrationType = QQmlType::AnyRegistrationType, QQmlImport::RecursionRestriction recursionRestriction = QQmlImport::PreventRecursion) const; diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp index 9855c27375..4546a4423f 100644 --- a/src/qml/qml/qqmlincubator.cpp +++ b/src/qml/qml/qqmlincubator.cpp @@ -110,7 +110,7 @@ void QQmlEngine::setIncubationController(QQmlIncubationController *controller) { Q_D(QQmlEngine); if (d->incubationController) - d->incubationController->d = 0; + d->incubationController->d = nullptr; d->incubationController = controller; if (controller) controller->d = d; } @@ -128,7 +128,7 @@ QQmlIncubationController *QQmlEngine::incubationController() const QQmlIncubatorPrivate::QQmlIncubatorPrivate(QQmlIncubator *q, QQmlIncubator::IncubationMode m) : q(q), status(QQmlIncubator::Null), mode(m), isAsynchronous(false), progress(Execute), - result(0), enginePriv(0), waitingOnMe(0) + result(nullptr), enginePriv(nullptr), waitingOnMe(nullptr) { } @@ -147,16 +147,16 @@ void QQmlIncubatorPrivate::clear() if (controller) controller->incubatingObjectCountChanged(enginePriv->incubatorCount); } - enginePriv = 0; + enginePriv = nullptr; if (!rootContext.isNull()) { - rootContext->incubator = 0; - rootContext = 0; + rootContext->incubator = nullptr; + rootContext = nullptr; } if (nextWaitingFor.isInList()) { Q_ASSERT(waitingOnMe); nextWaitingFor.remove(); - waitingOnMe = 0; + waitingOnMe = nullptr; } // if we're waiting on any incubators then they should be cleared too. @@ -171,7 +171,7 @@ void QQmlIncubatorPrivate::clear() vmeGuard.clear(); if (creator && guardOk) creator->clear(); - creator.reset(0); + creator.reset(nullptr); } /*! @@ -218,15 +218,15 @@ than a static amount like 5 milliseconds - while not disturbing the application. Create a new incubation controller. */ QQmlIncubationController::QQmlIncubationController() -: d(0) +: d(nullptr) { } /*! \internal */ QQmlIncubationController::~QQmlIncubationController() { - if (d) QQmlEnginePrivate::get(d)->setIncubationController(0); - d = 0; + if (d) QQmlEnginePrivate::get(d)->setIncubationController(nullptr); + d = nullptr; } /*! @@ -294,8 +294,8 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i) if (progress == QQmlIncubatorPrivate::Execute) { enginePriv->referenceScarceResources(); - QObject *tresult = 0; - tresult = creator->create(subComponentToCreate, /*parent*/0, &i); + QObject *tresult = nullptr; + tresult = creator->create(subComponentToCreate, /*parent*/nullptr, &i); if (!tresult) errors = creator->errors; enginePriv->dereferenceScarceResources(); @@ -304,7 +304,7 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i) return; result = tresult; - if (errors.isEmpty() && result == 0) + if (errors.isEmpty() && result == nullptr) goto finishIncubate; if (result) { @@ -340,7 +340,7 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i) if (watcher.hasRecursed()) return; - QQmlContextData *ctxt = 0; + QQmlContextData *ctxt = nullptr; ctxt = creator->finalize(i); if (ctxt) { rootContext = ctxt; @@ -506,12 +506,12 @@ QQmlIncubator::QQmlIncubator(IncubationMode mode) /*! \internal */ QQmlIncubator::~QQmlIncubator() { - d->q = 0; + d->q = nullptr; if (!d->ref.deref()) { delete d; } - d = 0; + d = nullptr; } /*! @@ -557,18 +557,18 @@ void QQmlIncubator::clear() if (s == Loading) { Q_ASSERT(d->compilationUnit); if (d->result) d->result->deleteLater(); - d->result = 0; + d->result = nullptr; } d->clear(); Q_ASSERT(d->compilationUnit.isNull()); - Q_ASSERT(d->waitingOnMe.data() == 0); + Q_ASSERT(d->waitingOnMe.data() == nullptr); Q_ASSERT(d->waitingFor.isEmpty()); d->errors.clear(); d->progress = QQmlIncubatorPrivate::Execute; - d->result = 0; + d->result = nullptr; if (s == Loading) { Q_ASSERT(enginePriv); @@ -657,7 +657,7 @@ Return the incubated object if the status is Ready, otherwise 0. QObject *QQmlIncubator::object() const { if (status() != Ready) - return 0; + return nullptr; else return d->result; } diff --git a/src/qml/qml/qqmlinfo.cpp b/src/qml/qml/qqmlinfo.cpp index dae15e2eca..c8f5ba506f 100644 --- a/src/qml/qml/qqmlinfo.cpp +++ b/src/qml/qml/qqmlinfo.cpp @@ -182,7 +182,7 @@ QQmlInfo::~QQmlInfo() if (0 == --d->ref) { QList<QQmlError> errors = d->errors; - QQmlEngine *engine = 0; + QQmlEngine *engine = nullptr; if (!d->buffer.isEmpty()) { QQmlError error; diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index cd35ab93c6..74148e3ca4 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -93,12 +93,12 @@ void QQmlDelayedError::catchJavaScriptException(QV4::ExecutionEngine *engine) QQmlJavaScriptExpression::QQmlJavaScriptExpression() - : m_error(0), - m_context(0), - m_prevExpression(0), - m_nextExpression(0), - m_v4Function(0), - m_sourceLocation(0) + : m_error(nullptr), + m_context(nullptr), + m_prevExpression(nullptr), + m_nextExpression(nullptr), + m_v4Function(nullptr), + m_sourceLocation(nullptr) { } @@ -114,7 +114,7 @@ QQmlJavaScriptExpression::~QQmlJavaScriptExpression() clearPermanentGuards(); clearError(); if (m_scopeObject.isT2()) // notify DeleteWatcher of our deletion. - m_scopeObject.asT2()->_s = 0; + m_scopeObject.asT2()->_s = nullptr; delete m_sourceLocation; } @@ -157,8 +157,8 @@ void QQmlJavaScriptExpression::setContext(QQmlContextData *context) *m_prevExpression = m_nextExpression; if (m_nextExpression) m_nextExpression->m_prevExpression = m_prevExpression; - m_prevExpression = 0; - m_nextExpression = 0; + m_prevExpression = nullptr; + m_nextExpression = nullptr; } m_context = context; @@ -211,7 +211,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QV4::CallData *callData, b QQmlPropertyCapture capture(m_context->engine, this, &watcher); QQmlPropertyCapture *lastPropertyCapture = ep->propertyCapture; - ep->propertyCapture = notifyOnValueChanged() ? &capture : 0; + ep->propertyCapture = notifyOnValueChanged() ? &capture : nullptr; if (notifyOnValueChanged()) @@ -253,7 +253,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QV4::CallData *callData, b for (int ii = 0; ii < capture.errorString->count(); ++ii) qWarning("%s", qPrintable(capture.errorString->at(ii))); delete capture.errorString; - capture.errorString = 0; + capture.errorString = nullptr; } while (QQmlJavaScriptExpressionGuard *g = capture.guards.takeFirst()) @@ -274,7 +274,7 @@ void QQmlPropertyCapture::captureProperty(QQmlNotifier *n, Duration duration) while (!guards.isEmpty() && !guards.first()->isConnected(n)) guards.takeFirst()->Delete(); - QQmlJavaScriptExpressionGuard *g = 0; + QQmlJavaScriptExpressionGuard *g = nullptr; if (!guards.isEmpty()) { g = guards.takeFirst(); g->cancelNotify(); @@ -323,7 +323,7 @@ void QQmlPropertyCapture::captureProperty(QObject *o, int c, int n, Duration dur while (!guards.isEmpty() && !guards.first()->isConnected(o, n)) guards.takeFirst()->Delete(); - QQmlJavaScriptExpressionGuard *g = 0; + QQmlJavaScriptExpressionGuard *g = nullptr; if (!guards.isEmpty()) { g = guards.takeFirst(); g->cancelNotify(); diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index 1cb6d7bfd1..a028850074 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -62,7 +62,7 @@ struct QQmlSourceLocation; class QQmlDelayedError { public: - inline QQmlDelayedError() : nextError(0), prevError(0) {} + inline QQmlDelayedError() : nextError(nullptr), prevError(nullptr) {} inline ~QQmlDelayedError() { removeError(); } bool addError(QQmlEnginePrivate *); @@ -71,8 +71,8 @@ public: if (!prevError) return; if (nextError) nextError->prevError = prevError; *prevError = nextError; - nextError = 0; - prevError = 0; + nextError = nullptr; + prevError = nullptr; } inline bool isValid() const { return m_error.isValid(); } @@ -117,7 +117,7 @@ public: QQmlSourceLocation sourceLocation() const; void setSourceLocation(const QQmlSourceLocation &location); - bool isValid() const { return context() != 0; } + bool isValid() const { return context() != nullptr; } QQmlContextData *context() const { return m_context; } void setContext(QQmlContextData *context); @@ -193,11 +193,11 @@ class QQmlPropertyCapture { public: QQmlPropertyCapture(QQmlEngine *engine, QQmlJavaScriptExpression *e, QQmlJavaScriptExpression::DeleteWatcher *w) - : engine(engine), expression(e), watcher(w), errorString(0) { } + : engine(engine), expression(e), watcher(w), errorString(nullptr) { } ~QQmlPropertyCapture() { Q_ASSERT(guards.isEmpty()); - Q_ASSERT(errorString == 0); + Q_ASSERT(errorString == nullptr); } enum Duration { @@ -217,7 +217,7 @@ public: }; QQmlJavaScriptExpression::DeleteWatcher::DeleteWatcher(QQmlJavaScriptExpression *e) -: _c(0), _w(0), _s(e) +: _c(nullptr), _w(nullptr), _s(e) { if (e->m_scopeObject.isT1()) { _w = &_s; @@ -231,14 +231,14 @@ QQmlJavaScriptExpression::DeleteWatcher::DeleteWatcher(QQmlJavaScriptExpression QQmlJavaScriptExpression::DeleteWatcher::~DeleteWatcher() { - Q_ASSERT(*_w == 0 || (*_w == _s && _s->m_scopeObject.isT2())); + Q_ASSERT(*_w == nullptr || (*_w == _s && _s->m_scopeObject.isT2())); if (*_w && _s->m_scopeObject.asT2() == this) _s->m_scopeObject = _c; } bool QQmlJavaScriptExpression::DeleteWatcher::wasDeleted() const { - return *_w == 0; + return *_w == nullptr; } bool QQmlJavaScriptExpression::notifyOnValueChanged() const @@ -272,12 +272,12 @@ inline void QQmlJavaScriptExpression::clearError() { if (m_error) delete m_error; - m_error = 0; + m_error = nullptr; } QQmlJavaScriptExpressionGuard::QQmlJavaScriptExpressionGuard(QQmlJavaScriptExpression *e) : QQmlNotifierEndpoint(QQmlNotifierEndpoint::QQmlJavaScriptExpressionGuard), - expression(e), next(0) + expression(e), next(nullptr) { } diff --git a/src/qml/qml/qqmllist.cpp b/src/qml/qml/qqmllist.cpp index 9bfdd3da35..ac6e3695fe 100644 --- a/src/qml/qml/qqmllist.cpp +++ b/src/qml/qml/qqmllist.cpp @@ -55,7 +55,7 @@ QQmlListReference QQmlListReferencePrivate::init(const QQmlListProperty<QObject> if (!prop.object) return rv; - QQmlEnginePrivate *p = engine?QQmlEnginePrivate::get(engine):0; + QQmlEnginePrivate *p = engine?QQmlEnginePrivate::get(engine):nullptr; int listType = p?p->listType(propType):QQmlMetaType::listType(propType); if (listType == -1) return rv; @@ -117,7 +117,7 @@ The \l {Qt Quick 1} version of this class is named QDeclarativeListReference. Constructs an invalid instance. */ QQmlListReference::QQmlListReference() -: d(0) +: d(nullptr) { } @@ -131,17 +131,17 @@ Passing \a engine is required to access some QML created list properties. If in is available, pass it. */ QQmlListReference::QQmlListReference(QObject *object, const char *property, QQmlEngine *engine) -: d(0) +: d(nullptr) { if (!object || !property) return; QQmlPropertyData local; QQmlPropertyData *data = - QQmlPropertyCache::property(engine, object, QLatin1String(property), 0, local); + QQmlPropertyCache::property(engine, object, QLatin1String(property), nullptr, local); if (!data || !data->isQList()) return; - QQmlEnginePrivate *p = engine?QQmlEnginePrivate::get(engine):0; + QQmlEnginePrivate *p = engine?QQmlEnginePrivate::get(engine):nullptr; int listType = p?p->listType(data->propType()):QQmlMetaType::listType(data->propType()); if (listType == -1) return; @@ -151,7 +151,7 @@ QQmlListReference::QQmlListReference(QObject *object, const char *property, QQml d->elementType = p ? p->rawMetaObjectForType(listType) : QQmlMetaType::qmlType(listType).baseMetaObject(); d->propertyType = data->propType(); - void *args[] = { &d->property, 0 }; + void *args[] = { &d->property, nullptr }; QMetaObject::metacall(object, QMetaObject::ReadProperty, data->coreIndex(), args); } @@ -191,7 +191,7 @@ Returns the list property's object. Returns 0 if the reference is invalid. QObject *QQmlListReference::object() const { if (isValid()) return d->object; - else return 0; + else return nullptr; } /*! @@ -204,7 +204,7 @@ to a list. const QMetaObject *QQmlListReference::listElementType() const { if (isValid()) return d->elementType.metaObject(); - else return 0; + else return nullptr; } /*! @@ -301,7 +301,7 @@ Returns the list element at \a index, or 0 if the operation failed. */ QObject *QQmlListReference::at(int index) const { - if (!canAt()) return 0; + if (!canAt()) return nullptr; return d->property.at(&d->property, index); } diff --git a/src/qml/qml/qqmllist.h b/src/qml/qml/qqmllist.h index 4c6ae0cb8f..90ec57c911 100644 --- a/src/qml/qml/qqmllist.h +++ b/src/qml/qml/qqmllist.h @@ -61,20 +61,15 @@ public: typedef void (*ClearFunction)(QQmlListProperty<T> *); QQmlListProperty() - : object(nullptr), - data(nullptr), - append(nullptr), + : append(nullptr), count(nullptr), at(nullptr), - clear(nullptr), - dummy1(nullptr), - dummy2(nullptr) + clear(nullptr) {} QQmlListProperty(QObject *o, QList<T *> &list) : object(o), data(&list), append(qlist_append), count(qlist_count), at(qlist_at), - clear(qlist_clear), - dummy1(nullptr), - dummy2(nullptr) + clear(qlist_clear) + {} QQmlListProperty(QObject *o, void *d, AppendFunction a, CountFunction c, AtFunction t, ClearFunction r ) @@ -83,18 +78,15 @@ public: append(a), count(c), at(t), - clear(r), - dummy1(nullptr), - dummy2(nullptr) + clear(r) + {} QQmlListProperty(QObject *o, void *d, CountFunction c, AtFunction t) : object(o), data(d), append(nullptr), count(c), at(t), - clear(nullptr), - dummy1(nullptr), - dummy2(nullptr) + clear(nullptr) {} bool operator==(const QQmlListProperty &o) const { return object == o.object && @@ -105,8 +97,8 @@ public: clear == o.clear; } - QObject *object; - void *data; + QObject *object = nullptr; + void *data = nullptr; AppendFunction append; @@ -115,8 +107,8 @@ public: ClearFunction clear; - void *dummy1; - void *dummy2; + void *dummy1 = nullptr; + void *dummy2 = nullptr; private: static void qlist_append(QQmlListProperty *p, T *v) { diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp index cdeb991e11..3fbe3df2ab 100644 --- a/src/qml/qml/qqmllistwrapper.cpp +++ b/src/qml/qml/qqmllistwrapper.cpp @@ -77,7 +77,7 @@ ReturnedValue QmlListWrapper::create(ExecutionEngine *engine, QObject *object, i Scoped<QmlListWrapper> r(scope, engine->memoryManager->allocObject<QmlListWrapper>()); r->d()->object = object; r->d()->propertyType = propType; - void *args[] = { &r->d()->property(), 0 }; + void *args[] = { &r->d()->property(), nullptr }; QMetaObject::metacall(object, QMetaObject::ReadProperty, propId, args); return r.asReturnedValue(); } @@ -151,7 +151,7 @@ bool QmlListWrapper::put(Managed *m, String *name, const Value &value) void QmlListWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attrs) { - name->setM(0); + name->setM(nullptr); *index = UINT_MAX; Q_ASSERT(m->as<QmlListWrapper>()); QmlListWrapper *w = static_cast<QmlListWrapper *>(m); diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index eafe2792c1..2a5c58b47b 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -684,23 +684,23 @@ QV4LocaleDataDeletable::QV4LocaleDataDeletable(QV4::ExecutionEngine *engine) o->defineDefaultProperty(QStringLiteral("monthName"), QQmlLocaleData::method_monthName, 0); o->defineDefaultProperty(QStringLiteral("currencySymbol"), QQmlLocaleData::method_currencySymbol, 0); o->defineDefaultProperty(QStringLiteral("dateTimeFormat"), QQmlLocaleData::method_dateTimeFormat, 0); - o->defineAccessorProperty(QStringLiteral("name"), QQmlLocaleData::method_get_name, 0); - o->defineAccessorProperty(QStringLiteral("positiveSign"), QQmlLocaleData::method_get_positiveSign, 0); - o->defineAccessorProperty(QStringLiteral("uiLanguages"), QQmlLocaleData::method_get_uiLanguages, 0); - o->defineAccessorProperty(QStringLiteral("firstDayOfWeek"), QQmlLocaleData::method_get_firstDayOfWeek, 0); - o->defineAccessorProperty(QStringLiteral("pmText"), QQmlLocaleData::method_get_pmText, 0); - o->defineAccessorProperty(QStringLiteral("percent"), QQmlLocaleData::method_get_percent, 0); - o->defineAccessorProperty(QStringLiteral("textDirection"), QQmlLocaleData::method_get_textDirection, 0); - o->defineAccessorProperty(QStringLiteral("weekDays"), QQmlLocaleData::method_get_weekDays, 0); - o->defineAccessorProperty(QStringLiteral("negativeSign"), QQmlLocaleData::method_get_negativeSign, 0); - o->defineAccessorProperty(QStringLiteral("groupSeparator"), QQmlLocaleData::method_get_groupSeparator, 0); - o->defineAccessorProperty(QStringLiteral("decimalPoint"), QQmlLocaleData::method_get_decimalPoint, 0); - o->defineAccessorProperty(QStringLiteral("nativeLanguageName"), QQmlLocaleData::method_get_nativeLanguageName, 0); - o->defineAccessorProperty(QStringLiteral("nativeCountryName"), QQmlLocaleData::method_get_nativeCountryName, 0); - o->defineAccessorProperty(QStringLiteral("zeroDigit"), QQmlLocaleData::method_get_zeroDigit, 0); - o->defineAccessorProperty(QStringLiteral("amText"), QQmlLocaleData::method_get_amText, 0); - o->defineAccessorProperty(QStringLiteral("measurementSystem"), QQmlLocaleData::method_get_measurementSystem, 0); - o->defineAccessorProperty(QStringLiteral("exponential"), QQmlLocaleData::method_get_exponential, 0); + o->defineAccessorProperty(QStringLiteral("name"), QQmlLocaleData::method_get_name, nullptr); + o->defineAccessorProperty(QStringLiteral("positiveSign"), QQmlLocaleData::method_get_positiveSign, nullptr); + o->defineAccessorProperty(QStringLiteral("uiLanguages"), QQmlLocaleData::method_get_uiLanguages, nullptr); + o->defineAccessorProperty(QStringLiteral("firstDayOfWeek"), QQmlLocaleData::method_get_firstDayOfWeek, nullptr); + o->defineAccessorProperty(QStringLiteral("pmText"), QQmlLocaleData::method_get_pmText, nullptr); + o->defineAccessorProperty(QStringLiteral("percent"), QQmlLocaleData::method_get_percent, nullptr); + o->defineAccessorProperty(QStringLiteral("textDirection"), QQmlLocaleData::method_get_textDirection, nullptr); + o->defineAccessorProperty(QStringLiteral("weekDays"), QQmlLocaleData::method_get_weekDays, nullptr); + o->defineAccessorProperty(QStringLiteral("negativeSign"), QQmlLocaleData::method_get_negativeSign, nullptr); + o->defineAccessorProperty(QStringLiteral("groupSeparator"), QQmlLocaleData::method_get_groupSeparator, nullptr); + o->defineAccessorProperty(QStringLiteral("decimalPoint"), QQmlLocaleData::method_get_decimalPoint, nullptr); + o->defineAccessorProperty(QStringLiteral("nativeLanguageName"), QQmlLocaleData::method_get_nativeLanguageName, nullptr); + o->defineAccessorProperty(QStringLiteral("nativeCountryName"), QQmlLocaleData::method_get_nativeCountryName, nullptr); + o->defineAccessorProperty(QStringLiteral("zeroDigit"), QQmlLocaleData::method_get_zeroDigit, nullptr); + o->defineAccessorProperty(QStringLiteral("amText"), QQmlLocaleData::method_get_amText, nullptr); + o->defineAccessorProperty(QStringLiteral("measurementSystem"), QQmlLocaleData::method_get_measurementSystem, nullptr); + o->defineAccessorProperty(QStringLiteral("exponential"), QQmlLocaleData::method_get_exponential, nullptr); prototype.set(engine, o); } diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h index 4ad9d6dbf6..859c36e11b 100644 --- a/src/qml/qml/qqmllocale_p.h +++ b/src/qml/qml/qqmllocale_p.h @@ -165,7 +165,7 @@ struct QQmlLocaleData : public QV4::Object const QQmlLocaleData *data = o ? o->as<QQmlLocaleData>() : nullptr; if (!data) { scope.engine->throwTypeError(); - return 0; + return nullptr; } return data->d()->locale; } diff --git a/src/qml/qml/qqmlloggingcategory_p.h b/src/qml/qml/qqmlloggingcategory_p.h index 2b7f2f5b53..544db1fe33 100644 --- a/src/qml/qml/qqmlloggingcategory_p.h +++ b/src/qml/qml/qqmlloggingcategory_p.h @@ -67,7 +67,7 @@ class QQmlLoggingCategory : public QObject, public QQmlParserStatus Q_PROPERTY(QString name READ name WRITE setName) public: - QQmlLoggingCategory(QObject *parent = 0); + QQmlLoggingCategory(QObject *parent = nullptr); virtual ~QQmlLoggingCategory(); QString name() const; diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 76d40bf442..7754f0fddc 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -170,7 +170,7 @@ public: ~QQmlTypePrivate(); void init() const; - void initEnums(const QQmlPropertyCache *cache = 0) const; + void initEnums(const QQmlPropertyCache *cache = nullptr) const; void insertEnums(const QMetaObject *metaObject) const; void insertEnumsFromPropertyCache(const QQmlPropertyCache *cache) const; @@ -315,31 +315,31 @@ QJSValue QQmlType::SingletonInstanceInfo::scriptApi(QQmlEngine *e) const QHash<const QMetaObject *, int> QQmlTypePrivate::attachedPropertyIds; QQmlTypePrivate::QQmlTypePrivate(QQmlType::RegistrationType type) -: refCount(1), regType(type), iid(0), typeId(0), listId(0), revision(0), - containsRevisionedAttributes(false), baseMetaObject(0), +: refCount(1), regType(type), iid(nullptr), typeId(0), listId(0), revision(0), + containsRevisionedAttributes(false), baseMetaObject(nullptr), index(-1), isSetup(false), isEnumSetup(false), haveSuperType(false) { switch (type) { case QQmlType::CppType: extraData.cd = new QQmlCppTypeData; extraData.cd->allocationSize = 0; - extraData.cd->newFunc = 0; + extraData.cd->newFunc = nullptr; extraData.cd->parserStatusCast = -1; - extraData.cd->extFunc = 0; - extraData.cd->extMetaObject = 0; - extraData.cd->customParser = 0; - extraData.cd->attachedPropertiesFunc = 0; - extraData.cd->attachedPropertiesType = 0; + extraData.cd->extFunc = nullptr; + extraData.cd->extMetaObject = nullptr; + extraData.cd->customParser = nullptr; + extraData.cd->attachedPropertiesFunc = nullptr; + extraData.cd->attachedPropertiesType = nullptr; extraData.cd->propertyValueSourceCast = -1; extraData.cd->propertyValueInterceptorCast = -1; break; case QQmlType::SingletonType: case QQmlType::CompositeSingletonType: extraData.sd = new QQmlSingletonTypeData; - extraData.sd->singletonInstanceInfo = 0; + extraData.sd->singletonInstanceInfo = nullptr; break; case QQmlType::InterfaceType: - extraData.cd = 0; + extraData.cd = nullptr; break; case QQmlType::CompositeType: extraData.fd = new QQmlCompositeTypeData; @@ -406,7 +406,7 @@ QQmlType::QQmlType(QQmlMetaTypeData *data, const QString &elementName, const QQm d->extraData.sd->singletonInstanceInfo->qobjectCallback = type.qobjectApi; d->extraData.sd->singletonInstanceInfo->typeName = QString::fromUtf8(type.typeName); d->extraData.sd->singletonInstanceInfo->instanceMetaObject - = (type.qobjectApi && type.version >= 1) ? type.instanceMetaObject : 0; + = (type.qobjectApi && type.version >= 1) ? type.instanceMetaObject : nullptr; } QQmlType::QQmlType(QQmlMetaTypeData *data, const QString &elementName, const QQmlPrivate::RegisterCompositeSingletonType &type) @@ -478,7 +478,7 @@ QQmlType::QQmlType(QQmlMetaTypeData *data, const QString &elementName, const QQm } QQmlType::QQmlType() - : d(0) + : d(nullptr) { } @@ -586,10 +586,10 @@ QQmlPropertyCache *QQmlType::compositePropertyCache(QQmlEnginePrivate *engine) c // similar logic to resolveCompositeBaseType Q_ASSERT(isComposite()); if (!engine) - return 0; + return nullptr; QQmlRefPointer<QQmlTypeData> td(engine->typeLoader.getType(sourceUrl()), QQmlRefPointer<QQmlTypeData>::Adopt); if (td.isNull() || !td->isComplete()) - return 0; + return nullptr; QV4::CompiledData::CompilationUnit *compilationUnit = td->compilationUnit(); return compilationUnit->rootPropertyCache(); } @@ -739,7 +739,7 @@ void QQmlTypePrivate::init() const // Check for revisioned details { - const QMetaObject *mo = 0; + const QMetaObject *mo = nullptr; if (metaObjects.isEmpty()) mo = baseMetaObject; else @@ -792,7 +792,7 @@ void QQmlTypePrivate::insertEnums(const QMetaObject *metaObject) const for (int ii = 0; ii < metaObject->enumeratorCount(); ++ii) { QMetaEnum e = metaObject->enumerator(ii); const bool isScoped = e.isScoped(); - QStringHash<int> *scoped = isScoped ? new QStringHash<int>() : 0; + QStringHash<int> *scoped = isScoped ? new QStringHash<int>() : nullptr; for (int jj = 0; jj < e.keyCount(); ++jj) { const QString key = QString::fromUtf8(e.key(jj)); @@ -888,7 +888,7 @@ QString QQmlType::qmlTypeName() const QObject *QQmlType::create() const { if (!d || !isCreatable()) - return 0; + return nullptr; d->init(); @@ -921,25 +921,25 @@ void QQmlType::create(QObject **out, void **memory, size_t additionalMemory) con QQmlType::SingletonInstanceInfo *QQmlType::singletonInstanceInfo() const { if (!d) - return 0; + return nullptr; if (d->regType != SingletonType && d->regType != CompositeSingletonType) - return 0; + return nullptr; return d->extraData.sd->singletonInstanceInfo; } QQmlCustomParser *QQmlType::customParser() const { if (!d) - return 0; + return nullptr; if (d->regType != CppType) - return 0; + return nullptr; return d->extraData.cd->customParser; } QQmlType::CreateFunc QQmlType::createFunction() const { if (!d || d->regType != CppType) - return 0; + return nullptr; return d->extraData.cd->newFunc; } @@ -1004,7 +1004,7 @@ int QQmlType::qListTypeId() const const QMetaObject *QQmlType::metaObject() const { if (!d) - return 0; + return nullptr; d->init(); if (d->metaObjects.isEmpty()) @@ -1016,7 +1016,7 @@ const QMetaObject *QQmlType::metaObject() const const QMetaObject *QQmlType::baseMetaObject() const { - return d ? d->baseMetaObject : 0; + return d ? d->baseMetaObject : nullptr; } bool QQmlType::containsRevisionedAttributes() const @@ -1036,7 +1036,7 @@ int QQmlType::metaObjectRevision() const QQmlAttachedPropertiesFunc QQmlType::attachedPropertiesFunction(QQmlEnginePrivate *engine) const { if (!d) - return 0; + return nullptr; if (d->regType == CppType) return d->extraData.cd->attachedPropertiesFunc; @@ -1049,7 +1049,7 @@ QQmlAttachedPropertiesFunc QQmlType::attachedPropertiesFunction(QQmlEnginePrivat const QMetaObject *QQmlType::attachedPropertiesType(QQmlEnginePrivate *engine) const { if (!d) - return 0; + return nullptr; if (d->regType == CppType) return d->extraData.cd->attachedPropertiesType; @@ -1101,7 +1101,7 @@ int QQmlType::propertyValueInterceptorCast() const const char *QQmlType::interfaceIId() const { if (!d || d->regType != InterfaceType) - return 0; + return nullptr; return d->iid; } @@ -1125,7 +1125,7 @@ int QQmlType::enumValue(QQmlEnginePrivate *engine, const QHashedStringRef &name, { Q_ASSERT(ok); if (d) { - const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : 0; + const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : nullptr; *ok = true; @@ -1144,7 +1144,7 @@ int QQmlType::enumValue(QQmlEnginePrivate *engine, const QHashedCStringRef &name { Q_ASSERT(ok); if (d) { - const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : 0; + const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : nullptr; *ok = true; @@ -1163,7 +1163,7 @@ int QQmlType::enumValue(QQmlEnginePrivate *engine, const QV4::String *name, bool { Q_ASSERT(ok); if (d) { - const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : 0; + const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : nullptr; *ok = true; d->initEnums(cache); @@ -1181,7 +1181,7 @@ int QQmlType::scopedEnumIndex(QQmlEnginePrivate *engine, const QV4::String *name { Q_ASSERT(ok); if (d) { - const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : 0; + const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : nullptr; *ok = true; d->initEnums(cache); @@ -1199,7 +1199,7 @@ int QQmlType::scopedEnumIndex(QQmlEnginePrivate *engine, const QString &name, bo { Q_ASSERT(ok); if (d) { - const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : 0; + const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : nullptr; *ok = true; d->initEnums(cache); @@ -1251,7 +1251,7 @@ int QQmlType::scopedEnumValue(QQmlEnginePrivate *engine, const QByteArray &scope { Q_ASSERT(ok); if (d) { - const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : 0; + const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : nullptr; *ok = true; d->initEnums(cache); @@ -1274,7 +1274,7 @@ int QQmlType::scopedEnumValue(QQmlEnginePrivate *engine, const QStringRef &scope { Q_ASSERT(ok); if (d) { - const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : 0; + const QQmlPropertyCache *cache = isComposite() ? compositePropertyCache(engine) : nullptr; *ok = true; d->initEnums(cache); @@ -1340,7 +1340,7 @@ QQmlTypeModule::QQmlTypeModule() QQmlTypeModule::~QQmlTypeModule() { - delete d; d = 0; + delete d; d = nullptr; } QString QQmlTypeModule::module() const @@ -1439,7 +1439,7 @@ void QQmlTypeModule::walkCompositeSingletons(const std::function<void(const QQml } QQmlTypeModuleVersion::QQmlTypeModuleVersion() -: m_module(0), m_minor(0) +: m_module(nullptr), m_minor(0) { } @@ -1699,7 +1699,7 @@ QQmlType QQmlMetaType::registerCompositeSingletonType(const QQmlPrivate::Registe bool fileImport = false; if (*(type.uri) == '\0') fileImport = true; - if (!checkRegistration(QQmlType::CompositeSingletonType, data, fileImport ? 0 : type.uri, typeName)) + if (!checkRegistration(QQmlType::CompositeSingletonType, data, fileImport ? nullptr : type.uri, typeName)) return QQmlType(); QQmlType dtype(data, typeName, type); @@ -1721,7 +1721,7 @@ QQmlType QQmlMetaType::registerCompositeType(const QQmlPrivate::RegisterComposit bool fileImport = false; if (*(type.uri) == '\0') fileImport = true; - if (!checkRegistration(QQmlType::CompositeType, data, fileImport?0:type.uri, typeName, type.versionMajor)) + if (!checkRegistration(QQmlType::CompositeType, data, fileImport?nullptr:type.uri, typeName, type.versionMajor)) return QQmlType(); QQmlType dtype(data, typeName, type); @@ -1745,13 +1745,13 @@ void QQmlMetaType::registerInternalCompositeType(QV4::CompiledData::CompilationU QtMetaTypePrivate::QMetaTypeFunctionHelper<QObject*>::Construct, sizeof(QObject*), static_cast<QFlags<QMetaType::TypeFlag> >(QtPrivate::QMetaTypeTypeFlags<QObject*>::Flags), - 0); + nullptr); int lst_type = QMetaType::registerNormalizedType(lst, QtMetaTypePrivate::QMetaTypeFunctionHelper<QQmlListProperty<QObject> >::Destruct, QtMetaTypePrivate::QMetaTypeFunctionHelper<QQmlListProperty<QObject> >::Construct, sizeof(QQmlListProperty<QObject>), static_cast<QFlags<QMetaType::TypeFlag> >(QtPrivate::QMetaTypeTypeFlags<QQmlListProperty<QObject> >::Flags), - static_cast<QMetaObject*>(0)); + static_cast<QMetaObject*>(nullptr)); compilationUnit->metaTypeId = ptr_type; compilationUnit->listMetaTypeId = lst_type; @@ -1964,7 +1964,7 @@ QObject *QQmlMetaType::toQObject(const QVariant &v, bool *ok) { if (!isQObject(v.userType())) { if (ok) *ok = false; - return 0; + return nullptr; } if (ok) *ok = true; @@ -2014,7 +2014,7 @@ int QQmlMetaType::attachedPropertiesFuncId(QQmlEnginePrivate *engine, const QMet QQmlAttachedPropertiesFunc QQmlMetaType::attachedPropertiesFuncById(QQmlEnginePrivate *engine, int id) { if (id < 0) - return 0; + return nullptr; QMutexLocker lock(metaTypeDataLock()); QQmlMetaTypeData *data = metaTypeData(); return data->types.at(id).attachedPropertiesFunction(engine); @@ -2107,7 +2107,7 @@ const char *QQmlMetaType::interfaceIId(int userType) if (type.isInterface() && type.typeId() == userType) return type.interfaceIId(); else - return 0; + return nullptr; } bool QQmlMetaType::isList(int userType) diff --git a/src/qml/qml/qqmlmetatype_p.h b/src/qml/qml/qqmlmetatype_p.h index cee1070a09..07bef526ba 100644 --- a/src/qml/qml/qqmlmetatype_p.h +++ b/src/qml/qml/qqmlmetatype_p.h @@ -109,7 +109,7 @@ public: static QMetaMethod defaultMethod(QObject *); static bool isQObject(int); - static QObject *toQObject(const QVariant &, bool *ok = 0); + static QObject *toQObject(const QVariant &, bool *ok = nullptr); static int listType(int); static int attachedPropertiesFuncId(QQmlEnginePrivate *engine, const QMetaObject *); @@ -163,7 +163,7 @@ public: return d == other.d; } - bool isValid() const { return d != 0; } + bool isValid() const { return d != nullptr; } const QQmlTypePrivate *key() const { return d; } QByteArray typeName() const; @@ -218,7 +218,7 @@ public: { public: SingletonInstanceInfo() - : scriptCallback(0), qobjectCallback(0), instanceMetaObject(0) {} + : scriptCallback(nullptr), qobjectCallback(nullptr), instanceMetaObject(nullptr) {} QJSValue (*scriptCallback)(QQmlEngine *, QJSEngine *); QObject *(*qobjectCallback)(QQmlEngine *, QJSEngine *); diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp index e068ad174a..ac247ae0ad 100644 --- a/src/qml/qml/qqmlnotifier.cpp +++ b/src/qml/qml/qqmlnotifier.cpp @@ -51,7 +51,7 @@ void QQmlJavaScriptExpressionGuard_callback(QQmlNotifierEndpoint *, void **); void QQmlVMEMetaObjectEndpoint_callback(QQmlNotifierEndpoint *, void **); static Callback QQmlNotifier_callbacks[] = { - 0, + nullptr, QQmlBoundSignal_callback, QQmlJavaScriptExpressionGuard_callback, QQmlVMEMetaObjectEndpoint_callback @@ -59,9 +59,9 @@ static Callback QQmlNotifier_callbacks[] = { namespace { struct NotifyListTraversalData { - NotifyListTraversalData(QQmlNotifierEndpoint *ep = 0) + NotifyListTraversalData(QQmlNotifierEndpoint *ep = nullptr) : originalSenderPtr(0) - , disconnectWatch(0) + , disconnectWatch(nullptr) , endpoint(ep) {} diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h index a99b13f155..d77e314de5 100644 --- a/src/qml/qml/qqmlnotifier_p.h +++ b/src/qml/qml/qqmlnotifier_p.h @@ -73,7 +73,7 @@ private: friend class QQmlThreadNotifierProxyObject; static void emitNotify(QQmlNotifierEndpoint *, void **a); - QQmlNotifierEndpoint *endpoints; + QQmlNotifierEndpoint *endpoints = nullptr; }; class QQmlEngine; @@ -129,7 +129,6 @@ private: }; QQmlNotifier::QQmlNotifier() -: endpoints(0) { } @@ -142,22 +141,22 @@ QQmlNotifier::~QQmlNotifier() if (n->isNotifying()) *((qintptr *)(n->senderPtr & ~0x1)) = 0; - n->next = 0; - n->prev = 0; + n->next = nullptr; + n->prev = nullptr; n->senderPtr = 0; n->sourceSignal = -1; } - endpoints = 0; + endpoints = nullptr; } void QQmlNotifier::notify() { - void *args[] = { 0 }; + void *args[] = { nullptr }; if (endpoints) emitNotify(endpoints, args); } QQmlNotifierEndpoint::QQmlNotifierEndpoint(Callback callback) -: next(0), prev(0), senderPtr(0), callback(callback), needsConnectNotify(false), sourceSignal(-1) +: next(nullptr), prev(nullptr), senderPtr(0), callback(callback), needsConnectNotify(false), sourceSignal(-1) { } @@ -168,7 +167,7 @@ QQmlNotifierEndpoint::~QQmlNotifierEndpoint() bool QQmlNotifierEndpoint::isConnected() const { - return prev != 0; + return prev != nullptr; } /*! \internal @@ -212,8 +211,8 @@ void QQmlNotifierEndpoint::disconnect() } if (isNotifying()) *((qintptr *)(senderPtr & ~0x1)) = 0; - next = 0; - prev = 0; + next = nullptr; + prev = nullptr; senderPtr = 0; sourceSignal = -1; } diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index caf063c79f..36e56a01f8 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -82,13 +82,13 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QV4::Compil { init(parentContext); - sharedState->componentAttached = 0; + sharedState->componentAttached = nullptr; sharedState->allCreatedBindings.allocate(compilationUnit->totalBindingsCount); sharedState->allParserStatusCallbacks.allocate(compilationUnit->totalParserStatusCount); sharedState->allCreatedObjects.allocate(compilationUnit->totalObjectCount); - sharedState->allJavaScriptObjects = 0; + sharedState->allJavaScriptObjects = nullptr; sharedState->creationContext = creationContext; - sharedState->rootContext = 0; + sharedState->rootContext = nullptr; if (auto profiler = QQmlEnginePrivate::get(engine)->profiler) { Q_QML_PROFILE_IF_ENABLED(QQmlProfilerDefinitions::ProfileCreating, profiler, @@ -105,7 +105,7 @@ QQmlObjectCreator::QQmlObjectCreator(QQmlContextData *parentContext, QV4::Compil , propertyCaches(&compilationUnit->propertyCaches) , sharedState(inheritedSharedState) , topLevelCreator(false) - , incubator(0) + , incubator(nullptr) { init(parentContext); } @@ -120,17 +120,17 @@ void QQmlObjectCreator::init(QQmlContextData *providedParentContext) compilationUnit->linkToEngine(v4); qmlUnit = compilationUnit->data; - context = 0; - _qobject = 0; - _scopeObject = 0; - _bindingTarget = 0; - _valueTypeProperty = 0; - _compiledObject = 0; + context = nullptr; + _qobject = nullptr; + _scopeObject = nullptr; + _bindingTarget = nullptr; + _valueTypeProperty = nullptr; + _compiledObject = nullptr; _compiledObjectIndex = -1; - _ddata = 0; - _propertyCache = 0; - _vmeMetaObject = 0; - _qmlContext = 0; + _ddata = nullptr; + _propertyCache = nullptr; + _vmeMetaObject = nullptr; + _qmlContext = nullptr; } QQmlObjectCreator::~QQmlObjectCreator() @@ -142,7 +142,7 @@ QQmlObjectCreator::~QQmlObjectCreator() for (int i = 0; i < sharedState->allParserStatusCallbacks.count(); ++i) { QQmlParserStatus *ps = sharedState->allParserStatusCallbacks.at(i); if (ps) - ps->d = 0; + ps->d = nullptr; } while (sharedState->componentAttached) { QQmlComponentAttached *a = sharedState->componentAttached; @@ -207,12 +207,12 @@ QObject *QQmlObjectCreator::create(int subComponentIndex, QObject *parent, QQmlI } if (topLevelCreator) - sharedState->allJavaScriptObjects = 0; + sharedState->allJavaScriptObjects = nullptr; phase = CreatingObjectsPhase2; if (interrupt && interrupt->shouldInterrupt()) - return 0; + return nullptr; phase = ObjectsCreated; @@ -796,7 +796,7 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con } const int id = attachedType.attachedPropertiesId(QQmlEnginePrivate::get(engine)); QObject *qmlObject = qmlAttachedPropertiesObjectById(id, _qobject); - if (!populateInstance(binding->value.objectIndex, qmlObject, qmlObject, /*value type property*/0)) + if (!populateInstance(binding->value.objectIndex, qmlObject, qmlObject, /*value type property*/nullptr)) return false; return true; } @@ -814,12 +814,12 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con QQmlPropertyData::WriteFlags propertyWriteFlags = QQmlPropertyData::BypassInterceptor | QQmlPropertyData::RemoveBindingOnAliasWrite; int propertyWriteStatus = -1; - void *argv[] = { &ss, 0, &propertyWriteStatus, &propertyWriteFlags }; + void *argv[] = { &ss, nullptr, &propertyWriteStatus, &propertyWriteFlags }; QMetaObject::metacall(_qobject, QMetaObject::WriteProperty, property->coreIndex(), argv); return true; } - QObject *createdSubObject = 0; + QObject *createdSubObject = nullptr; if (binding->type == QV4::CompiledData::Binding::Type_Object) { createdSubObject = createInstance(binding->value.objectIndex, _bindingTarget); if (!createdSubObject) @@ -833,9 +833,9 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con const QV4::CompiledData::Object *obj = qmlUnit->objectAt(binding->value.objectIndex); if (stringAt(obj->inheritedTypeNameIndex).isEmpty()) { - QObject *groupObject = 0; - QQmlValueType *valueType = 0; - const QQmlPropertyData *valueTypeProperty = 0; + QObject *groupObject = nullptr; + QQmlValueType *valueType = nullptr; + const QQmlPropertyData *valueTypeProperty = nullptr; QObject *bindingTarget = _bindingTarget; if (QQmlValueTypeFactory::isValueType(property->propType())) { @@ -1008,7 +1008,7 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con QQmlPropertyData::WriteFlags propertyWriteFlags = QQmlPropertyData::BypassInterceptor | QQmlPropertyData::RemoveBindingOnAliasWrite; int propertyWriteStatus = -1; - void *argv[] = { 0, 0, &propertyWriteStatus, &propertyWriteFlags }; + void *argv[] = { nullptr, nullptr, &propertyWriteStatus, &propertyWriteFlags }; if (const char *iid = QQmlMetaType::interfaceIId(property->propType())) { void *ptr = createdSubObject->qt_metacast(iid); @@ -1034,7 +1034,7 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *property, con void *itemToAdd = createdSubObject; - const char *iid = 0; + const char *iid = nullptr; int listItemType = QQmlEnginePrivate::get(engine)->listType(property->propType()); if (listItemType != -1) iid = QQmlMetaType::interfaceIId(listItemType); @@ -1114,10 +1114,10 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo ActiveOCRestorer ocRestorer(this, QQmlEnginePrivate::get(engine)); bool isComponent = false; - QObject *instance = 0; - QQmlData *ddata = 0; - QQmlCustomParser *customParser = 0; - QQmlParserStatus *parserStatus = 0; + QObject *instance = nullptr; + QQmlData *ddata = nullptr; + QQmlCustomParser *customParser = nullptr; + QQmlParserStatus *parserStatus = nullptr; bool installPropertyCache = true; if (obj->flags & QV4::CompiledData::Object::IsComponent) { @@ -1137,11 +1137,11 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo Q_QML_OC_PROFILE(sharedState->profiler, profiler.update( compilationUnit, obj, type.qmlTypeName(), context->url())); - void *ddataMemory = 0; + void *ddataMemory = nullptr; type.create(&instance, &ddataMemory, sizeof(QQmlData)); if (!instance) { recordError(obj->location, tr("Unable to create object of type %1").arg(stringAt(obj->inheritedTypeNameIndex))); - return 0; + return nullptr; } { @@ -1173,14 +1173,14 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo if (typeRef->compilationUnit->data->isSingleton()) { recordError(obj->location, tr("Composite Singleton Type %1 is not creatable").arg(stringAt(obj->inheritedTypeNameIndex))); - return 0; + return nullptr; } QQmlObjectCreator subCreator(context, typeRef->compilationUnit, sharedState.data()); instance = subCreator.create(); if (!instance) { errors += subCreator.errors; - return 0; + return nullptr; } } if (instance->isWidgetType()) { @@ -1244,8 +1244,8 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo } customParser->applyBindings(instance, compilationUnit, bindings); - customParser->engine = 0; - customParser->imports = (QQmlTypeNameCache*)0; + customParser->engine = nullptr; + customParser->imports = (QQmlTypeNameCache*)nullptr; } if (isComponent) { @@ -1274,12 +1274,12 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo qSwap(_qmlContext, qmlContext); - bool result = populateInstance(index, instance, /*binding target*/instance, /*value type property*/0); + bool result = populateInstance(index, instance, /*binding target*/instance, /*value type property*/nullptr); qSwap(_qmlContext, qmlContext); qSwap(_scopeObject, scopeObject); - return result ? instance : 0; + return result ? instance : nullptr; } QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interrupt) @@ -1303,7 +1303,7 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru QQmlPropertyData::DontRemoveBinding); if (watcher.hasRecursed() || interrupt.shouldInterrupt()) - return 0; + return nullptr; } if (QQmlVME::componentCompleteEnabled()) { // the qml designer does the component complete later @@ -1312,12 +1312,12 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru QQmlParserStatus *status = sharedState->allParserStatusCallbacks.pop(); if (status && status->d) { - status->d = 0; + status->d = nullptr; status->componentComplete(); } if (watcher.hasRecursed() || interrupt.shouldInterrupt()) - return 0; + return nullptr; } } @@ -1325,11 +1325,11 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru QQmlEnginePrivate::FinalizeCallback callback = sharedState->finalizeCallbacks.at(ii); QObject *obj = callback.first; if (obj) { - void *args[] = { 0 }; + void *args[] = { nullptr }; QMetaObject::metacall(obj, QMetaObject::InvokeMetaMethod, callback.second, args); } if (watcher.hasRecursed()) - return 0; + return nullptr; } sharedState->finalizeCallbacks.clear(); @@ -1344,7 +1344,7 @@ QQmlContextData *QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interru emit a->completed(); if (watcher.hasRecursed() || interrupt.shouldInterrupt()) - return 0; + return nullptr; } phase = Done; @@ -1386,7 +1386,7 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject * QQmlRefPointer<QQmlPropertyCache> cache = propertyCaches->at(_compiledObjectIndex); - QQmlVMEMetaObject *vmeMetaObject = 0; + QQmlVMEMetaObject *vmeMetaObject = nullptr; if (propertyCaches->needsVMEMetaObject(_compiledObjectIndex)) { Q_ASSERT(!cache.isNull()); // install on _object diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h index bef58b8c9a..399a5f6d4a 100644 --- a/src/qml/qml/qqmlobjectcreator_p.h +++ b/src/qml/qml/qqmlobjectcreator_p.h @@ -85,10 +85,10 @@ class Q_QML_PRIVATE_EXPORT QQmlObjectCreator { Q_DECLARE_TR_FUNCTIONS(QQmlObjectCreator) public: - QQmlObjectCreator(QQmlContextData *parentContext, QV4::CompiledData::CompilationUnit *compilationUnit, QQmlContextData *creationContext, QQmlIncubatorPrivate *incubator = 0); + QQmlObjectCreator(QQmlContextData *parentContext, QV4::CompiledData::CompilationUnit *compilationUnit, QQmlContextData *creationContext, QQmlIncubatorPrivate *incubator = nullptr); ~QQmlObjectCreator(); - QObject *create(int subComponentIndex = -1, QObject *parent = 0, QQmlInstantiationInterrupt *interrupt = 0); + QObject *create(int subComponentIndex = -1, QObject *parent = nullptr, QQmlInstantiationInterrupt *interrupt = nullptr); bool populateDeferredProperties(QObject *instance, QQmlData::DeferredData *deferredData); bool populateDeferredBinding(const QQmlProperty &qmlProperty, QQmlData::DeferredData *deferredData, const QV4::CompiledData::Binding *binding); QQmlContextData *finalize(QQmlInstantiationInterrupt &interrupt); @@ -108,7 +108,7 @@ private: void init(QQmlContextData *parentContext); - QObject *createInstance(int index, QObject *parent = 0, bool isContextObject = false); + QObject *createInstance(int index, QObject *parent = nullptr, bool isContextObject = false); bool populateInstance(int index, QObject *instance, QObject *bindingTarget, const QQmlPropertyData *valueTypeProperty); diff --git a/src/qml/qml/qqmlopenmetaobject.cpp b/src/qml/qml/qqmlopenmetaobject.cpp index fc85030b3d..1b44bbdda3 100644 --- a/src/qml/qml/qqmlopenmetaobject.cpp +++ b/src/qml/qml/qqmlopenmetaobject.cpp @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE class QQmlOpenMetaObjectTypePrivate { public: - QQmlOpenMetaObjectTypePrivate() : mem(0), cache(0), engine(0) {} + QQmlOpenMetaObjectTypePrivate() : mem(nullptr), cache(nullptr), engine(nullptr) {} void init(const QMetaObject *metaObj); @@ -83,7 +83,7 @@ QQmlOpenMetaObjectType::~QQmlOpenMetaObjectType() void QQmlOpenMetaObjectType::clear() { - d->engine = 0; + d->engine = nullptr; } int QQmlOpenMetaObjectType::propertyOffset() const @@ -182,7 +182,7 @@ class QQmlOpenMetaObjectPrivate { public: QQmlOpenMetaObjectPrivate(QQmlOpenMetaObject *_q) - : q(_q), parent(0), type(0), cacheProperties(false) {} + : q(_q), parent(nullptr), type(nullptr), cacheProperties(false) {} inline QPair<QVariant, bool> &getDataRef(int idx) { while (data.count() <= idx) @@ -220,7 +220,7 @@ QQmlOpenMetaObject::QQmlOpenMetaObject(QObject *obj, const QMetaObject *base, bo d->autoCreate = automatic; d->object = obj; - d->type = new QQmlOpenMetaObjectType(base ? base : obj->metaObject(), 0); + d->type = new QQmlOpenMetaObjectType(base ? base : obj->metaObject(), nullptr); d->type->d->referers.insert(this); QObjectPrivate *op = QObjectPrivate::get(obj); @@ -264,7 +264,7 @@ void QQmlOpenMetaObject::emitPropertyNotification(const QByteArray &propertyName QHash<QByteArray, int>::ConstIterator iter = d->type->d->names.constFind(propertyName); if (iter == d->type->d->names.constEnd()) return; - activate(d->object, *iter + d->type->d->signalOffset, 0); + activate(d->object, *iter + d->type->d->signalOffset, nullptr); } int QQmlOpenMetaObject::metaCall(QObject *o, QMetaObject::Call c, int id, void **a) @@ -284,7 +284,7 @@ int QQmlOpenMetaObject::metaCall(QObject *o, QMetaObject::Call c, int id, void * prop.first = propertyWriteValue(propId, *reinterpret_cast<QVariant *>(a[0])); prop.second = true; propertyWritten(propId); - activate(o, d->type->d->signalOffset + propId, 0); + activate(o, d->type->d->signalOffset + propId, nullptr); } } return -1; @@ -311,7 +311,7 @@ void QQmlOpenMetaObject::setValue(int id, const QVariant &value) QPair<QVariant, bool> &prop = d->getDataRef(id); prop.first = propertyWriteValue(id, value); prop.second = true; - activate(d->object, id + d->type->d->signalOffset, 0); + activate(d->object, id + d->type->d->signalOffset, nullptr); } QVariant QQmlOpenMetaObject::value(const QByteArray &name) const @@ -353,7 +353,7 @@ bool QQmlOpenMetaObject::setValue(const QByteArray &name, const QVariant &val) return false; dataVal = val; - activate(d->object, id + d->type->d->signalOffset, 0); + activate(d->object, id + d->type->d->signalOffset, nullptr); return true; } @@ -382,7 +382,7 @@ void QQmlOpenMetaObject::setCached(bool c) } else { if (d->type->d->cache) d->type->d->cache->release(); - qmldata->propertyCache = 0; + qmldata->propertyCache = nullptr; } } @@ -395,7 +395,7 @@ int QQmlOpenMetaObject::createProperty(const char *name, const char *) if (QQmlData *ddata = QQmlData::get(d->object, /*create*/false)) { if (ddata->propertyCache) { ddata->propertyCache->release(); - ddata->propertyCache = 0; + ddata->propertyCache = nullptr; } } diff --git a/src/qml/qml/qqmlopenmetaobject_p.h b/src/qml/qml/qqmlopenmetaobject_p.h index 4bb92489a5..bb5477dfbf 100644 --- a/src/qml/qml/qqmlopenmetaobject_p.h +++ b/src/qml/qml/qqmlopenmetaobject_p.h @@ -95,7 +95,7 @@ class QQmlOpenMetaObjectPrivate; class Q_QML_PRIVATE_EXPORT QQmlOpenMetaObject : public QAbstractDynamicMetaObject { public: - QQmlOpenMetaObject(QObject *, const QMetaObject * = 0, bool = true); + QQmlOpenMetaObject(QObject *, const QMetaObject * = nullptr, bool = true); QQmlOpenMetaObject(QObject *, QQmlOpenMetaObjectType *, bool = true); ~QQmlOpenMetaObject(); diff --git a/src/qml/qml/qqmlparserstatus.cpp b/src/qml/qml/qqmlparserstatus.cpp index ad07cac7ef..1082c318cb 100644 --- a/src/qml/qml/qqmlparserstatus.cpp +++ b/src/qml/qml/qqmlparserstatus.cpp @@ -87,7 +87,7 @@ QT_BEGIN_NAMESPACE /*! \internal */ QQmlParserStatus::QQmlParserStatus() -: d(0) +: d(nullptr) { } @@ -95,7 +95,7 @@ QQmlParserStatus::QQmlParserStatus() QQmlParserStatus::~QQmlParserStatus() { if(d) - (*d) = 0; + (*d) = nullptr; } /*! diff --git a/src/qml/qml/qqmlplatform_p.h b/src/qml/qml/qqmlplatform_p.h index 6246ca7105..af33dffca3 100644 --- a/src/qml/qml/qqmlplatform_p.h +++ b/src/qml/qml/qqmlplatform_p.h @@ -64,7 +64,7 @@ class Q_QML_PRIVATE_EXPORT QQmlPlatform : public QObject Q_PROPERTY(QString pluginName READ pluginName CONSTANT) public: - explicit QQmlPlatform(QObject *parent = 0); + explicit QQmlPlatform(QObject *parent = nullptr); virtual ~QQmlPlatform(); static QString os(); diff --git a/src/qml/qml/qqmlprivate.h b/src/qml/qml/qqmlprivate.h index b9e9d5e59e..11adea6fc9 100644 --- a/src/qml/qml/qqmlprivate.h +++ b/src/qml/qml/qqmlprivate.h @@ -167,8 +167,8 @@ namespace QQmlPrivate class AttachedPropertySelector { public: - static inline QQmlAttachedPropertiesFunc func() { return 0; } - static inline const QMetaObject *metaObject() { return 0; } + static inline QQmlAttachedPropertiesFunc func() { return nullptr; } + static inline const QMetaObject *metaObject() { return nullptr; } }; template<typename T> class AttachedPropertySelector<T, 1> diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp index 50d9f13049..8ecd597a39 100644 --- a/src/qml/qml/qqmlproperty.cpp +++ b/src/qml/qml/qqmlproperty.cpp @@ -119,7 +119,7 @@ The \l {Qt Quick 1} version of this class was named QDeclarativeProperty. Create an invalid QQmlProperty. */ QQmlProperty::QQmlProperty() -: d(0) +: d(nullptr) { } @@ -128,7 +128,7 @@ QQmlProperty::~QQmlProperty() { if (d) d->release(); - d = 0; + d = nullptr; } /*! @@ -150,8 +150,8 @@ QQmlProperty::QQmlProperty(QObject *obj) QQmlProperty::QQmlProperty(QObject *obj, QQmlContext *ctxt) : d(new QQmlPropertyPrivate) { - d->context = ctxt?QQmlContextData::get(ctxt):0; - d->engine = ctxt?ctxt->engine():0; + d->context = ctxt?QQmlContextData::get(ctxt):nullptr; + d->engine = ctxt?ctxt->engine():nullptr; d->initDefault(obj); } @@ -164,7 +164,7 @@ QQmlProperty::QQmlProperty(QObject *obj, QQmlContext *ctxt) QQmlProperty::QQmlProperty(QObject *obj, QQmlEngine *engine) : d(new QQmlPropertyPrivate) { - d->context = 0; + d->context = nullptr; d->engine = engine; d->initDefault(obj); } @@ -190,7 +190,7 @@ QQmlProperty::QQmlProperty(QObject *obj, const QString &name) : d(new QQmlPropertyPrivate) { d->initProperty(obj, name); - if (!isValid()) d->object = 0; + if (!isValid()) d->object = nullptr; } /*! @@ -203,10 +203,10 @@ QQmlProperty::QQmlProperty(QObject *obj, const QString &name) QQmlProperty::QQmlProperty(QObject *obj, const QString &name, QQmlContext *ctxt) : d(new QQmlPropertyPrivate) { - d->context = ctxt?QQmlContextData::get(ctxt):0; - d->engine = ctxt?ctxt->engine():0; + d->context = ctxt?QQmlContextData::get(ctxt):nullptr; + d->engine = ctxt?ctxt->engine():nullptr; d->initProperty(obj, name); - if (!isValid()) { d->object = 0; d->context = 0; d->engine = 0; } + if (!isValid()) { d->object = nullptr; d->context = nullptr; d->engine = nullptr; } } /*! @@ -217,10 +217,10 @@ QQmlProperty::QQmlProperty(QObject *obj, const QString &name, QQmlContext *ctxt) QQmlProperty::QQmlProperty(QObject *obj, const QString &name, QQmlEngine *engine) : d(new QQmlPropertyPrivate) { - d->context = 0; + d->context = nullptr; d->engine = engine; d->initProperty(obj, name); - if (!isValid()) { d->object = 0; d->context = 0; d->engine = 0; } + if (!isValid()) { d->object = nullptr; d->context = nullptr; d->engine = nullptr; } } QQmlProperty QQmlPropertyPrivate::create(QObject *target, const QString &propertyName, QQmlContextData *context) @@ -240,7 +240,7 @@ QQmlProperty QQmlPropertyPrivate::create(QObject *target, const QString &propert } QQmlPropertyPrivate::QQmlPropertyPrivate() -: context(0), engine(0), object(0), isNameCached(false) +: context(nullptr), engine(nullptr), object(nullptr), isNameCached(false) { } @@ -248,14 +248,14 @@ QQmlContextData *QQmlPropertyPrivate::effectiveContext() const { if (context) return context; else if (engine) return QQmlContextData::get(engine->rootContext()); - else return 0; + else return nullptr; } void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name) { if (!obj) return; - QQmlTypeNameCache *typeNameCache = context?context->imports:0; + QQmlTypeNameCache *typeNameCache = context?context->imports:nullptr; QObject *currentObject = obj; QVector<QStringRef> path; @@ -487,7 +487,7 @@ QQmlPropertyPrivate::propertyTypeCategory() const const char *QQmlProperty::propertyTypeName() const { if (!d) - return 0; + return nullptr; if (d->isValueType()) { const QMetaObject *valueTypeMetaObject = QQmlValueTypeFactory::metaObjectForMetaType(d->core.propType()); Q_ASSERT(valueTypeMetaObject); @@ -495,7 +495,7 @@ const char *QQmlProperty::propertyTypeName() const } else if (d->object && type() & Property && d->core.isValid()) { return d->object->metaObject()->property(d->core.coreIndex()).typeName(); } else { - return 0; + return nullptr; } } @@ -579,7 +579,7 @@ bool QQmlProperty::isSignalProperty() const */ QObject *QQmlProperty::object() const { - return d ? d->object : 0; + return d ? d->object : nullptr; } /*! @@ -717,7 +717,7 @@ QQmlAbstractBinding * QQmlPropertyPrivate::binding(const QQmlProperty &that) { if (!that.d || !that.isProperty() || !that.d->object) - return 0; + return nullptr; QQmlPropertyIndex thatIndex(that.d->core.coreIndex(), that.d->valueTypeData.coreIndex()); return binding(that.d->object, thatIndex); @@ -779,7 +779,7 @@ static void removeOldBinding(QObject *object, QQmlPropertyIndex index, QQmlPrope return; if (!(flags & QQmlPropertyPrivate::DontEnable)) - oldBinding->setEnabled(false, 0); + oldBinding->setEnabled(false, nullptr); oldBinding->removeFromObject(); } @@ -813,13 +813,13 @@ QQmlPropertyPrivate::binding(QObject *object, QQmlPropertyIndex index) QQmlData *data = QQmlData::get(object); if (!data) - return 0; + return nullptr; const int coreIndex = index.coreIndex(); const int valueTypeIndex = index.valueTypeIndex(); if (coreIndex < 0 || !data->hasBindingBit(coreIndex)) - return 0; + return nullptr; QQmlAbstractBinding *binding = data->bindings; while (binding && (binding->targetPropertyIndex().coreIndex() != coreIndex || @@ -845,11 +845,11 @@ void QQmlPropertyPrivate::findAliasTarget(QObject *object, QQmlPropertyIndex bin int valueTypeIndex = bindingIndex.valueTypeIndex(); QQmlPropertyData *propertyData = - data->propertyCache?data->propertyCache->property(coreIndex):0; + data->propertyCache?data->propertyCache->property(coreIndex):nullptr; if (propertyData && propertyData->isAlias()) { QQmlVMEMetaObject *vme = QQmlVMEMetaObject::getForProperty(object, coreIndex); - QObject *aObject = 0; int aCoreIndex = -1; int aValueTypeIndex = -1; + QObject *aObject = nullptr; int aCoreIndex = -1; int aValueTypeIndex = -1; if (vme->aliasTarget(coreIndex, &aObject, &aCoreIndex, &aValueTypeIndex)) { // This will either be a value type sub-reference or an alias to a value-type sub-reference not both Q_ASSERT(valueTypeIndex == -1 || aValueTypeIndex == -1); @@ -904,11 +904,11 @@ QQmlBoundSignalExpression * QQmlPropertyPrivate::signalExpression(const QQmlProperty &that) { if (!(that.type() & QQmlProperty::SignalProperty)) - return 0; + return nullptr; QQmlData *data = QQmlData::get(that.d->object); if (!data) - return 0; + return nullptr; QQmlBoundSignal *signalHandler = data->signalHandlers; @@ -918,7 +918,7 @@ QQmlPropertyPrivate::signalExpression(const QQmlProperty &that) if (signalHandler) return signalHandler->expression(); - return 0; + return nullptr; } /*! @@ -945,7 +945,7 @@ void QQmlPropertyPrivate::takeSignalExpression(const QQmlProperty &that, return; } - QQmlData *data = QQmlData::get(that.d->object, 0 != expr); + QQmlData *data = QQmlData::get(that.d->object, nullptr != expr); if (!data) return; @@ -1052,7 +1052,7 @@ QVariant QQmlPropertyPrivate::readValueProperty() } else if (core.isQObject()) { - QObject *rv = 0; + QObject *rv = nullptr; core.readProperty(object, &rv); return QVariant::fromValue(rv); @@ -1063,11 +1063,11 @@ QVariant QQmlPropertyPrivate::readValueProperty() QVariant value; int status = -1; - void *args[] = { 0, &value, &status }; + void *args[] = { nullptr, &value, &status }; if (core.propType() == QMetaType::QVariant) { args[0] = &value; } else { - value = QVariant(core.propType(), (void*)0); + value = QVariant(core.propType(), (void*)nullptr); args[0] = value.data(); } core.readPropertyWithArgs(object, args); @@ -1426,7 +1426,7 @@ QQmlMetaObject QQmlPropertyPrivate::rawMetaObjectForType(QQmlEnginePrivate *engi */ bool QQmlProperty::write(const QVariant &value) const { - return QQmlPropertyPrivate::write(*this, value, 0); + return QQmlPropertyPrivate::write(*this, value, nullptr); } /*! @@ -1495,7 +1495,7 @@ bool QQmlProperty::write(QObject *object, const QString &name, const QVariant &v bool QQmlProperty::reset() const { if (isResettable()) { - void *args[] = { 0 }; + void *args[] = { nullptr }; QMetaObject::metacall(d->object, QMetaObject::ResetProperty, d->core.coreIndex(), args); return true; } else { diff --git a/src/qml/qml/qqmlproperty_p.h b/src/qml/qml/qqmlproperty_p.h index 7a66d8113c..544eab4c7f 100644 --- a/src/qml/qml/qqmlproperty_p.h +++ b/src/qml/qml/qqmlproperty_p.h @@ -104,9 +104,9 @@ public: static bool writeValueProperty(QObject *, const QQmlPropertyData &, const QQmlPropertyData &valueTypeData, const QVariant &, QQmlContextData *, - QQmlPropertyData::WriteFlags flags = 0); + QQmlPropertyData::WriteFlags flags = nullptr); static bool write(QObject *, const QQmlPropertyData &, const QVariant &, - QQmlContextData *, QQmlPropertyData::WriteFlags flags = 0); + QQmlContextData *, QQmlPropertyData::WriteFlags flags = nullptr); static void findAliasTarget(QObject *, QQmlPropertyIndex, QObject **, QQmlPropertyIndex *); enum BindingFlag { @@ -140,7 +140,7 @@ public: static QMetaMethod findSignalByName(const QMetaObject *mo, const QByteArray &); static bool connect(const QObject *sender, int signal_index, const QObject *receiver, int method_index, - int type = 0, int *types = 0); + int type = 0, int *types = nullptr); static void flushSignal(const QObject *sender, int signal_index); static QVariant resolvedUrlSequence(const QVariant &value, QQmlContextData *context); diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index bce81c1504..88eda9c020 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -243,9 +243,9 @@ void QQmlPropertyData::lazyLoad(const QMetaMethod &m) Creates a new empty QQmlPropertyCache. */ QQmlPropertyCache::QQmlPropertyCache() - : _parent(0), propertyIndexCacheStart(0), methodIndexCacheStart(0), + : _parent(nullptr), propertyIndexCacheStart(0), methodIndexCacheStart(0), signalHandlerIndexCacheStart(0), _hasPropertyOverrides(false), _ownMetaObject(false), - _metaObject(0), argumentsCache(0), _jsFactoryMethodIndex(-1) + _metaObject(nullptr), argumentsCache(nullptr), _jsFactoryMethodIndex(-1) { } @@ -277,8 +277,8 @@ QQmlPropertyCache::~QQmlPropertyCache() if (_parent) _parent->release(); if (_ownMetaObject) free(const_cast<QMetaObject *>(_metaObject)); - _metaObject = 0; - _parent = 0; + _metaObject = nullptr; + _parent = nullptr; } QQmlPropertyCache *QQmlPropertyCache::copy(int reserve) @@ -310,7 +310,7 @@ QQmlPropertyCache *QQmlPropertyCache::copyAndReserve(int propertyCount, int meth rv->methodIndexCache.reserve(methodCount); rv->signalHandlerIndexCache.reserve(signalCount); rv->enumCache.reserve(enumCount); - rv->_metaObject = 0; + rv->_metaObject = nullptr; return rv; } @@ -337,7 +337,7 @@ void QQmlPropertyCache::appendProperty(const QString &name, QQmlPropertyData::Fl int index = propertyIndexCache.count(); propertyIndexCache.append(data); - setNamedProperty(name, index + propertyOffset(), propertyIndexCache.data() + index, (old != 0)); + setNamedProperty(name, index + propertyOffset(), propertyIndexCache.data() + index, (old != nullptr)); } void QQmlPropertyCache::appendSignal(const QString &name, QQmlPropertyData::Flags flags, @@ -374,8 +374,8 @@ void QQmlPropertyCache::appendSignal(const QString &name, QQmlPropertyData::Flag QString handlerName = QLatin1String("on") + name; handlerName[2] = handlerName.at(2).toUpper(); - setNamedProperty(name, methodIndex + methodOffset(), methodIndexCache.data() + methodIndex, (old != 0)); - setNamedProperty(handlerName, signalHandlerIndex + signalOffset(), signalHandlerIndexCache.data() + signalHandlerIndex, (old != 0)); + setNamedProperty(name, methodIndex + methodOffset(), methodIndexCache.data() + methodIndex, (old != nullptr)); + setNamedProperty(handlerName, signalHandlerIndex + signalOffset(), signalHandlerIndexCache.data() + signalHandlerIndex, (old != nullptr)); } void QQmlPropertyCache::appendMethod(const QString &name, QQmlPropertyData::Flags flags, @@ -402,7 +402,7 @@ void QQmlPropertyCache::appendMethod(const QString &name, QQmlPropertyData::Flag int methodIndex = methodIndexCache.count(); methodIndexCache.append(data); - setNamedProperty(name, methodIndex + methodOffset(), methodIndexCache.data() + methodIndex, (old != 0)); + setNamedProperty(name, methodIndex + methodOffset(), methodIndexCache.data() + methodIndex, (old != nullptr)); } void QQmlPropertyCache::appendEnum(const QString &name, const QVector<QQmlEnumValue> &values) @@ -430,7 +430,7 @@ const QMetaObject *QQmlPropertyCache::createMetaObject() QQmlPropertyData *QQmlPropertyCache::defaultProperty() const { - return property(defaultPropertyName(), 0, 0); + return property(defaultPropertyName(), nullptr, nullptr); } void QQmlPropertyCache::setParent(QQmlPropertyCache *newParent) @@ -543,7 +543,7 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, } QQmlPropertyData *data = &methodIndexCache[ii - methodIndexCacheStart]; - QQmlPropertyData *sigdata = 0; + QQmlPropertyData *sigdata = nullptr; if (m.methodType() == QMetaMethod::Signal) data->setFlags(signalFlags); @@ -562,24 +562,24 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, sigdata->_flags.isSignalHandler = true; } - QQmlPropertyData *old = 0; + QQmlPropertyData *old = nullptr; if (utf8) { QHashedString methodName(QString::fromUtf8(rawName, cptr - rawName)); if (StringCache::mapped_type *it = stringCache.value(methodName)) old = it->second; - setNamedProperty(methodName, ii, data, (old != 0)); + setNamedProperty(methodName, ii, data, (old != nullptr)); if (data->isSignal()) { QHashedString on(QLatin1String("on") % methodName.at(0).toUpper() % methodName.midRef(1)); - setNamedProperty(on, ii, sigdata, (old != 0)); + setNamedProperty(on, ii, sigdata, (old != nullptr)); ++signalHandlerIndex; } } else { QHashedCStringRef methodName(rawName, cptr - rawName); if (StringCache::mapped_type *it = stringCache.value(methodName)) old = it->second; - setNamedProperty(methodName, ii, data, (old != 0)); + setNamedProperty(methodName, ii, data, (old != nullptr)); if (data->isSignal()) { int length = methodName.length(); @@ -593,7 +593,7 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, str[length + 2] = '\0'; QHashedString on(QString::fromLatin1(str.data())); - setNamedProperty(on, ii, data, (old != 0)); + setNamedProperty(on, ii, data, (old != nullptr)); ++signalHandlerIndex; } } @@ -636,18 +636,18 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, Q_ASSERT((allowedRevisionCache.count() - 1) < Q_INT16_MAX); data->setMetaObjectOffset(allowedRevisionCache.count() - 1); - QQmlPropertyData *old = 0; + QQmlPropertyData *old = nullptr; if (utf8) { QHashedString propName(QString::fromUtf8(str, cptr - str)); if (StringCache::mapped_type *it = stringCache.value(propName)) old = it->second; - setNamedProperty(propName, ii, data, (old != 0)); + setNamedProperty(propName, ii, data, (old != nullptr)); } else { QHashedCStringRef propName(str, cptr - str); if (StringCache::mapped_type *it = stringCache.value(propName)) old = it->second; - setNamedProperty(propName, ii, data, (old != 0)); + setNamedProperty(propName, ii, data, (old != nullptr)); } bool isGadget = true; @@ -750,7 +750,7 @@ void QQmlPropertyCache::invalidate(const QMetaObject *metaObject) signalHandlerIndexCache.clear(); _hasPropertyOverrides = false; - argumentsCache = 0; + argumentsCache = nullptr; int pc = metaObject->propertyCount(); int mc = metaObject->methodCount(); @@ -773,8 +773,8 @@ void QQmlPropertyCache::invalidate(const QMetaObject *metaObject) QQmlPropertyData *QQmlPropertyCache::findProperty(StringCache::ConstIterator it, QObject *object, QQmlContextData *context) const { - QQmlData *data = (object ? QQmlData::get(object) : 0); - const QQmlVMEMetaObject *vmemo = 0; + QQmlData *data = (object ? QQmlData::get(object) : nullptr); + const QQmlVMEMetaObject *vmemo = nullptr; if (data && data->hasVMEMetaObject) { QObjectPrivate *op = QObjectPrivate::get(object); vmemo = static_cast<const QQmlVMEMetaObject *>(op->metaObject); @@ -849,7 +849,7 @@ QQmlPropertyData *QQmlPropertyCache::findProperty(StringCache::ConstIterator it, return ensureResolved(result); } - return 0; + return nullptr; } QString QQmlPropertyData::name(QObject *object) const @@ -919,9 +919,9 @@ QQmlPropertyCacheMethodArguments *QQmlPropertyCache::createArgumentsObject(int a A *args = static_cast<A *>(malloc(sizeof(A) + (argc) * sizeof(int))); args->arguments[0] = argc; args->argumentsValid = false; - args->signalParameterStringForJS = 0; + args->signalParameterStringForJS = nullptr; args->parameterError = false; - args->names = argc ? new QList<QByteArray>(names) : 0; + args->names = argc ? new QList<QByteArray>(names) : nullptr; args->next = argumentsCache; argumentsCache = args; return args; @@ -1027,10 +1027,10 @@ static QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, c } /* If the "cmo" variable didn't change, set it to 0 to * avoid running into an infinite loop */ - if (!changed) cmo = 0; + if (!changed) cmo = nullptr; } } else { - cmo = 0; + cmo = nullptr; } } } @@ -1057,7 +1057,7 @@ QQmlPropertyData * qQmlPropertyCacheProperty(QJSEngine *engine, QObject *obj, T name, QQmlContextData *context, QQmlPropertyData &local) { - QQmlPropertyCache *cache = 0; + QQmlPropertyCache *cache = nullptr; QQmlData *ddata = QQmlData::get(obj, false); @@ -1073,7 +1073,7 @@ qQmlPropertyCacheProperty(QJSEngine *engine, QObject *obj, T name, } } - QQmlPropertyData *rv = 0; + QQmlPropertyData *rv = nullptr; if (cache) { rv = cache->property(name, obj, context); @@ -1214,7 +1214,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) // '+=' reserves extra capacity. Follow-up appending will be probably free. signature += methods.at(ii).first.toUtf8() + '('; - QQmlPropertyCacheMethodArguments *arguments = 0; + QQmlPropertyCacheMethodArguments *arguments = nullptr; if (data->hasArguments()) { arguments = (QQmlPropertyCacheMethodArguments *)data->arguments(); Q_ASSERT(arguments->argumentsValid); @@ -1252,7 +1252,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) } if (!_defaultPropertyName.isEmpty()) { - QQmlPropertyData *dp = property(_defaultPropertyName, 0, 0); + QQmlPropertyData *dp = property(_defaultPropertyName, nullptr, nullptr); if (dp && dp->coreIndex() >= propertyIndexCacheStart) { Q_ASSERT(!dp->isFunction()); builder.addClassInfo("DefaultProperty", _defaultPropertyName.toUtf8()); @@ -1577,7 +1577,7 @@ void QQmlMetaObject::resolveGadgetMethodOrPropertyIndex(QMetaObject::Call type, QQmlPropertyCache *QQmlMetaObject::propertyCache(QQmlEnginePrivate *e) const { - if (_m.isNull()) return 0; + if (_m.isNull()) return nullptr; if (_m.isT1()) return _m.asT1(); else return e->cache(_m.asT2()); } @@ -1588,7 +1588,7 @@ int QQmlMetaObject::methodReturnType(const QQmlPropertyData &data, QByteArray *u int type = data.propType(); - const char *propTypeName = 0; + const char *propTypeName = nullptr; if (type == QMetaType::UnknownType) { // Find the return type name from the method info @@ -1676,7 +1676,7 @@ int *QQmlMetaObject::methodParameterTypes(int index, ArgTypeStorage *argStorage, } if (type == QMetaType::UnknownType) { if (unknownTypeError) *unknownTypeError = argTypeNames.at(ii); - return 0; + return nullptr; } args->arguments[ii + 1] = type; } @@ -1715,7 +1715,7 @@ int *QQmlMetaObject::methodParameterTypes(const QMetaMethod &m, ArgTypeStorage * } if (type == QMetaType::UnknownType) { if (unknownTypeError) *unknownTypeError = argTypeNames.at(ii); - return 0; + return nullptr; } argStorage->operator[](ii + 1) = type; } @@ -1727,7 +1727,7 @@ void QQmlObjectOrGadget::metacall(QMetaObject::Call type, int index, void **argv { if (ptr.isNull()) { const QMetaObject *metaObject = _m.asT2(); - metaObject->d.static_metacall(0, type, index, argv); + metaObject->d.static_metacall(nullptr, type, index, argv); } else if (ptr.isT1()) { QMetaObject::metacall(ptr.asT1(), type, index, argv); diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index 11b7c04c52..7b04ba11b8 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -323,7 +323,7 @@ public: inline void readProperty(QObject *target, void *property) const { - void *args[] = { property, 0 }; + void *args[] = { property, nullptr }; readPropertyWithArgs(target, args); } @@ -340,7 +340,7 @@ public: bool writeProperty(QObject *target, void *value, WriteFlags flags) const { int status = -1; - void *argv[] = { value, 0, &status, &flags }; + void *argv[] = { value, nullptr, &status, &flags }; if (flags.testFlag(BypassInterceptor) && hasStaticMetaCallFunction()) staticMetaCallFunction()(target, QMetaObject::WriteProperty, relativePropertyIndex(), argv); else if (flags.testFlag(BypassInterceptor) && isDirect()) @@ -376,10 +376,10 @@ private: struct QQmlEnumValue { - QQmlEnumValue() : value(-1) {} + QQmlEnumValue() {} QQmlEnumValue(const QString &n, int v) : namedValue(n), value(v) {} QString namedValue; - int value; + int value = -1; }; struct QQmlEnumData @@ -417,7 +417,7 @@ public: void appendProperty(const QString &, QQmlPropertyRawData::Flags flags, int coreIndex, int propType, int revision, int notifyIndex); void appendSignal(const QString &, QQmlPropertyRawData::Flags, int coreIndex, - const int *types = 0, const QList<QByteArray> &names = QList<QByteArray>()); + const int *types = nullptr, const QList<QByteArray> &names = QList<QByteArray>()); void appendMethod(const QString &, QQmlPropertyData::Flags flags, int coreIndex, const QList<QByteArray> &names = QList<QByteArray>()); void appendEnum(const QString &, const QVector<QQmlEnumValue> &); @@ -465,7 +465,7 @@ public: static int originalClone(QObject *, int index); QList<QByteArray> signalParameterNames(int index) const; - static QString signalParameterStringForJS(QV4::ExecutionEngine *engine, const QList<QByteArray> ¶meterNameList, QString *errorString = 0); + static QString signalParameterStringForJS(QV4::ExecutionEngine *engine, const QList<QByteArray> ¶meterNameList, QString *errorString = nullptr); const char *className() const; @@ -739,7 +739,7 @@ inline const QMetaObject *QQmlPropertyCache::metaObject() const // QML inline const QMetaObject *QQmlPropertyCache::firstCppMetaObject() const { - while (_parent && (_metaObject == 0 || _ownMetaObject)) + while (_parent && (_metaObject == nullptr || _ownMetaObject)) return _parent->firstCppMetaObject(); return _metaObject; } @@ -747,7 +747,7 @@ inline const QMetaObject *QQmlPropertyCache::firstCppMetaObject() const inline QQmlPropertyData *QQmlPropertyCache::property(int index) const { if (index < 0 || index >= (propertyIndexCacheStart + propertyIndexCache.count())) - return 0; + return nullptr; if (index < propertyIndexCacheStart) return _parent->property(index); @@ -759,7 +759,7 @@ inline QQmlPropertyData *QQmlPropertyCache::property(int index) const inline QQmlPropertyData *QQmlPropertyCache::method(int index) const { if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.count())) - return 0; + return nullptr; if (index < methodIndexCacheStart) return _parent->method(index); @@ -775,7 +775,7 @@ inline QQmlPropertyData *QQmlPropertyCache::method(int index) const inline QQmlPropertyData *QQmlPropertyCache::signal(int index) const { if (index < 0 || index >= (signalHandlerIndexCacheStart + signalHandlerIndexCache.count())) - return 0; + return nullptr; if (index < signalHandlerIndexCacheStart) return _parent->signal(index); @@ -788,7 +788,7 @@ inline QQmlPropertyData *QQmlPropertyCache::signal(int index) const inline QQmlEnumData *QQmlPropertyCache::qmlEnum(int index) const { if (index < 0 || index >= enumCache.count()) - return 0; + return nullptr; return const_cast<QQmlEnumData *>(&enumCache.at(index)); } @@ -819,7 +819,7 @@ QQmlPropertyData * QQmlPropertyCache::overrideData(QQmlPropertyData *data) const { if (!data->hasOverride()) - return 0; + return nullptr; if (data->overrideIndexIsProperty()) return property(data->overrideIndex()); @@ -921,7 +921,7 @@ bool QQmlMetaObject::isNull() const const char *QQmlMetaObject::className() const { if (_m.isNull()) { - return 0; + return nullptr; } else if (_m.isT1()) { return _m.asT1()->className(); } else { @@ -947,7 +947,7 @@ bool QQmlMetaObject::hasMetaObject() const const QMetaObject *QQmlMetaObject::metaObject() const { - if (_m.isNull()) return 0; + if (_m.isNull()) return nullptr; if (_m.isT1()) return _m.asT1()->createMetaObject(); else return _m.asT2(); } diff --git a/src/qml/qml/qqmlpropertyvalueinterceptor.cpp b/src/qml/qml/qqmlpropertyvalueinterceptor.cpp index 52c003ab59..603245f29d 100644 --- a/src/qml/qml/qqmlpropertyvalueinterceptor.cpp +++ b/src/qml/qml/qqmlpropertyvalueinterceptor.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE /*! Constructs a QQmlPropertyValueInterceptor. */ -QQmlPropertyValueInterceptor::QQmlPropertyValueInterceptor() : m_next(0) +QQmlPropertyValueInterceptor::QQmlPropertyValueInterceptor() : m_next(nullptr) { } diff --git a/src/qml/qml/qqmlproxymetaobject.cpp b/src/qml/qml/qqmlproxymetaobject.cpp index 27e3c13ff8..e1500f70fb 100644 --- a/src/qml/qml/qqmlproxymetaobject.cpp +++ b/src/qml/qml/qqmlproxymetaobject.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE QQmlProxyMetaObject::QQmlProxyMetaObject(QObject *obj, QList<ProxyData> *mList) -: metaObjects(mList), proxies(0), parent(0), object(obj) +: metaObjects(mList), proxies(nullptr), parent(nullptr), object(obj) { *static_cast<QMetaObject *>(this) = *metaObjects->constFirst().metaObject; @@ -58,11 +58,11 @@ QQmlProxyMetaObject::~QQmlProxyMetaObject() { if (parent) delete parent; - parent = 0; + parent = nullptr; if (proxies) delete [] proxies; - proxies = 0; + proxies = nullptr; } int QQmlProxyMetaObject::metaCall(QObject *o, QMetaObject::Call c, int id, void **a) diff --git a/src/qml/qml/qqmlscriptstring_p.h b/src/qml/qml/qqmlscriptstring_p.h index 2dfb817186..fd8ccd5d53 100644 --- a/src/qml/qml/qqmlscriptstring_p.h +++ b/src/qml/qml/qqmlscriptstring_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE class Q_AUTOTEST_EXPORT QQmlScriptStringPrivate : public QSharedData { public: - QQmlScriptStringPrivate() : context(0), scope(0), bindingId(-1), lineNumber(0), columnNumber(0), + QQmlScriptStringPrivate() : context(nullptr), scope(nullptr), bindingId(-1), lineNumber(0), columnNumber(0), numberValue(0), isStringLiteral(false), isNumberLiteral(false) {} //for testing diff --git a/src/qml/qml/qqmlstringconverters_p.h b/src/qml/qml/qqmlstringconverters_p.h index af344e3344..215f0c0aaf 100644 --- a/src/qml/qml/qqmlstringconverters_p.h +++ b/src/qml/qml/qqmlstringconverters_p.h @@ -67,19 +67,19 @@ class QByteArray; namespace QQmlStringConverters { Q_QML_PRIVATE_EXPORT QVariant variantFromString(const QString &); - Q_QML_PRIVATE_EXPORT QVariant variantFromString(const QString &, int preferredType, bool *ok = 0); + Q_QML_PRIVATE_EXPORT QVariant variantFromString(const QString &, int preferredType, bool *ok = nullptr); - Q_QML_PRIVATE_EXPORT QVariant colorFromString(const QString &, bool *ok = 0); - Q_QML_PRIVATE_EXPORT unsigned rgbaFromString(const QString &, bool *ok = 0); + Q_QML_PRIVATE_EXPORT QVariant colorFromString(const QString &, bool *ok = nullptr); + Q_QML_PRIVATE_EXPORT unsigned rgbaFromString(const QString &, bool *ok = nullptr); #if QT_CONFIG(datestring) - Q_QML_PRIVATE_EXPORT QDate dateFromString(const QString &, bool *ok = 0); - Q_QML_PRIVATE_EXPORT QTime timeFromString(const QString &, bool *ok = 0); - Q_QML_PRIVATE_EXPORT QDateTime dateTimeFromString(const QString &, bool *ok = 0); + Q_QML_PRIVATE_EXPORT QDate dateFromString(const QString &, bool *ok = nullptr); + Q_QML_PRIVATE_EXPORT QTime timeFromString(const QString &, bool *ok = nullptr); + Q_QML_PRIVATE_EXPORT QDateTime dateTimeFromString(const QString &, bool *ok = nullptr); #endif - Q_QML_PRIVATE_EXPORT QPointF pointFFromString(const QString &, bool *ok = 0); - Q_QML_PRIVATE_EXPORT QSizeF sizeFFromString(const QString &, bool *ok = 0); - Q_QML_PRIVATE_EXPORT QRectF rectFFromString(const QString &, bool *ok = 0); + Q_QML_PRIVATE_EXPORT QPointF pointFFromString(const QString &, bool *ok = nullptr); + Q_QML_PRIVATE_EXPORT QSizeF sizeFFromString(const QString &, bool *ok = nullptr); + Q_QML_PRIVATE_EXPORT QRectF rectFFromString(const QString &, bool *ok = nullptr); Q_QML_PRIVATE_EXPORT bool createFromString(int, const QString &, void *, size_t); } diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index e5682df761..ed1526c0a9 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -550,7 +550,7 @@ void QQmlDataBlob::networkError(QNetworkReply::NetworkError networkError) QQmlError error; error.setUrl(m_url); - const char *errorString = 0; + const char *errorString = nullptr; switch (networkError) { default: errorString = "Network error"; @@ -791,7 +791,7 @@ void QQmlDataBlob::ThreadData::setProgress(quint8 v) QQmlTypeLoaderThread::QQmlTypeLoaderThread(QQmlTypeLoader *loader) : m_loader(loader) #if QT_CONFIG(qml_network) -, m_networkAccessManager(0), m_networkReplyProxy(0) +, m_networkAccessManager(nullptr), m_networkReplyProxy(nullptr) #endif // qml_network { // Do that after initializing all the members. @@ -803,7 +803,7 @@ QNetworkAccessManager *QQmlTypeLoaderThread::networkAccessManager() const { Q_ASSERT(isThisThread()); if (!m_networkAccessManager) { - m_networkAccessManager = QQmlEnginePrivate::get(m_loader->engine())->createNetworkAccessManager(0); + m_networkAccessManager = QQmlEnginePrivate::get(m_loader->engine())->createNetworkAccessManager(nullptr); m_networkReplyProxy = new QQmlTypeLoaderNetworkReplyProxy(m_loader); } @@ -876,9 +876,9 @@ void QQmlTypeLoaderThread::shutdownThread() { #if QT_CONFIG(qml_network) delete m_networkAccessManager; - m_networkAccessManager = 0; + m_networkAccessManager = nullptr; delete m_networkReplyProxy; - m_networkReplyProxy = 0; + m_networkReplyProxy = nullptr; #endif // qml_network } @@ -962,7 +962,7 @@ void QQmlTypeLoader::invalidate() if (m_thread) { shutdownThread(); delete m_thread; - m_thread = 0; + m_thread = nullptr; } #if QT_CONFIG(qml_network) @@ -1535,7 +1535,7 @@ void QQmlTypeLoader::Blob::dependencyComplete(QQmlDataBlob *blob) bool QQmlTypeLoader::Blob::isDebugging() const { - return typeLoader()->engine()->handle()->debugger() != 0; + return typeLoader()->engine()->handle()->debugger() != nullptr; } bool QQmlTypeLoader::Blob::qmldirDataAvailable(QQmlQmldirData *data, QList<QQmlError> *errors) @@ -1543,7 +1543,7 @@ bool QQmlTypeLoader::Blob::qmldirDataAvailable(QQmlQmldirData *data, QList<QQmlE bool resolve = true; const QV4::CompiledData::Import *import = data->import(this); - data->setImport(this, 0); + data->setImport(this, nullptr); int priority = data->priority(this); data->setPriority(this, 0); @@ -1818,7 +1818,7 @@ QString QQmlTypeLoader::absoluteFilePath(const QString &path) if (!m_importDirCache.contains(dirPath)) { bool exists = QDir(dirPath).exists(); - QCache<QString, bool> *entry = exists ? new QCache<QString, bool> : 0; + QCache<QString, bool> *entry = exists ? new QCache<QString, bool> : nullptr; m_importDirCache.insert(dirPath, entry); } QCache<QString, bool> *fileSet = m_importDirCache.object(dirPath); @@ -1881,12 +1881,12 @@ bool QQmlTypeLoader::directoryExists(const QString &path) if (!m_importDirCache.contains(dirPath)) { bool exists = QDir(dirPath).exists(); - QCache<QString, bool> *files = exists ? new QCache<QString, bool> : 0; + QCache<QString, bool> *files = exists ? new QCache<QString, bool> : nullptr; m_importDirCache.insert(dirPath, files); } QCache<QString, bool> *fileSet = m_importDirCache.object(dirPath); - return fileSet != 0; + return fileSet != nullptr; } @@ -2764,7 +2764,7 @@ bool QQmlTypeData::resolveType(const QString &typeName, int &majorVersion, int & TypeReference &ref, int lineNumber, int columnNumber, bool reportErrors, QQmlType::RegistrationType registrationType) { - QQmlImportNamespace *typeNamespace = 0; + QQmlImportNamespace *typeNamespace = nullptr; QList<QQmlError> errors; bool typeFound = m_importCache.resolveType(typeName, &ref.type, &majorVersion, &minorVersion, @@ -2824,9 +2824,9 @@ void QQmlTypeData::scriptImported(QQmlScriptBlob *blob, const QV4::CompiledData: } QQmlScriptData::QQmlScriptData() - : typeNameCache(0) + : typeNameCache(nullptr) , m_loaded(false) - , m_program(0) + , m_program(nullptr) { } @@ -2843,7 +2843,7 @@ void QQmlScriptData::initialize(QQmlEngine *engine) QV4::ExecutionEngine *v4 = engine->handle(); - m_program = new QV4::Script(v4, 0, m_precompiledScript); + m_program = new QV4::Script(v4, nullptr, m_precompiledScript); addToEngine(engine); @@ -2864,7 +2864,7 @@ QV4::ReturnedValue QQmlScriptData::scriptValueForContext(QQmlContextData *parent QQmlContextData *effectiveCtxt = parentCtxt; if (shared) - effectiveCtxt = 0; + effectiveCtxt = nullptr; // Create the script context if required QQmlContextDataRef ctxt(new QQmlContextData); @@ -2912,7 +2912,7 @@ QV4::ReturnedValue QQmlScriptData::scriptValueForContext(QQmlContextData *parent return QV4::Encode::undefined(); } - QV4::Scoped<QV4::QmlContext> qmlContext(scope, QV4::QmlContext::create(v4->rootContext(), ctxt, 0)); + QV4::Scoped<QV4::QmlContext> qmlContext(scope, QV4::QmlContext::create(v4->rootContext(), ctxt, nullptr)); m_program->qmlContext.set(scope.engine, qmlContext); m_program->run(); @@ -2936,7 +2936,7 @@ void QQmlScriptData::clear() { if (typeNameCache) { typeNameCache->release(); - typeNameCache = 0; + typeNameCache = nullptr; } for (int ii = 0; ii < scripts.count(); ++ii) @@ -2948,7 +2948,7 @@ void QQmlScriptData::clear() } QQmlScriptBlob::QQmlScriptBlob(const QUrl &url, QQmlTypeLoader *loader) -: QQmlTypeLoader::Blob(url, JavaScriptFile, loader), m_scriptData(0) +: QQmlTypeLoader::Blob(url, JavaScriptFile, loader), m_scriptData(nullptr) { } @@ -2956,7 +2956,7 @@ QQmlScriptBlob::~QQmlScriptBlob() { if (m_scriptData) { m_scriptData->release(); - m_scriptData = 0; + m_scriptData = nullptr; } } @@ -3135,7 +3135,7 @@ const QV4::CompiledData::Import *QQmlQmldirData::import(QQmlTypeLoader::Blob *bl QHash<QQmlTypeLoader::Blob *, const QV4::CompiledData::Import *>::const_iterator it = m_imports.find(blob); if (it == m_imports.end()) - return 0; + return nullptr; return *it; } diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index 875c335c9a..f2327e9a5f 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -411,7 +411,7 @@ class Q_AUTOTEST_EXPORT QQmlTypeData : public QQmlTypeLoader::Blob public: struct TypeReference { - TypeReference() : majorVersion(0), minorVersion(0), typeData(0), needsCreation(true) {} + TypeReference() : majorVersion(0), minorVersion(0), typeData(nullptr), needsCreation(true) {} QV4::CompiledData::Location location; QQmlType type; @@ -425,7 +425,7 @@ public: struct ScriptReference { - ScriptReference() : script(0) {} + ScriptReference() : script(nullptr) {} QV4::CompiledData::Location location; QString qualifier; @@ -558,7 +558,7 @@ public: struct ScriptReference { - ScriptReference() : script(0) {} + ScriptReference() : script(nullptr) {} QV4::CompiledData::Location location; QString qualifier; diff --git a/src/qml/qml/qqmltypenamecache.cpp b/src/qml/qml/qqmltypenamecache.cpp index 32b0fa16c4..8f1a61e6ad 100644 --- a/src/qml/qml/qqmltypenamecache.cpp +++ b/src/qml/qml/qqmltypenamecache.cpp @@ -56,7 +56,7 @@ void QQmlTypeNameCache::add(const QHashedString &name, const QUrl &url, const QH { if (nameSpace.length() != 0) { QQmlImportRef *i = m_namedImports.value(nameSpace); - Q_ASSERT(i != 0); + Q_ASSERT(i != nullptr); i->compositeSingletons.insert(name, url); return; } @@ -75,7 +75,7 @@ void QQmlTypeNameCache::add(const QHashedString &name, int importedScriptIndex, if (nameSpace.length() != 0) { QQmlImportRef *i = m_namedImports.value(nameSpace); - Q_ASSERT(i != 0); + Q_ASSERT(i != nullptr); m_namespacedImports[i].insert(name, import); return; } @@ -98,10 +98,10 @@ QQmlTypeNameCache::Result QQmlTypeNameCache::query(const QHashedStringRef &name) if (!result.isValid()) { // Look up anonymous types from the imports of this document - QQmlImportNamespace *typeNamespace = 0; + QQmlImportNamespace *typeNamespace = nullptr; QList<QQmlError> errors; QQmlType t; - bool typeFound = m_imports.resolveType(name, &t, 0, 0, &typeNamespace, &errors); + bool typeFound = m_imports.resolveType(name, &t, nullptr, nullptr, &typeNamespace, &errors); if (typeFound) { return Result(t); } @@ -126,10 +126,10 @@ QQmlTypeNameCache::Result QQmlTypeNameCache::query(const QHashedStringRef &name, // ### it would be nice if QQmlImports allowed us to resolve a namespace // first, and then types on it. QString qualifiedTypeName = importNamespace->m_qualifier + QLatin1Char('.') + name.toString(); - QQmlImportNamespace *typeNamespace = 0; + QQmlImportNamespace *typeNamespace = nullptr; QList<QQmlError> errors; QQmlType t; - bool typeFound = m_imports.resolveType(qualifiedTypeName, &t, 0, 0, &typeNamespace, &errors); + bool typeFound = m_imports.resolveType(qualifiedTypeName, &t, nullptr, nullptr, &typeNamespace, &errors); if (typeFound) { return Result(t); } @@ -151,10 +151,10 @@ QQmlTypeNameCache::Result QQmlTypeNameCache::query(const QV4::String *name, QQml if (!result.isValid()) { // Look up anonymous types from the imports of this document QString typeName = name->toQStringNoThrow(); - QQmlImportNamespace *typeNamespace = 0; + QQmlImportNamespace *typeNamespace = nullptr; QList<QQmlError> errors; QQmlType t; - bool typeFound = m_imports.resolveType(typeName, &t, 0, 0, &typeNamespace, &errors, + bool typeFound = m_imports.resolveType(typeName, &t, nullptr, nullptr, &typeNamespace, &errors, QQmlType::AnyRegistrationType, recursionRestriction); if (typeFound) { return Result(t); @@ -186,10 +186,10 @@ QQmlTypeNameCache::Result QQmlTypeNameCache::query(const QV4::String *name, cons // ### it would be nice if QQmlImports allowed us to resolve a namespace // first, and then types on it. QString qualifiedTypeName = importNamespace->m_qualifier + QLatin1Char('.') + name->toQStringNoThrow(); - QQmlImportNamespace *typeNamespace = 0; + QQmlImportNamespace *typeNamespace = nullptr; QList<QQmlError> errors; QQmlType t; - bool typeFound = m_imports.resolveType(qualifiedTypeName, &t, 0, 0, &typeNamespace, &errors); + bool typeFound = m_imports.resolveType(qualifiedTypeName, &t, nullptr, nullptr, &typeNamespace, &errors); if (typeFound) { return Result(t); } diff --git a/src/qml/qml/qqmltypenamecache_p.h b/src/qml/qml/qqmltypenamecache_p.h index 8ac25c4fbe..c2f7a70d03 100644 --- a/src/qml/qml/qqmltypenamecache_p.h +++ b/src/qml/qml/qqmltypenamecache_p.h @@ -162,7 +162,7 @@ private: }; QQmlTypeNameCache::Result::Result() -: importNamespace(0), scriptIndex(-1) +: importNamespace(nullptr), scriptIndex(-1) { } @@ -172,12 +172,12 @@ QQmlTypeNameCache::Result::Result(const QQmlImportRef *importNamespace) } QQmlTypeNameCache::Result::Result(const QQmlType &type) -: type(type), importNamespace(0), scriptIndex(-1) +: type(type), importNamespace(nullptr), scriptIndex(-1) { } QQmlTypeNameCache::Result::Result(int scriptIndex) -: importNamespace(0), scriptIndex(scriptIndex) +: importNamespace(nullptr), scriptIndex(scriptIndex) { } diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index 8e067932bb..6dbf6ad8c1 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -85,7 +85,7 @@ bool QQmlTypeWrapper::isSingleton() const QObject* QQmlTypeWrapper::singletonObject() const { if (!isSingleton()) - return 0; + return nullptr; QQmlEngine *e = engine()->qmlEngine(); QQmlType::SingletonInstanceInfo *siinfo = d()->type().singletonInstanceInfo(); diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp index 520f512b1a..270414a676 100644 --- a/src/qml/qml/qqmlvaluetype.cpp +++ b/src/qml/qml/qqmlvaluetype.cpp @@ -68,7 +68,7 @@ struct QQmlValueTypeFactoryImpl QQmlValueTypeFactoryImpl::QQmlValueTypeFactoryImpl() { for (unsigned int ii = 0; ii < QVariant::UserType; ++ii) - valueTypes[ii] = 0; + valueTypes[ii] = nullptr; // See types wrapped in qqmlmodelindexvaluetype_p.h qRegisterMetaType<QItemSelectionRange>(); @@ -83,7 +83,7 @@ QQmlValueTypeFactoryImpl::~QQmlValueTypeFactoryImpl() bool QQmlValueTypeFactoryImpl::isValueType(int idx) { if (idx >= (int)QVariant::UserType) { - return (valueType(idx) != 0); + return (valueType(idx) != nullptr); } else if (idx >= 0 && idx != QVariant::StringList && idx != QMetaType::QObjectStar @@ -130,7 +130,7 @@ const QMetaObject *QQmlValueTypeFactoryImpl::metaObjectForMetaType(int t) QMetaType metaType(t); if (metaType.flags() & QMetaType::IsGadget) return metaType.metaObject(); - return 0; + return nullptr; } QQmlValueType *QQmlValueTypeFactoryImpl::valueType(int idx) @@ -141,7 +141,7 @@ QQmlValueType *QQmlValueTypeFactoryImpl::valueType(int idx) QHash<int, QQmlValueType *>::iterator it = userTypes.find(idx); if (it == userTypes.end()) { - QQmlValueType *vt = 0; + QQmlValueType *vt = nullptr; if (const QMetaObject *mo = metaObjectForMetaType(idx)) vt = new QQmlValueType(idx, mo); it = userTypes.insert(idx, vt); @@ -209,14 +209,14 @@ QQmlValueType::~QQmlValueType() { QObjectPrivate *op = QObjectPrivate::get(this); Q_ASSERT(op->metaObject == this); - op->metaObject = 0; + op->metaObject = nullptr; ::free(const_cast<QMetaObject *>(_metaObject)); metaType.destroy(gadgetPtr); } void QQmlValueType::read(QObject *obj, int idx) { - void *a[] = { gadgetPtr, 0 }; + void *a[] = { gadgetPtr, nullptr }; QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a); } @@ -224,7 +224,7 @@ void QQmlValueType::write(QObject *obj, int idx, QQmlPropertyData::WriteFlags fl { Q_ASSERT(gadgetPtr); int status = -1; - void *a[] = { gadgetPtr, 0, &status, &flags }; + void *a[] = { gadgetPtr, nullptr, &status, &flags }; QMetaObject::metacall(obj, QMetaObject::WriteProperty, idx, a); } diff --git a/src/qml/qml/qqmlvaluetype_p.h b/src/qml/qml/qqmlvaluetype_p.h index 0502a5d665..7d8473db0e 100644 --- a/src/qml/qml/qqmlvaluetype_p.h +++ b/src/qml/qml/qqmlvaluetype_p.h @@ -272,19 +272,19 @@ int qmlRegisterValueTypeEnums(const char *uri, int versionMajor, int versionMino QQmlPrivate::RegisterType type = { 0, - qRegisterNormalizedMetaType<T *>(pointerName.constData()), 0, 0, 0, + qRegisterNormalizedMetaType<T *>(pointerName.constData()), 0, 0, nullptr, QString(), uri, versionMajor, versionMinor, qmlName, &T::staticMetaObject, - 0, 0, + nullptr, nullptr, 0, 0, 0, - 0, 0, + nullptr, nullptr, - 0, + nullptr, 0 }; diff --git a/src/qml/qml/qqmlvaluetypeproxybinding.cpp b/src/qml/qml/qqmlvaluetypeproxybinding.cpp index 7a3e4b2df4..d5cff26444 100644 --- a/src/qml/qml/qqmlvaluetypeproxybinding.cpp +++ b/src/qml/qml/qqmlvaluetypeproxybinding.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE QQmlValueTypeProxyBinding::QQmlValueTypeProxyBinding(QObject *o, QQmlPropertyIndex index) : QQmlAbstractBinding(), - m_bindings(0) + m_bindings(nullptr) { m_target = o; m_targetIndex = index; @@ -93,7 +93,7 @@ Removes a collection of bindings, corresponding to the set bits in \a mask. void QQmlValueTypeProxyBinding::removeBindings(quint32 mask) { QQmlAbstractBinding *binding = m_bindings.data(); - QQmlAbstractBinding *lastBinding = 0; + QQmlAbstractBinding *lastBinding = nullptr; while (binding) { const int valueTypeIndex = binding->targetPropertyIndex().valueTypeIndex(); @@ -102,7 +102,7 @@ void QQmlValueTypeProxyBinding::removeBindings(quint32 mask) remove->setAddedToObject(false); binding = remove->nextBinding(); - if (lastBinding == 0) + if (lastBinding == nullptr) m_bindings = remove->nextBinding(); else lastBinding->setNextBinding(remove->nextBinding()); diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index c643beeadc..a28115d192 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -131,7 +131,7 @@ bool QQmlValueTypeReference::readReferenceValue() const // variant-containing-value-type reference QVariant variantReferenceValue; - void *a[] = { &variantReferenceValue, 0 }; + void *a[] = { &variantReferenceValue, nullptr }; QMetaObject::metacall(d()->object, QMetaObject::ReadProperty, d()->property, a); int variantReferenceType = variantReferenceValue.userType(); @@ -141,14 +141,14 @@ bool QQmlValueTypeReference::readReferenceValue() const // We need to modify this reference to the updated value type, if // possible, or return false if it is not a value type. if (QQmlValueTypeFactory::isValueType(variantReferenceType)) { - QQmlPropertyCache *cache = 0; + QQmlPropertyCache *cache = nullptr; if (const QMetaObject *mo = QQmlValueTypeFactory::metaObjectForMetaType(variantReferenceType)) cache = QJSEnginePrivate::get(engine())->cache(mo); if (d()->gadgetPtr) { d()->valueType->metaType.destruct(d()->gadgetPtr); ::operator delete(d()->gadgetPtr); } - d()->gadgetPtr =0; + d()->gadgetPtr =nullptr; d()->setPropertyCache(cache); d()->valueType = QQmlValueTypeFactory::valueType(variantReferenceType); if (!cache) @@ -161,10 +161,10 @@ bool QQmlValueTypeReference::readReferenceValue() const } else { if (!d()->gadgetPtr) { d()->gadgetPtr = ::operator new(d()->valueType->metaType.sizeOf()); - d()->valueType->metaType.construct(d()->gadgetPtr, 0); + d()->valueType->metaType.construct(d()->gadgetPtr, nullptr); } // value-type reference - void *args[] = { d()->gadgetPtr, 0 }; + void *args[] = { d()->gadgetPtr, nullptr }; QMetaObject::metacall(d()->object, QMetaObject::ReadProperty, d()->property, args); } return true; @@ -191,7 +191,7 @@ ReturnedValue QQmlValueTypeWrapper::create(ExecutionEngine *engine, QObject *obj r->d()->property = property; r->d()->setPropertyCache(QJSEnginePrivate::get(engine)->cache(metaObject)); r->d()->valueType = QQmlValueTypeFactory::valueType(typeId); - r->d()->gadgetPtr = 0; + r->d()->gadgetPtr = nullptr; return r->asReturnedValue(); } @@ -203,7 +203,7 @@ ReturnedValue QQmlValueTypeWrapper::create(ExecutionEngine *engine, const QVaria Scoped<QQmlValueTypeWrapper> r(scope, engine->memoryManager->allocObject<QQmlValueTypeWrapper>()); r->d()->setPropertyCache(QJSEnginePrivate::get(engine)->cache(metaObject)); r->d()->valueType = QQmlValueTypeFactory::valueType(typeId); - r->d()->gadgetPtr = 0; + r->d()->gadgetPtr = nullptr; r->d()->setValue(value); return r->asReturnedValue(); } @@ -246,13 +246,13 @@ PropertyAttributes QQmlValueTypeWrapper::query(const Managed *m, String *name) Q_ASSERT(m->as<const QQmlValueTypeWrapper>()); const QQmlValueTypeWrapper *r = static_cast<const QQmlValueTypeWrapper *>(m); - QQmlPropertyData *result = r->d()->propertyCache()->property(name, 0, 0); + QQmlPropertyData *result = r->d()->propertyCache()->property(name, nullptr, nullptr); return result ? Attr_Data : Attr_Invalid; } void QQmlValueTypeWrapper::advanceIterator(Managed *m, ObjectIterator *it, Value *name, uint *index, Property *p, PropertyAttributes *attributes) { - name->setM(0); + name->setM(nullptr); *index = UINT_MAX; QQmlValueTypeWrapper *that = static_cast<QQmlValueTypeWrapper*>(m); @@ -299,7 +299,7 @@ bool QQmlValueTypeWrapper::write(QObject *target, int propertyIndex) const if (!d()->gadgetPtr) { Q_ALLOCA_ASSIGN(void, gadget, d()->valueType->metaType.sizeOf()); d()->gadgetPtr = gadget; - d()->valueType->metaType.construct(d()->gadgetPtr, 0); + d()->valueType->metaType.construct(d()->gadgetPtr, nullptr); destructGadgetOnExit = true; } if (!ref->readReferenceValue()) @@ -308,12 +308,12 @@ bool QQmlValueTypeWrapper::write(QObject *target, int propertyIndex) const int flags = 0; int status = -1; - void *a[] = { d()->gadgetPtr, 0, &status, &flags }; + void *a[] = { d()->gadgetPtr, nullptr, &status, &flags }; QMetaObject::metacall(target, QMetaObject::WriteProperty, propertyIndex, a); if (destructGadgetOnExit) { d()->valueType->metaType.destruct(d()->gadgetPtr); - d()->gadgetPtr = 0; + d()->gadgetPtr = nullptr; } return true; } @@ -367,7 +367,7 @@ ReturnedValue QQmlValueTypeWrapper::get(const Managed *m, String *name, bool *ha return Primitive::undefinedValue().asReturnedValue(); } - QQmlPropertyData *result = r->d()->propertyCache()->property(name, 0, 0); + QQmlPropertyData *result = r->d()->propertyCache()->property(name, nullptr, nullptr); if (!result) return Object::get(m, name, hasProperty); @@ -436,7 +436,7 @@ bool QQmlValueTypeWrapper::put(Managed *m, String *name, const Value &value) } const QMetaObject *metaObject = r->d()->propertyCache()->metaObject(); - const QQmlPropertyData *pd = r->d()->propertyCache()->property(name, 0, 0); + const QQmlPropertyData *pd = r->d()->propertyCache()->property(name, nullptr, nullptr); if (!pd) return false; @@ -505,13 +505,13 @@ bool QQmlValueTypeWrapper::put(Managed *m, String *name, const Value &value) int flags = 0; int status = -1; - void *a[] = { &variantReferenceValue, 0, &status, &flags }; + void *a[] = { &variantReferenceValue, nullptr, &status, &flags }; QMetaObject::metacall(reference->d()->object, QMetaObject::WriteProperty, reference->d()->property, a); } else { int flags = 0; int status = -1; - void *a[] = { r->d()->gadgetPtr, 0, &status, &flags }; + void *a[] = { r->d()->gadgetPtr, nullptr, &status, &flags }; QMetaObject::metacall(reference->d()->object, QMetaObject::WriteProperty, reference->d()->property, a); } } diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 72d4ab7e8f..018769948d 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -96,7 +96,7 @@ bool QQmlVME::componentCompleteEnabled() } QQmlVMEGuard::QQmlVMEGuard() -: m_objectCount(0), m_objects(0), m_contextCount(0), m_contexts(0) +: m_objectCount(0), m_objects(nullptr), m_contextCount(0), m_contexts(nullptr) { } @@ -126,9 +126,9 @@ void QQmlVMEGuard::clear() delete [] m_contexts; m_objectCount = 0; - m_objects = 0; + m_objects = nullptr; m_contextCount = 0; - m_contexts = 0; + m_contexts = nullptr; } bool QQmlVMEGuard::isOK() const diff --git a/src/qml/qml/qqmlvme_p.h b/src/qml/qml/qqmlvme_p.h index 99d63380ad..9a94ac6258 100644 --- a/src/qml/qml/qqmlvme_p.h +++ b/src/qml/qml/qqmlvme_p.h @@ -83,7 +83,7 @@ namespace QQmlVMETypes { struct State { enum Flag { Deferred = 0x00000001 }; - State() : flags(0), context(0), instructionStream(0) {} + State() : flags(0), context(nullptr), instructionStream(nullptr) {} quint32 flags; QQmlContextData *context; const char *instructionStream; @@ -143,7 +143,7 @@ private: }; QQmlInstantiationInterrupt::QQmlInstantiationInterrupt() - : mode(None), nsecs(0), runWhile(0) + : mode(None), nsecs(0), runWhile(nullptr) { } @@ -153,7 +153,7 @@ QQmlInstantiationInterrupt::QQmlInstantiationInterrupt(volatile bool *runWhile, } QQmlInstantiationInterrupt::QQmlInstantiationInterrupt(int nsecs) - : mode(Time), nsecs(nsecs), runWhile(0) + : mode(Time), nsecs(nsecs), runWhile(nullptr) { } diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index 73cb20dc7f..c1d3980b58 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -64,7 +64,7 @@ static void list_append(QQmlListProperty<QObject> *prop, QObject *o) { QList<QObject *> *list = static_cast<QList<QObject *> *>(prop->data); list->append(o); - static_cast<QQmlVMEMetaObject *>(prop->dummy1)->activate(prop->object, reinterpret_cast<quintptr>(prop->dummy2), 0); + static_cast<QQmlVMEMetaObject *>(prop->dummy1)->activate(prop->object, reinterpret_cast<quintptr>(prop->dummy2), nullptr); } static int list_count(QQmlListProperty<QObject> *prop) @@ -83,11 +83,11 @@ static void list_clear(QQmlListProperty<QObject> *prop) { QList<QObject *> *list = static_cast<QList<QObject *> *>(prop->data); list->clear(); - static_cast<QQmlVMEMetaObject *>(prop->dummy1)->activate(prop->object, reinterpret_cast<quintptr>(prop->dummy2), 0); + static_cast<QQmlVMEMetaObject *>(prop->dummy1)->activate(prop->object, reinterpret_cast<quintptr>(prop->dummy2), nullptr); } QQmlVMEVariantQObjectPtr::QQmlVMEVariantQObjectPtr() - : QQmlGuard<QObject>(0), m_target(0), m_index(-1) + : QQmlGuard<QObject>(nullptr), m_target(nullptr), m_index(-1) { } @@ -111,7 +111,7 @@ void QQmlVMEVariantQObjectPtr::objectDestroyed(QObject *) } } - m_target->activate(m_target->object, m_target->methodOffset() + m_index, 0); + m_target->activate(m_target->object, m_target->methodOffset() + m_index, nullptr); } } @@ -150,7 +150,7 @@ void QQmlVMEMetaObjectEndpoint::tryConnect() if (metaObject.flag()) { // This is actually notify int sigIdx = metaObject->methodOffset() + aliasId + metaObject->compiledObject->nProperties; - metaObject->activate(metaObject->object, sigIdx, 0); + metaObject->activate(metaObject->object, sigIdx, nullptr); } else { const QV4::CompiledData::Alias *aliasData = &metaObject->compiledObject->aliasTable()[aliasId]; if (!aliasData->isObjectAlias()) { @@ -179,7 +179,7 @@ void QQmlVMEMetaObjectEndpoint::tryConnect() QQmlInterceptorMetaObject::QQmlInterceptorMetaObject(QObject *obj, QQmlPropertyCache *cache) : object(obj), cache(cache), - interceptors(0), + interceptors(nullptr), hasAssignedMetaObjectData(false) { QObjectPrivate *op = QObjectPrivate::get(obj); @@ -320,7 +320,7 @@ QQmlVMEMetaObject::QQmlVMEMetaObject(QV4::ExecutionEngine *engine, : QQmlInterceptorMetaObject(obj, cache), engine(engine), ctxt(QQmlData::get(obj, true)->outerContext), - aliasEndpoints(0), compilationUnit(qmlCompilationUnit), compiledObject(0) + aliasEndpoints(nullptr), compilationUnit(qmlCompilationUnit), compiledObject(nullptr) { Q_ASSERT(engine); QQmlData::get(obj)->hasVMEMetaObject = true; @@ -358,7 +358,7 @@ QV4::MemberData *QQmlVMEMetaObject::propertyAndMethodStorageAsMemberData() const // such as the varProperties array) will have been cleaned up, but the // QObject ptr will not yet have been deleted (eg, waiting on deleteLater). // In this situation, return 0. - return 0; + return nullptr; } return static_cast<QV4::MemberData*>(propertyAndMethodStorage.asManaged()); @@ -575,13 +575,13 @@ QObject* QQmlVMEMetaObject::readPropertyAsQObject(int id) const { QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); if (!md) - return 0; + return nullptr; QV4::Scope scope(engine); QV4::ScopedValue sv(scope, *(md->data() + id)); const QV4::QObjectWrapper *wrapper = sv->as<QV4::QObjectWrapper>(); if (!wrapper) - return 0; + return nullptr; return wrapper->object(); } @@ -589,7 +589,7 @@ QList<QObject *> *QQmlVMEMetaObject::readPropertyAsList(int id) const { QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); if (!md) - return 0; + return nullptr; QV4::Scope scope(engine); QV4::Scoped<QV4::VariantObject> v(scope, *(md->data() + id)); @@ -643,7 +643,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * if (t == QV4::CompiledData::Property::Var) { // the context can be null if accessing var properties from cpp after re-parenting an item. - QQmlEnginePrivate *ep = (ctxt == 0 || ctxt->engine == 0) ? 0 : QQmlEnginePrivate::get(ctxt->engine); + QQmlEnginePrivate *ep = (ctxt == nullptr || ctxt->engine == nullptr) ? nullptr : QQmlEnginePrivate::get(ctxt->engine); if (ep) { if (c == QMetaObject::ReadProperty) { *reinterpret_cast<QVariant *>(a[0]) = readPropertyAsVariant(id); @@ -836,7 +836,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * } if (c == QMetaObject::WriteProperty && needActivate) { - activate(object, methodOffset() + id, 0); + activate(object, methodOffset() + id, nullptr); } return -1; @@ -848,7 +848,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * const QV4::CompiledData::Alias *aliasData = &compiledObject->aliasTable()[id]; if ((aliasData->flags & QV4::CompiledData::Alias::AliasPointsToPointerObject) && c == QMetaObject::ReadProperty) - *reinterpret_cast<void **>(a[0]) = 0; + *reinterpret_cast<void **>(a[0]) = nullptr; if (!ctxt) return -1; @@ -899,7 +899,7 @@ int QQmlVMEMetaObject::metaCall(QObject *o, QMetaObject::Call c, int _id, void * int rv = QMetaObject::metacall(valueType, c, valueTypePropertyIndex, a); if (c == QMetaObject::WriteProperty) - valueType->write(target, coreIndex, 0x00); + valueType->write(target, coreIndex, nullptr); return rv; @@ -1037,7 +1037,7 @@ void QQmlVMEMetaObject::writeVarProperty(int id, const QV4::Value &value) if (oldVariant) oldVariant->removeVmePropertyReference(); - QObject *valueObject = 0; + QObject *valueObject = nullptr; QQmlVMEVariantQObjectPtr *guard = getQObjectGuardForProperty(id); // And, if the new value is a scarce resource, we need to ensure that it does not get @@ -1060,7 +1060,7 @@ void QQmlVMEMetaObject::writeVarProperty(int id, const QV4::Value &value) // Write the value and emit change signal as appropriate. md->set(engine, id, value); - activate(object, methodOffset() + id, 0); + activate(object, methodOffset() + id, nullptr); } void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value) @@ -1088,7 +1088,7 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value) QVariant currentValue = readPropertyAsVariant(id); md->set(engine, id, newv); if ((currentValue.userType() != value.userType() || currentValue != value)) - activate(object, methodOffset() + id, 0); + activate(object, methodOffset() + id, nullptr); } else { bool needActivate = false; if (value.userType() == QMetaType::QObjectStar) { @@ -1111,7 +1111,7 @@ void QQmlVMEMetaObject::writeProperty(int id, const QVariant &value) } if (needActivate) - activate(object, methodOffset() + id, 0); + activate(object, methodOffset() + id, nullptr); } } @@ -1187,7 +1187,7 @@ bool QQmlVMEMetaObject::aliasTarget(int index, QObject **target, int *coreIndex, { Q_ASSERT(compiledObject && (index >= propOffset() + int(compiledObject->nProperties))); - *target = 0; + *target = nullptr; *coreIndex = -1; *valueTypeIndex = -1; @@ -1289,7 +1289,7 @@ QQmlVMEVariantQObjectPtr *QQmlVMEMetaObject::getQObjectGuardForProperty(int inde } } - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h index 7881240452..1da79b8a81 100644 --- a/src/qml/qml/qqmlvmemetaobject_p.h +++ b/src/qml/qml/qqmlvmemetaobject_p.h @@ -112,13 +112,11 @@ public: if (it->m_propertyIndex == propertyIndex) return true; } - if (auto parentInterceptor = ((parent.isT1() && parent.flag()) ? static_cast<QQmlInterceptorMetaObject *>(parent.asT1()) : 0)) + if (auto parentInterceptor = ((parent.isT1() && parent.flag()) ? static_cast<QQmlInterceptorMetaObject *>(parent.asT1()) : nullptr)) return parentInterceptor->intercepts(propertyIndex); return false; } - // use by tst_qqmllanguage - QQmlPropertyValueInterceptor *firstInterceptor() const { return interceptors; } protected: int metaCall(QObject *o, QMetaObject::Call c, int id, void **a) override; bool intercept(QMetaObject::Call c, int id, void **a); @@ -141,7 +139,7 @@ inline QQmlInterceptorMetaObject *QQmlInterceptorMetaObject::get(QObject *obj) } } - return 0; + return nullptr; } class QQmlVMEMetaObjectEndpoint; @@ -243,7 +241,7 @@ QQmlVMEMetaObject *QQmlVMEMetaObject::get(QObject *obj) } } - return 0; + return nullptr; } int QQmlVMEMetaObject::propOffset() const @@ -271,7 +269,7 @@ QQmlVMEMetaObject *QQmlVMEMetaObject::parentVMEMetaObject() const if (parent.isT1() && parent.flag()) return static_cast<QQmlVMEMetaObject *>(parent.asT1()); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index 9c9e199a5b..5673acec89 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -116,7 +116,7 @@ class DocumentImpl; class NodeImpl { public: - NodeImpl() : type(Element), document(0), parent(0) {} + NodeImpl() : type(Element), document(nullptr), parent(nullptr) {} virtual ~NodeImpl() { qDeleteAll(children); qDeleteAll(attributes); @@ -157,7 +157,7 @@ public: class DocumentImpl : public QQmlRefCount, public NodeImpl { public: - DocumentImpl() : root(0) { type = Document; } + DocumentImpl() : root(nullptr) { type = Document; } virtual ~DocumentImpl() { delete root; } @@ -306,18 +306,18 @@ void Heap::NodePrototype::init() Scope scope(internalClass->engine); ScopedObject o(scope, this); - o->defineAccessorProperty(QStringLiteral("nodeName"), QV4::NodePrototype::method_get_nodeName, 0); - o->defineAccessorProperty(QStringLiteral("nodeValue"), QV4::NodePrototype::method_get_nodeValue, 0); - o->defineAccessorProperty(QStringLiteral("nodeType"), QV4::NodePrototype::method_get_nodeType, 0); - o->defineAccessorProperty(QStringLiteral("namespaceUri"), QV4::NodePrototype::method_get_namespaceUri, 0); + o->defineAccessorProperty(QStringLiteral("nodeName"), QV4::NodePrototype::method_get_nodeName, nullptr); + o->defineAccessorProperty(QStringLiteral("nodeValue"), QV4::NodePrototype::method_get_nodeValue, nullptr); + o->defineAccessorProperty(QStringLiteral("nodeType"), QV4::NodePrototype::method_get_nodeType, nullptr); + o->defineAccessorProperty(QStringLiteral("namespaceUri"), QV4::NodePrototype::method_get_namespaceUri, nullptr); - o->defineAccessorProperty(QStringLiteral("parentNode"), QV4::NodePrototype::method_get_parentNode, 0); - o->defineAccessorProperty(QStringLiteral("childNodes"), QV4::NodePrototype::method_get_childNodes, 0); - o->defineAccessorProperty(QStringLiteral("firstChild"), QV4::NodePrototype::method_get_firstChild, 0); - o->defineAccessorProperty(QStringLiteral("lastChild"), QV4::NodePrototype::method_get_lastChild, 0); - o->defineAccessorProperty(QStringLiteral("previousSibling"), QV4::NodePrototype::method_get_previousSibling, 0); - o->defineAccessorProperty(QStringLiteral("nextSibling"), QV4::NodePrototype::method_get_nextSibling, 0); - o->defineAccessorProperty(QStringLiteral("attributes"), QV4::NodePrototype::method_get_attributes, 0); + o->defineAccessorProperty(QStringLiteral("parentNode"), QV4::NodePrototype::method_get_parentNode, nullptr); + o->defineAccessorProperty(QStringLiteral("childNodes"), QV4::NodePrototype::method_get_childNodes, nullptr); + o->defineAccessorProperty(QStringLiteral("firstChild"), QV4::NodePrototype::method_get_firstChild, nullptr); + o->defineAccessorProperty(QStringLiteral("lastChild"), QV4::NodePrototype::method_get_lastChild, nullptr); + o->defineAccessorProperty(QStringLiteral("previousSibling"), QV4::NodePrototype::method_get_previousSibling, nullptr); + o->defineAccessorProperty(QStringLiteral("nextSibling"), QV4::NodePrototype::method_get_nextSibling, nullptr); + o->defineAccessorProperty(QStringLiteral("attributes"), QV4::NodePrototype::method_get_attributes, nullptr); } @@ -644,7 +644,7 @@ ReturnedValue Element::prototype(ExecutionEngine *engine) ScopedObject p(scope, engine->newObject()); ScopedObject pp(scope); p->setPrototype((pp = NodePrototype::getProto(engine))); - p->defineAccessorProperty(QStringLiteral("tagName"), NodePrototype::method_get_nodeName, 0); + p->defineAccessorProperty(QStringLiteral("tagName"), NodePrototype::method_get_nodeName, nullptr); d->elementPrototype.set(engine, p); engine->v8Engine->freezeObject(p); } @@ -659,9 +659,9 @@ ReturnedValue Attr::prototype(ExecutionEngine *engine) ScopedObject p(scope, engine->newObject()); ScopedObject pp(scope); p->setPrototype((pp = NodePrototype::getProto(engine))); - p->defineAccessorProperty(QStringLiteral("name"), method_name, 0); - p->defineAccessorProperty(QStringLiteral("value"), method_value, 0); - p->defineAccessorProperty(QStringLiteral("ownerElement"), method_ownerElement, 0); + p->defineAccessorProperty(QStringLiteral("name"), method_name, nullptr); + p->defineAccessorProperty(QStringLiteral("value"), method_value, nullptr); + p->defineAccessorProperty(QStringLiteral("ownerElement"), method_ownerElement, nullptr); d->attrPrototype.set(engine, p); engine->v8Engine->freezeObject(p); } @@ -716,8 +716,8 @@ ReturnedValue CharacterData::prototype(ExecutionEngine *v4) ScopedObject p(scope, v4->newObject()); ScopedObject pp(scope); p->setPrototype((pp = NodePrototype::getProto(v4))); - p->defineAccessorProperty(QStringLiteral("data"), NodePrototype::method_get_nodeValue, 0); - p->defineAccessorProperty(QStringLiteral("length"), method_length, 0); + p->defineAccessorProperty(QStringLiteral("data"), NodePrototype::method_get_nodeValue, nullptr); + p->defineAccessorProperty(QStringLiteral("length"), method_length, nullptr); d->characterDataPrototype.set(v4, p); v4->v8Engine->freezeObject(p); } @@ -752,8 +752,8 @@ ReturnedValue Text::prototype(ExecutionEngine *v4) ScopedObject p(scope, v4->newObject()); ScopedObject pp(scope); p->setPrototype((pp = CharacterData::prototype(v4))); - p->defineAccessorProperty(QStringLiteral("isElementContentWhitespace"), method_isElementContentWhitespace, 0); - p->defineAccessorProperty(QStringLiteral("wholeText"), method_wholeText, 0); + p->defineAccessorProperty(QStringLiteral("isElementContentWhitespace"), method_isElementContentWhitespace, nullptr); + p->defineAccessorProperty(QStringLiteral("wholeText"), method_wholeText, nullptr); d->textPrototype.set(v4, p); v4->v8Engine->freezeObject(p); } @@ -783,10 +783,10 @@ ReturnedValue Document::prototype(ExecutionEngine *v4) ScopedObject p(scope, v4->newObject()); ScopedObject pp(scope); p->setPrototype((pp = NodePrototype::getProto(v4))); - p->defineAccessorProperty(QStringLiteral("xmlVersion"), method_xmlVersion, 0); - p->defineAccessorProperty(QStringLiteral("xmlEncoding"), method_xmlEncoding, 0); - p->defineAccessorProperty(QStringLiteral("xmlStandalone"), method_xmlStandalone, 0); - p->defineAccessorProperty(QStringLiteral("documentElement"), method_documentElement, 0); + p->defineAccessorProperty(QStringLiteral("xmlVersion"), method_xmlVersion, nullptr); + p->defineAccessorProperty(QStringLiteral("xmlEncoding"), method_xmlEncoding, nullptr); + p->defineAccessorProperty(QStringLiteral("xmlStandalone"), method_xmlStandalone, nullptr); + p->defineAccessorProperty(QStringLiteral("documentElement"), method_documentElement, nullptr); d->documentPrototype.set(v4, p); v4->v8Engine->freezeObject(p); } @@ -797,7 +797,7 @@ ReturnedValue Document::load(ExecutionEngine *v4, const QByteArray &data) { Scope scope(v4); - DocumentImpl *document = 0; + DocumentImpl *document = nullptr; QStack<NodeImpl *> nodeStack; QXmlStreamReader reader(data); @@ -885,7 +885,7 @@ ReturnedValue Document::load(ExecutionEngine *v4, const QByteArray &data) bool Node::isNull() const { - return d()->d == 0; + return d()->d == nullptr; } ReturnedValue NamedNodeMap::getIndexed(const Managed *m, uint index, bool *hasProperty) @@ -1098,7 +1098,7 @@ private: QQmlXMLHttpRequest::QQmlXMLHttpRequest(QNetworkAccessManager *manager) : m_state(Unsent), m_errorFlag(false), m_sendFlag(false) - , m_redirectCount(0), m_gotXml(false), m_textCodec(0), m_network(0), m_nam(manager) + , m_redirectCount(0), m_gotXml(false), m_textCodec(nullptr), m_network(nullptr), m_nam(manager) , m_responseType() , m_parsedDocument() { @@ -1443,7 +1443,7 @@ void QQmlXMLHttpRequest::finished() dispatchCallback(); m_thisObject.clear(); - m_qmlContext.setContextData(0); + m_qmlContext.setContextData(nullptr); } @@ -1516,7 +1516,7 @@ QV4::ReturnedValue QQmlXMLHttpRequest::xmlResponseBody(QV4::ExecutionEngine* eng #if QT_CONFIG(textcodec) QTextCodec* QQmlXMLHttpRequest::findTextCodec() const { - QTextCodec *codec = 0; + QTextCodec *codec = nullptr; if (!m_charset.isEmpty()) codec = QTextCodec::codecForName(m_charset); @@ -1528,10 +1528,10 @@ QTextCodec* QQmlXMLHttpRequest::findTextCodec() const } if (!codec && m_mime == "text/html") - codec = QTextCodec::codecForHtml(m_responseEntityBody, 0); + codec = QTextCodec::codecForHtml(m_responseEntityBody, nullptr); if (!codec) - codec = QTextCodec::codecForUtfText(m_responseEntityBody, 0); + codec = QTextCodec::codecForUtfText(m_responseEntityBody, nullptr); if (!codec) codec = QTextCodec::codecForName("UTF-8"); @@ -1595,7 +1595,7 @@ void QQmlXMLHttpRequest::destroyNetwork() if (m_network) { m_network->disconnect(); m_network->deleteLater(); - m_network = 0; + m_network = nullptr; } } @@ -1709,12 +1709,12 @@ void QQmlXMLHttpRequestCtor::setupProto() p->defineDefaultProperty(QStringLiteral("getAllResponseHeaders"), method_getAllResponseHeaders); // Read-only properties - p->defineAccessorProperty(QStringLiteral("readyState"), method_get_readyState, 0); - p->defineAccessorProperty(QStringLiteral("status"),method_get_status, 0); - p->defineAccessorProperty(QStringLiteral("statusText"),method_get_statusText, 0); - p->defineAccessorProperty(QStringLiteral("responseText"),method_get_responseText, 0); - p->defineAccessorProperty(QStringLiteral("responseXML"),method_get_responseXML, 0); - p->defineAccessorProperty(QStringLiteral("response"),method_get_response, 0); + p->defineAccessorProperty(QStringLiteral("readyState"), method_get_readyState, nullptr); + p->defineAccessorProperty(QStringLiteral("status"),method_get_status, nullptr); + p->defineAccessorProperty(QStringLiteral("statusText"),method_get_statusText, nullptr); + p->defineAccessorProperty(QStringLiteral("responseText"),method_get_responseText, nullptr); + p->defineAccessorProperty(QStringLiteral("responseXML"),method_get_responseXML, nullptr); + p->defineAccessorProperty(QStringLiteral("response"),method_get_response, nullptr); // Read-write properties p->defineAccessorProperty(QStringLiteral("responseType"), method_get_responseType, method_set_responseType); diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index 98cf443252..0e1d9e6fad 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -155,10 +155,10 @@ void Heap::QtObject::init(QQmlEngine *qmlEngine) o->defineDefaultProperty(QStringLiteral("createComponent"), QV4::QtObject::method_createComponent); } - o->defineAccessorProperty(QStringLiteral("platform"), QV4::QtObject::method_get_platform, 0); - o->defineAccessorProperty(QStringLiteral("application"), QV4::QtObject::method_get_application, 0); - o->defineAccessorProperty(QStringLiteral("inputMethod"), QV4::QtObject::method_get_inputMethod, 0); - o->defineAccessorProperty(QStringLiteral("styleHints"), QV4::QtObject::method_get_styleHints, 0); + o->defineAccessorProperty(QStringLiteral("platform"), QV4::QtObject::method_get_platform, nullptr); + o->defineAccessorProperty(QStringLiteral("application"), QV4::QtObject::method_get_application, nullptr); + o->defineAccessorProperty(QStringLiteral("inputMethod"), QV4::QtObject::method_get_inputMethod, nullptr); + o->defineAccessorProperty(QStringLiteral("styleHints"), QV4::QtObject::method_get_styleHints, nullptr); o->defineDefaultProperty(QStringLiteral("callLater"), QV4::QtObject::method_callLater); } @@ -237,7 +237,7 @@ ReturnedValue QtObject::method_isQtObject(const FunctionObject *, const Value *, if (argc == 0) RETURN_RESULT(QV4::Encode(false)); - return QV4::Encode(argv[0].as<QV4::QObjectWrapper>() != 0); + return QV4::Encode(argv[0].as<QV4::QObjectWrapper>() != nullptr); } /*! @@ -952,7 +952,7 @@ ReturnedValue QtObject::method_resolvedUrl(const FunctionObject *b, const Value QUrl url = scope.engine->toVariant(argv[0], -1).toUrl(); QQmlEngine *e = scope.engine->qmlEngine(); - QQmlEnginePrivate *p = 0; + QQmlEnginePrivate *p = nullptr; if (e) p = QQmlEnginePrivate::get(e); if (p) { QQmlContextData *ctxt = scope.engine->callingQmlContext(); @@ -1124,7 +1124,7 @@ ReturnedValue QtObject::method_createQmlObject(const FunctionObject *b, const Va QQmlContextData *context = scope.engine->callingQmlContext(); Q_ASSERT(context); - QQmlContext *effectiveContext = 0; + QQmlContext *effectiveContext = nullptr; if (context->isPragmaLibraryContext) effectiveContext = engine->rootContext(); else @@ -1144,7 +1144,7 @@ ReturnedValue QtObject::method_createQmlObject(const FunctionObject *b, const Va if (url.isValid() && url.isRelative()) url = context->resolvedUrl(url); - QObject *parentArg = 0; + QObject *parentArg = nullptr; QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, argv[1]); if (!!qobjectWrapper) parentArg = qobjectWrapper->object(); @@ -1253,14 +1253,14 @@ ReturnedValue QtObject::method_createComponent(const FunctionObject *b, const Va Q_ASSERT(context); QQmlContextData *effectiveContext = context; if (context->isPragmaLibraryContext) - effectiveContext = 0; + effectiveContext = nullptr; QString arg = argv[0].toQStringNoThrow(); if (arg.isEmpty()) RETURN_RESULT(QV4::Encode::null()); QQmlComponent::CompilationMode compileMode = QQmlComponent::PreferSynchronous; - QObject *parentArg = 0; + QObject *parentArg = nullptr; int consumedCount = 1; if (argc > 1) { @@ -1287,7 +1287,7 @@ ReturnedValue QtObject::method_createComponent(const FunctionObject *b, const Va if (!parentArg) THROW_GENERIC_ERROR("Qt.createComponent(): Invalid parent object"); } else if (lastArg->isNull()) { - parentArg = 0; + parentArg = nullptr; } else { THROW_GENERIC_ERROR("Qt.createComponent(): Invalid parent object"); } @@ -1520,7 +1520,7 @@ static QString jsStack(QV4::ExecutionEngine *engine) { static ReturnedValue writeToConsole(const FunctionObject *b, const Value *, const Value *argv, int argc, ConsoleLogTypes logType, bool printStack = false) { - QLoggingCategory *loggingCategory = 0; + QLoggingCategory *loggingCategory = nullptr; QString result; QV4::Scope scope(b); QV4::ExecutionEngine *v4 = scope.engine; diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index da3668d910..92a86aa9e5 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -131,10 +131,10 @@ static void restoreJSValue(QDataStream &stream, void *data) } QV8Engine::QV8Engine(QV4::ExecutionEngine *v4) - : m_engine(0) + : m_engine(nullptr) , m_v4Engine(v4) #if QT_CONFIG(qml_xml_http_request) - , m_xmlHttpRequestData(0) + , m_xmlHttpRequestData(nullptr) #endif { #ifdef Q_PROCESSOR_X86_32 @@ -167,7 +167,7 @@ QV8Engine::~QV8Engine() #if QT_CONFIG(qml_xml_http_request) qt_rem_qmlxmlhttprequest(m_v4Engine, m_xmlHttpRequestData); - m_xmlHttpRequestData = 0; + m_xmlHttpRequestData = nullptr; #endif } diff --git a/src/qml/qml/v8/qv8engine_p.h b/src/qml/qml/v8/qv8engine_p.h index 7a045b916a..d90f1827fe 100644 --- a/src/qml/qml/v8/qv8engine_p.h +++ b/src/qml/qml/v8/qv8engine_p.h @@ -231,7 +231,7 @@ inline QV8Engine::Deletable *QV8Engine::extensionData(int index) const if (index < m_extensionData.count()) return m_extensionData[index]; else - return 0; + return nullptr; } diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp index 91c5a50877..513f7f2997 100644 --- a/src/qml/types/qqmlbind.cpp +++ b/src/qml/types/qqmlbind.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE class QQmlBindPrivate : public QObjectPrivate { public: - QQmlBindPrivate() : obj(0), componentComplete(true), delayed(false), pendingEval(false) {} + QQmlBindPrivate() : obj(nullptr), componentComplete(true), delayed(false), pendingEval(false) {} ~QQmlBindPrivate() { } QQmlNullableValue<bool> when; @@ -370,7 +370,7 @@ void QQmlBind::eval() //restore any previous binding if (d->prevBind) { QQmlAbstractBinding::Ptr p = d->prevBind; - d->prevBind = 0; + d->prevBind = nullptr; QQmlPropertyPrivate::setBinding(p.data()); } return; diff --git a/src/qml/types/qqmlbind_p.h b/src/qml/types/qqmlbind_p.h index c9dd14b58a..5bf9ef85c6 100644 --- a/src/qml/types/qqmlbind_p.h +++ b/src/qml/types/qqmlbind_p.h @@ -71,7 +71,7 @@ class Q_AUTOTEST_EXPORT QQmlBind : public QObject, public QQmlPropertyValueSourc Q_PROPERTY(bool delayed READ delayed WRITE setDelayed REVISION 8) public: - QQmlBind(QObject *parent=0); + QQmlBind(QObject *parent=nullptr); ~QQmlBind(); bool when() const; diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp index e218cdcfe4..a43562a7b8 100644 --- a/src/qml/types/qqmlconnections.cpp +++ b/src/qml/types/qqmlconnections.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE class QQmlConnectionsPrivate : public QObjectPrivate { public: - QQmlConnectionsPrivate() : target(0), enabled(true), targetSet(false), ignoreUnknownSignals(false), componentcomplete(true) {} + QQmlConnectionsPrivate() : target(nullptr), enabled(true), targetSet(false), ignoreUnknownSignals(false), componentcomplete(true) {} QList<QQmlBoundSignal*> boundsignals; QObject *target; @@ -274,7 +274,7 @@ void QQmlConnections::connectSignals() return; QObject *target = this->target(); QQmlData *ddata = QQmlData::get(this); - QQmlContextData *ctxtdata = ddata ? ddata->outerContext : 0; + QQmlContextData *ctxtdata = ddata ? ddata->outerContext : nullptr; const QV4::CompiledData::Unit *qmlUnit = d->compilationUnit->data; for (const QV4::CompiledData::Binding *binding : qAsConst(d->bindings)) { @@ -290,7 +290,7 @@ void QQmlConnections::connectSignals() QQmlBoundSignalExpression *expression = ctxtdata ? new QQmlBoundSignalExpression(target, signalIndex, - ctxtdata, this, d->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]) : 0; + ctxtdata, this, d->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]) : nullptr; signal->takeExpression(expression); d->boundsignals += signal; } else { diff --git a/src/qml/types/qqmlconnections_p.h b/src/qml/types/qqmlconnections_p.h index 580b6522de..50e2c59ac3 100644 --- a/src/qml/types/qqmlconnections_p.h +++ b/src/qml/types/qqmlconnections_p.h @@ -73,7 +73,7 @@ class Q_AUTOTEST_EXPORT QQmlConnections : public QObject, public QQmlParserStatu Q_PROPERTY(bool ignoreUnknownSignals READ ignoreUnknownSignals WRITE setIgnoreUnknownSignals) public: - QQmlConnections(QObject *parent=0); + QQmlConnections(QObject *parent=nullptr); ~QQmlConnections(); QObject *target() const; diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index 98b34a980d..29e0baa3ac 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -200,10 +200,10 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) */ QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt) - : m_delegate(0) - , m_cacheMetaType(0) + : m_delegate(nullptr) + , m_cacheMetaType(nullptr) , m_context(ctxt) - , m_parts(0) + , m_parts(nullptr) , m_filterGroup(QStringLiteral("items")) , m_count(0) , m_groupCount(Compositor::MinimumGroupCount) @@ -214,9 +214,9 @@ QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt) , m_transaction(false) , m_incubatorCleanupScheduled(false) , m_waitingToFetchMore(false) - , m_cacheItems(0) - , m_items(0) - , m_persistedItems(0) + , m_cacheItems(nullptr) + , m_items(nullptr) + , m_persistedItems(nullptr) { } @@ -268,10 +268,10 @@ QQmlDelegateModel::~QQmlDelegateModel() if (cacheItem->object) { delete cacheItem->object; - cacheItem->object = 0; + cacheItem->object = nullptr; cacheItem->contextData->invalidate(); Q_ASSERT(cacheItem->contextData->refCount == 1); - cacheItem->contextData = 0; + cacheItem->contextData = nullptr; cacheItem->scriptRef -= 1; } cacheItem->groups &= ~Compositor::UnresolvedFlag; @@ -279,7 +279,7 @@ QQmlDelegateModel::~QQmlDelegateModel() if (!cacheItem->isReferenced()) delete cacheItem; else if (cacheItem->incubationTask) - cacheItem->incubationTask->vdm = 0; + cacheItem->incubationTask->vdm = nullptr; } } @@ -408,7 +408,7 @@ void QQmlDelegateModel::setDelegate(QQmlComponent *delegate) qmlWarning(this) << tr("The delegate of a DelegateModel cannot be changed within onUpdated."); return; } - bool wasValid = d->m_delegate != 0; + bool wasValid = d->m_delegate != nullptr; d->m_delegate = delegate; d->m_delegateValidated = false; if (wasValid && d->m_complete) { @@ -655,7 +655,7 @@ int QQmlDelegateModel::count() const QQmlDelegateModel::ReleaseFlags QQmlDelegateModelPrivate::release(QObject *object) { - QQmlDelegateModel::ReleaseFlags stat = 0; + QQmlDelegateModel::ReleaseFlags stat = nullptr; if (!object) return stat; @@ -665,7 +665,7 @@ QQmlDelegateModel::ReleaseFlags QQmlDelegateModelPrivate::release(QObject *objec emitDestroyingItem(object); if (cacheItem->incubationTask) { releaseIncubator(cacheItem->incubationTask); - cacheItem->incubationTask = 0; + cacheItem->incubationTask = nullptr; } cacheItem->Dispose(); stat |= QQmlInstanceModel::Destroyed; @@ -701,7 +701,7 @@ void QQmlDelegateModel::cancel(int index) if (cacheItem) { if (cacheItem->incubationTask && !cacheItem->isObjectReferenced()) { d->releaseIncubator(cacheItem->incubationTask); - cacheItem->incubationTask = 0; + cacheItem->incubationTask = nullptr; if (cacheItem->object) { QObject *object = cacheItem->object; @@ -750,7 +750,7 @@ QQmlDelegateModelGroup *QQmlDelegateModelPrivate::group_at( QQmlDelegateModelPrivate *d = static_cast<QQmlDelegateModelPrivate *>(property->data); return index >= 0 && index < d->m_groupCount - 1 ? d->m_groups[index + 1] - : 0; + : nullptr; } /*! @@ -780,7 +780,7 @@ QQmlListProperty<QQmlDelegateModelGroup> QQmlDelegateModel::groups() QQmlDelegateModelPrivate::group_append, QQmlDelegateModelPrivate::group_count, QQmlDelegateModelPrivate::group_at, - 0); + nullptr); } /*! @@ -958,11 +958,11 @@ void QQDMIncubationTask::statusChanged(Status status) Q_ASSERT(incubating); // The model was deleted from under our feet, cleanup ourselves delete incubating->object; - incubating->object = 0; + incubating->object = nullptr; if (incubating->contextData) { incubating->contextData->invalidate(); Q_ASSERT(incubating->contextData->refCount == 1); - incubating->contextData = 0; + incubating->contextData = nullptr; } incubating->scriptRef = 0; incubating->deleteLater(); @@ -998,8 +998,8 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba return; QQmlDelegateModelItem *cacheItem = incubationTask->incubating; - cacheItem->incubationTask = 0; - incubationTask->incubating = 0; + cacheItem->incubationTask = nullptr; + incubationTask->incubating = nullptr; releaseIncubator(incubationTask); if (status == QQmlIncubator::Ready) { @@ -1019,13 +1019,13 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba else emitDestroyingItem(cacheItem->object); delete cacheItem->object; - cacheItem->object = 0; + cacheItem->object = nullptr; cacheItem->scriptRef -= 1; if (cacheItem->contextData) { cacheItem->contextData->invalidate(); Q_ASSERT(cacheItem->contextData->refCount == 1); } - cacheItem->contextData = 0; + cacheItem->contextData = nullptr; if (!cacheItem->isReferenced()) { removeCacheItem(cacheItem); @@ -1054,9 +1054,9 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ { if (!m_delegate || index < 0 || index >= m_compositor.count(group)) { qWarning() << "DelegateModel::item: index out range" << index << m_compositor.count(group); - return 0; + return nullptr; } else if (!m_context || !m_context->isValid()) { - return 0; + return nullptr; } Compositor::iterator it = m_compositor.find(group, index); @@ -1066,7 +1066,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ if (!cacheItem) { cacheItem = m_adaptorModel.createItem(m_cacheMetaType, it.modelIndex()); if (!cacheItem) - return 0; + return nullptr; cacheItem->groups = it->flags; @@ -1135,7 +1135,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ delete cacheItem; } - return 0; + return nullptr; } /* @@ -1151,7 +1151,7 @@ QObject *QQmlDelegateModel::object(int index, QQmlIncubator::IncubationMode incu Q_D(QQmlDelegateModel); if (!d->m_delegate || index < 0 || index >= d->m_compositor.count(d->m_compositorGroup)) { qWarning() << "DelegateModel::item: index out range" << index << d->m_compositor.count(d->m_compositorGroup); - return 0; + return nullptr; } return d->object(d->m_compositorGroup, index, incubationMode); @@ -1469,7 +1469,7 @@ void QQmlDelegateModelPrivate::itemsRemoved( if (QQDMIncubationTask *incubationTask = cacheItem->incubationTask) { if (!cacheItem->isObjectReferenced()) { releaseIncubator(cacheItem->incubationTask); - cacheItem->incubationTask = 0; + cacheItem->incubationTask = nullptr; if (cacheItem->object) { QObject *object = cacheItem->object; cacheItem->destroyObject(); @@ -1790,7 +1790,7 @@ bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const // Must be before the new object is inserted into the cache or its indexes will be adjusted too. itemsInserted(QVector<Compositor::Insert>(1, Compositor::Insert(before, 1, cacheItem->groups & ~Compositor::CacheFlag))); - before = m_compositor.insert(before, 0, 0, 1, cacheItem->groups); + before = m_compositor.insert(before, nullptr, 0, 1, cacheItem->groups); m_cache.insert(before.cacheIndex, cacheItem); return true; @@ -1803,7 +1803,7 @@ QQmlDelegateModelItemMetaType::QQmlDelegateModelItemMetaType( : model(model) , groupCount(groupNames.count() + 1) , v4Engine(engine) - , metaObject(0) + , metaObject(nullptr) , groupNames(groupNames) { } @@ -1846,7 +1846,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() QV4::Scope scope(v4Engine); QV4::ScopedObject proto(scope, v4Engine->newObject()); - proto->defineAccessorProperty(QStringLiteral("model"), QQmlDelegateModelItem::get_model, 0); + proto->defineAccessorProperty(QStringLiteral("model"), QQmlDelegateModelItem::get_model, nullptr); proto->defineAccessorProperty(QStringLiteral("groups"), QQmlDelegateModelItem::get_groups, QQmlDelegateModelItem::set_groups); QV4::ScopedString s(scope); QV4::ScopedProperty p(scope); @@ -1855,7 +1855,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() QV4::ScopedFunctionObject f(scope); QV4::ExecutionContext *global = scope.engine->rootContext(); p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, 30, QQmlDelegateModelItem::get_member))); - p->setSetter(0); + p->setSetter(nullptr); proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); s = v4Engine->newString(QStringLiteral("inItems")); @@ -1874,7 +1874,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() s = v4Engine->newString(QStringLiteral("persistedItemsIndex")); p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_index))); - p->setSetter(0); + p->setSetter(nullptr); proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); for (int i = 2; i < groupNames.count(); ++i) { @@ -1889,7 +1889,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() const QString propertyName = groupNames.at(i) + QLatin1String("Index"); s = v4Engine->newString(propertyName); p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, i + 1, QQmlDelegateModelItem::get_index))); - p->setSetter(0); + p->setSetter(nullptr); proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); } modelItemProto.set(v4Engine, proto); @@ -2031,10 +2031,10 @@ QQmlDelegateModelItem::QQmlDelegateModelItem( QQmlDelegateModelItemMetaType *metaType, int modelIndex) : v4(metaType->v4Engine) , metaType(metaType) - , contextData(0) - , object(0) - , attached(0) - , incubationTask(0) + , contextData(nullptr) + , object(nullptr) + , attached(nullptr) + , incubationTask(nullptr) , objectRef(0) , scriptRef(0) , groups(0) @@ -2084,39 +2084,39 @@ void QQmlDelegateModelItem::destroyObject() data->ownContext->clearContext(); if (data->ownContext->contextObject == object) data->ownContext->contextObject = nullptr; - data->ownContext = 0; - data->context = 0; + data->ownContext = nullptr; + data->context = nullptr; } object->deleteLater(); if (attached) { - attached->m_cacheItem = 0; - attached = 0; + attached->m_cacheItem = nullptr; + attached = nullptr; } contextData->invalidate(); - contextData = 0; - object = 0; + contextData = nullptr; + object = nullptr; } QQmlDelegateModelItem *QQmlDelegateModelItem::dataForObject(QObject *object) { QQmlData *d = QQmlData::get(object); - QQmlContextData *context = d ? d->context : 0; - for (context = context ? context->parent : 0; context; context = context->parent) { + QQmlContextData *context = d ? d->context : nullptr; + for (context = context ? context->parent : nullptr; context; context = context->parent) { if (QQmlDelegateModelItem *cacheItem = qobject_cast<QQmlDelegateModelItem *>( context->contextObject)) { return cacheItem; } } - return 0; + return nullptr; } int QQmlDelegateModelItem::groupIndex(Compositor::Group group) { if (QQmlDelegateModelPrivate * const model = metaType->model ? QQmlDelegateModelPrivate::get(metaType->model) - : 0) { + : nullptr) { return model->m_compositor.find(Compositor::Cache, model->m_cache.indexOf(this)).index[group]; } return -1; @@ -2189,7 +2189,7 @@ int QQmlDelegateModelAttachedMetaObject::metaCall(QObject *object, QMetaObject:: } QQmlDelegateModelAttached::QQmlDelegateModelAttached(QObject *parent) - : m_cacheItem(0) + : m_cacheItem(nullptr) , m_previousGroups(0) { QQml_setParent_noEvent(this, parent); @@ -2229,7 +2229,7 @@ QQmlDelegateModelAttached::QQmlDelegateModelAttached( QQmlDelegateModel *QQmlDelegateModelAttached::model() const { - return m_cacheItem ? m_cacheItem->metaType->model : 0; + return m_cacheItem ? m_cacheItem->metaType->model : nullptr; } /*! @@ -2341,11 +2341,11 @@ void QQmlDelegateModelAttached::emitChanges() const QMetaObject *meta = metaObject(); for (int i = 1; i < m_cacheItem->metaType->groupCount; ++i, ++notifierId) { if (groupChanges & (1 << i)) - QMetaObject::activate(this, meta, notifierId, 0); + QMetaObject::activate(this, meta, notifierId, nullptr); } for (int i = 1; i < m_cacheItem->metaType->groupCount; ++i, ++notifierId) { if (indexChanges & (1 << i)) - QMetaObject::activate(this, meta, notifierId, 0); + QMetaObject::activate(this, meta, notifierId, nullptr); } if (groupChanges) @@ -2630,7 +2630,7 @@ bool QQmlDelegateModelGroupPrivate::parseIndex(const QV4::Value &value, int *ind QQmlDelegateModelItem * const cacheItem = object->d()->item; if (QQmlDelegateModelPrivate *model = cacheItem->metaType->model ? QQmlDelegateModelPrivate::get(cacheItem->metaType->model) - : 0) { + : nullptr) { *index = model->m_cache.indexOf(cacheItem); *group = Compositor::Cache; return true; @@ -3255,7 +3255,7 @@ QObject *QQmlPartsModel::object(int index, QQmlIncubator::IncubationMode incubat if (!model->m_delegate || index < 0 || index >= model->m_compositor.count(m_compositorGroup)) { qWarning() << "DelegateModel::item: index out range" << index << model->m_compositor.count(m_compositorGroup); - return 0; + return nullptr; } QObject *object = model->object(m_compositorGroup, index, incubationMode); @@ -3263,7 +3263,7 @@ QObject *QQmlPartsModel::object(int index, QQmlIncubator::IncubationMode incubat if (QQuickPackage *package = qmlobject_cast<QQuickPackage *>(object)) { QObject *part = package->part(m_part); if (!part) - return 0; + return nullptr; m_packaged.insertMulti(part, package); return part; } @@ -3275,12 +3275,12 @@ QObject *QQmlPartsModel::object(int index, QQmlIncubator::IncubationMode incubat model->m_delegateValidated = true; } - return 0; + return nullptr; } QQmlInstanceModel::ReleaseFlags QQmlPartsModel::release(QObject *item) { - QQmlInstanceModel::ReleaseFlags flags = 0; + QQmlInstanceModel::ReleaseFlags flags = nullptr; QHash<QObject *, QQuickPackage *>::iterator it = m_packaged.find(item); if (it != m_packaged.end()) { @@ -3461,9 +3461,9 @@ QQmlDelegateModelEngineData::QQmlDelegateModelEngineData(QV4::ExecutionEngine *v QV4::Scope scope(v4); QV4::ScopedObject proto(scope, v4->newObject()); - proto->defineAccessorProperty(QStringLiteral("index"), QQmlDelegateModelGroupChange::method_get_index, 0); - proto->defineAccessorProperty(QStringLiteral("count"), QQmlDelegateModelGroupChange::method_get_count, 0); - proto->defineAccessorProperty(QStringLiteral("moveId"), QQmlDelegateModelGroupChange::method_get_moveId, 0); + proto->defineAccessorProperty(QStringLiteral("index"), QQmlDelegateModelGroupChange::method_get_index, nullptr); + proto->defineAccessorProperty(QStringLiteral("count"), QQmlDelegateModelGroupChange::method_get_count, nullptr); + proto->defineAccessorProperty(QStringLiteral("moveId"), QQmlDelegateModelGroupChange::method_get_moveId, nullptr); changeProto.set(v4, proto); } diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h index 244108d082..439d5c9d37 100644 --- a/src/qml/types/qqmldelegatemodel_p.h +++ b/src/qml/types/qqmldelegatemodel_p.h @@ -92,7 +92,7 @@ class Q_QML_PRIVATE_EXPORT QQmlDelegateModel : public QQmlInstanceModel, public Q_INTERFACES(QQmlParserStatus) public: QQmlDelegateModel(); - QQmlDelegateModel(QQmlContext *, QObject *parent=0); + QQmlDelegateModel(QQmlContext *, QObject *parent=nullptr); ~QQmlDelegateModel(); void classBegin() override; @@ -119,7 +119,7 @@ public: Q_INVOKABLE QVariant parentModelIndex() const; int count() const override; - bool isValid() const override { return delegate() != 0; } + bool isValid() const override { return delegate() != nullptr; } QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) override; ReleaseFlags release(QObject *object) override; void cancel(int index) override; @@ -176,8 +176,8 @@ class Q_QML_PRIVATE_EXPORT QQmlDelegateModelGroup : public QObject Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(bool includeByDefault READ defaultInclude WRITE setDefaultInclude NOTIFY defaultIncludeChanged) public: - QQmlDelegateModelGroup(QObject *parent = 0); - QQmlDelegateModelGroup(const QString &name, QQmlDelegateModel *model, int compositorType, QObject *parent = 0); + QQmlDelegateModelGroup(QObject *parent = nullptr); + QQmlDelegateModelGroup(const QString &name, QQmlDelegateModel *model, int compositorType, QObject *parent = nullptr); ~QQmlDelegateModelGroup(); QString name() const; diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index b44979986f..9f1c9d31a4 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -182,7 +182,7 @@ class QQDMIncubationTask : public QQmlIncubator public: QQDMIncubationTask(QQmlDelegateModelPrivate *l, IncubationMode mode) : QQmlIncubator(mode) - , incubating(0) + , incubating(nullptr) , vdm(l) {} void statusChanged(Status) override; @@ -278,12 +278,12 @@ public: void itemsInserted( const QVector<Compositor::Insert> &inserts, QVarLengthArray<QVector<QQmlChangeSet::Change>, Compositor::MaximumGroupCount> *translatedInserts, - QHash<int, QList<QQmlDelegateModelItem *> > *movedItems = 0); + QHash<int, QList<QQmlDelegateModelItem *> > *movedItems = nullptr); void itemsInserted(const QVector<Compositor::Insert> &inserts); void itemsRemoved( const QVector<Compositor::Remove> &removes, QVarLengthArray<QVector<QQmlChangeSet::Change>, Compositor::MaximumGroupCount> *translatedRemoves, - QHash<int, QList<QQmlDelegateModelItem *> > *movedItems = 0); + QHash<int, QList<QQmlDelegateModelItem *> > *movedItems = nullptr); void itemsRemoved(const QVector<Compositor::Remove> &removes); void itemsMoved( const QVector<Compositor::Remove> &removes, const QVector<Compositor::Insert> &inserts); @@ -344,7 +344,7 @@ class QQmlPartsModel : public QQmlInstanceModel, public QQmlDelegateModelGroupEm Q_OBJECT Q_PROPERTY(QString filterOnGroup READ filterGroup WRITE setFilterGroup NOTIFY filterGroupChanged RESET resetFilterGroup) public: - QQmlPartsModel(QQmlDelegateModel *model, const QString &part, QObject *parent = 0); + QQmlPartsModel(QQmlDelegateModel *model, const QString &part, QObject *parent = nullptr); ~QQmlPartsModel(); QString filterGroup() const; diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp index 6e2b66aea7..213bef7879 100644 --- a/src/qml/types/qqmlinstantiator.cpp +++ b/src/qml/types/qqmlinstantiator.cpp @@ -56,8 +56,8 @@ QQmlInstantiatorPrivate::QQmlInstantiatorPrivate() , ownModel(false) , requestedIndex(-1) , model(QVariant(1)) - , instanceModel(0) - , delegate(0) + , instanceModel(nullptr) + , delegate(nullptr) { } @@ -183,7 +183,7 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo objects = objects.mid(0, index) + movedObjects + objects.mid(index); } else { if (insert.index <= objects.size()) - objects.insert(insert.index, insert.count, 0); + objects.insert(insert.index, insert.count, nullptr); for (int i = 0; i < insert.count; ++i) { int modelIndex = index + i; QObject* obj = modelObject(modelIndex, async); @@ -396,11 +396,11 @@ void QQmlInstantiator::setModel(const QVariant &v) QQmlInstanceModel *prevModel = d->instanceModel; QObject *object = qvariant_cast<QObject*>(v); - QQmlInstanceModel *vim = 0; + QQmlInstanceModel *vim = nullptr; if (object && (vim = qobject_cast<QQmlInstanceModel *>(object))) { if (d->ownModel) { delete d->instanceModel; - prevModel = 0; + prevModel = nullptr; d->ownModel = false; } d->instanceModel = vim; @@ -444,7 +444,7 @@ QObject *QQmlInstantiator::object() const Q_D(const QQmlInstantiator); if (d->objects.count()) return d->objects[0]; - return 0; + return nullptr; } /*! @@ -457,7 +457,7 @@ QObject *QQmlInstantiator::objectAt(int index) const Q_D(const QQmlInstantiator); if (index >= 0 && index < d->objects.count()) return d->objects[index]; - return 0; + return nullptr; } /*! diff --git a/src/qml/types/qqmlinstantiator_p.h b/src/qml/types/qqmlinstantiator_p.h index ee18daa48c..5727c4d1e1 100644 --- a/src/qml/types/qqmlinstantiator_p.h +++ b/src/qml/types/qqmlinstantiator_p.h @@ -71,7 +71,7 @@ class Q_AUTOTEST_EXPORT QQmlInstantiator : public QObject, public QQmlParserStat Q_CLASSINFO("DefaultProperty", "delegate") public: - QQmlInstantiator(QObject *parent = 0); + QQmlInstantiator(QObject *parent = nullptr); ~QQmlInstantiator(); bool isActive() const; diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 784368c504..d4fc02cd3e 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -100,7 +100,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(const QString &key, Role::Da if (node) { const Role &r = *node->value; if (type != r.type) - qmlWarning(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type)); + qmlWarning(nullptr) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type)); return r; } @@ -113,7 +113,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(QV4::String *key, Role::Data if (node) { const Role &r = *node->value; if (type != r.type) - qmlWarning(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type)); + qmlWarning(nullptr) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type)); return r; } @@ -134,7 +134,7 @@ const ListLayout::Role &ListLayout::createRole(const QString &key, ListLayout::R if (type == Role::List) { r->subLayout = new ListLayout; } else { - r->subLayout = 0; + r->subLayout = nullptr; } int dataSize = dataSizes[type]; @@ -203,7 +203,7 @@ ListLayout::Role::Role(const Role *other) if (other->subLayout) subLayout = new ListLayout(other->subLayout); else - subLayout = 0; + subLayout = nullptr; } ListLayout::Role::~Role() @@ -236,8 +236,8 @@ const ListLayout::Role *ListLayout::getRoleOrCreate(const QString &key, const QV } if (type == Role::Invalid) { - qmlWarning(0) << "Can't create role for unsupported data type"; - return 0; + qmlWarning(nullptr) << "Can't create role for unsupported data type"; + return nullptr; } return &getRoleOrCreate(key, type); @@ -245,7 +245,7 @@ const ListLayout::Role *ListLayout::getRoleOrCreate(const QString &key, const QV const ListLayout::Role *ListLayout::getExistingRole(const QString &key) const { - Role *r = 0; + Role *r = nullptr; QStringHash<Role *>::Node *node = roleHash.findNode(key); if (node) r = node->value; @@ -254,7 +254,7 @@ const ListLayout::Role *ListLayout::getExistingRole(const QString &key) const const ListLayout::Role *ListLayout::getExistingRole(QV4::String *key) const { - Role *r = 0; + Role *r = nullptr; QStringHash<Role *>::Node *node = roleHash.findNode(key); if (node) r = node->value; @@ -264,7 +264,7 @@ const ListLayout::Role *ListLayout::getExistingRole(QV4::String *key) const QObject *ListModel::getOrCreateModelObject(QQmlListModel *model, int elementIndex) { ListElement *e = elements[elementIndex]; - if (e->m_objectCache == 0) { + if (e->m_objectCache == nullptr) { void *memory = operator new(sizeof(QObject) + sizeof(QQmlData)); void *ddataMemory = ((char *)memory) + sizeof(QObject); e->m_objectCache = new (memory) QObject; @@ -404,10 +404,10 @@ void ListModel::destroy() for (const auto &destroyer : remove(0, elements.count())) destroyer(); - m_layout = 0; + m_layout = nullptr; if (m_modelCache && m_modelCache->m_primary == false) delete m_modelCache; - m_modelCache = 0; + m_modelCache = nullptr; } int ListModel::appendElement() @@ -508,7 +508,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QVector<int> *roles) roleIndex = e->setDoubleProperty(r, propertyValue->asDouble()); } else if (QV4::ArrayObject *a = propertyValue->as<QV4::ArrayObject>()) { const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::List); - ListModel *subModel = new ListModel(r.subLayout, 0); + ListModel *subModel = new ListModel(r.subLayout, nullptr); int arrayLength = a->getLength(); for (int j=0 ; j < arrayLength ; ++j) { @@ -589,7 +589,7 @@ void ListModel::set(int elementIndex, QV4::Object *object) } else if (QV4::ArrayObject *a = propertyValue->as<QV4::ArrayObject>()) { const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::List); if (r.type == ListLayout::Role::List) { - ListModel *subModel = new ListModel(r.subLayout, 0); + ListModel *subModel = new ListModel(r.subLayout, nullptr); int arrayLength = a->getLength(); for (int j=0 ; j < arrayLength ; ++j) { @@ -698,7 +698,7 @@ inline char *ListElement::getPropertyMemory(const ListLayout::Role &role) ListElement *e = this; int blockIndex = 0; while (blockIndex < role.blockIndex) { - if (e->next == 0) { + if (e->next == nullptr) { e->next = new ListElement; e->next->uid = uid; } @@ -713,7 +713,7 @@ inline char *ListElement::getPropertyMemory(const ListLayout::Role &role) ModelNodeMetaObject *ListElement::objectCache() { if (!m_objectCache) - return 0; + return nullptr; return ModelNodeMetaObject::get(m_objectCache); } @@ -721,7 +721,7 @@ QString *ListElement::getStringProperty(const ListLayout::Role &role) { char *mem = getPropertyMemory(role); QString *s = reinterpret_cast<QString *>(mem); - return s->data_ptr() ? s : 0; + return s->data_ptr() ? s : nullptr; } QObject *ListElement::getQObjectProperty(const ListLayout::Role &role) @@ -733,7 +733,7 @@ QObject *ListElement::getQObjectProperty(const ListLayout::Role &role) QVariantMap *ListElement::getVariantMapProperty(const ListLayout::Role &role) { - QVariantMap *map = 0; + QVariantMap *map = nullptr; char *mem = getPropertyMemory(role); if (isMemoryUsed<QVariantMap>(mem)) @@ -744,7 +744,7 @@ QVariantMap *ListElement::getVariantMapProperty(const ListLayout::Role &role) QDateTime *ListElement::getDateTimeProperty(const ListLayout::Role &role) { - QDateTime *dt = 0; + QDateTime *dt = nullptr; char *mem = getPropertyMemory(role); if (isMemoryUsed<QDateTime>(mem)) @@ -755,7 +755,7 @@ QDateTime *ListElement::getDateTimeProperty(const ListLayout::Role &role) QJSValue *ListElement::getFunctionProperty(const ListLayout::Role &role) { - QJSValue *f = 0; + QJSValue *f = nullptr; char *mem = getPropertyMemory(role); if (isMemoryUsed<QJSValue>(mem)) @@ -776,7 +776,7 @@ QPointer<QObject> *ListElement::getGuardProperty(const ListLayout::Role &role) } } - QPointer<QObject> *o = 0; + QPointer<QObject> *o = nullptr; if (existingGuard) o = reinterpret_cast<QPointer<QObject> *>(mem); @@ -807,7 +807,7 @@ QVariant ListElement::getProperty(const ListLayout::Role &role, const QQmlListMo case ListLayout::Role::String: { QString *value = reinterpret_cast<QString *>(mem); - if (value->data_ptr() != 0) + if (value->data_ptr() != nullptr) data = *value; } break; @@ -823,7 +823,7 @@ QVariant ListElement::getProperty(const ListLayout::Role &role, const QQmlListMo ListModel *model = *value; if (model) { - if (model->m_modelCache == 0) { + if (model->m_modelCache == nullptr) { model->m_modelCache = new QQmlListModel(owner, model, eng); QQmlEngine::setContextForObject(model->m_modelCache, QQmlEngine::contextForObject(owner)); } @@ -880,7 +880,7 @@ int ListElement::setStringProperty(const ListLayout::Role &role, const QString & char *mem = getPropertyMemory(role); QString *c = reinterpret_cast<QString *>(mem); bool changed; - if (c->data_ptr() == 0) { + if (c->data_ptr() == nullptr) { new (mem) QString(s); changed = true; } else { @@ -1114,16 +1114,16 @@ void ListElement::clearProperty(const ListLayout::Role &role) setBoolProperty(role, false); break; case ListLayout::Role::List: - setListProperty(role, 0); + setListProperty(role, nullptr); break; case ListLayout::Role::QObject: - setQObjectProperty(role, 0); + setQObjectProperty(role, nullptr); break; case ListLayout::Role::DateTime: setDateTimeProperty(role, QDateTime()); break; case ListLayout::Role::VariantMap: - setVariantMapProperty(role, (QVariantMap *)0); + setVariantMapProperty(role, (QVariantMap *)nullptr); break; case ListLayout::Role::Function: setFunctionProperty(role, QJSValue()); @@ -1135,17 +1135,17 @@ void ListElement::clearProperty(const ListLayout::Role &role) ListElement::ListElement() { - m_objectCache = 0; + m_objectCache = nullptr; uid = uidCounter.fetchAndAddOrdered(1); - next = 0; + next = nullptr; memset(data, 0, sizeof(data)); } ListElement::ListElement(int existingUid) { - m_objectCache = 0; + m_objectCache = nullptr; uid = existingUid; - next = 0; + next = nullptr; memset(data, 0, sizeof(data)); } @@ -1169,8 +1169,8 @@ QVector<int> ListElement::sync(ListElement *src, ListLayout *srcLayout, ListElem ListModel *targetSubModel = target->getListProperty(targetRole); if (srcSubModel) { - if (targetSubModel == 0) { - targetSubModel = new ListModel(targetRole.subLayout, 0); + if (targetSubModel == nullptr) { + targetSubModel = new ListModel(targetRole.subLayout, nullptr); target->setListPropertyFast(targetRole, targetSubModel); } if (ListModel::sync(srcSubModel, targetSubModel)) @@ -1190,7 +1190,7 @@ QVector<int> ListElement::sync(ListElement *src, ListLayout *srcLayout, ListElem case ListLayout::Role::DateTime: case ListLayout::Role::Function: { - QVariant v = src->getProperty(srcRole, 0, 0); + QVariant v = src->getProperty(srcRole, nullptr, nullptr); roleIndex = target->setVariantProperty(targetRole, v); } break; @@ -1271,7 +1271,7 @@ void ListElement::destroy(ListLayout *layout) } if (next) - next->destroy(0); + next->destroy(nullptr); uid = -1; } @@ -1329,7 +1329,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::Value &d QV4::Scope scope(a->engine()); QV4::ScopedObject o(scope); - ListModel *subModel = new ListModel(role.subLayout, 0); + ListModel *subModel = new ListModel(role.subLayout, nullptr); int arrayLength = a->getLength(); for (int j=0 ; j < arrayLength ; ++j) { o = a->getIndexed(j); @@ -1337,7 +1337,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::Value &d } roleIndex = setListProperty(role, subModel); } else { - qmlWarning(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List)); + qmlWarning(nullptr) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List)); } } else if (d.isBoolean()) { roleIndex = setBoolProperty(role, d.booleanValue()); @@ -1516,7 +1516,7 @@ void ModelObject::advanceIterator(Managed *m, ObjectIterator *it, Value *name, u { ModelObject *that = static_cast<ModelObject*>(m); ExecutionEngine *v4 = that->engine(); - name->setM(0); + name->setM(nullptr); *index = UINT_MAX; if (it->arrayIndex < uint(that->d()->m_model->m_listModel->roleCount())) { Scope scope(that->engine()); @@ -1564,7 +1564,7 @@ QVector<int> DynamicRoleModelNode::sync(DynamicRoleModelNode *src, DynamicRoleMo bool modelHasChanges = false; if (srcModel) { - if (targetModel == 0) + if (targetModel == nullptr) targetModel = QQmlListModel::createWithOwner(target->m_owner); modelHasChanges = QQmlListModel::sync(srcModel, targetModel); @@ -1787,13 +1787,13 @@ QQmlListModel::QQmlListModel(QObject *parent) { m_mainThread = true; m_primary = true; - m_agent = 0; + m_agent = nullptr; m_dynamicRoles = false; m_layout = new ListLayout; m_listModel = new ListModel(m_layout, this); - m_engine = 0; + m_engine = nullptr; } QQmlListModel::QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::ExecutionEngine *engine, QObject *parent) @@ -1805,7 +1805,7 @@ QQmlListModel::QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::E Q_ASSERT(owner->m_dynamicRoles == false); m_dynamicRoles = false; - m_layout = 0; + m_layout = nullptr; m_listModel = data; m_engine = engine; @@ -1827,7 +1827,7 @@ QQmlListModel::QQmlListModel(QQmlListModel *orig, QQmlListModelWorkerAgent *agen else ListModel::sync(orig->m_listModel, m_listModel); - m_engine = 0; + m_engine = nullptr; } QQmlListModel::~QQmlListModel() @@ -1844,10 +1844,10 @@ QQmlListModel::~QQmlListModel() } } - m_listModel = 0; + m_listModel = nullptr; delete m_layout; - m_layout = 0; + m_layout = nullptr; } QQmlListModel *QQmlListModel::createWithOwner(QQmlListModel *newOwner) @@ -1869,7 +1869,7 @@ QQmlListModel *QQmlListModel::createWithOwner(QQmlListModel *newOwner) QV4::ExecutionEngine *QQmlListModel::engine() const { - if (m_engine == 0) { + if (m_engine == nullptr) { m_engine = qmlEngine(this)->handle(); } @@ -1939,7 +1939,7 @@ bool QQmlListModel::sync(QQmlListModel *src, QQmlListModel *target) ElementSync &s = elementHash.find(element->getUid()).value(); Q_ASSERT(s.srcIndex >= 0); DynamicRoleModelNode *targetElement = s.target; - if (targetElement == 0) { + if (targetElement == nullptr) { targetElement = new DynamicRoleModelNode(target, element->getUid()); } s.changedRoles = DynamicRoleModelNode::sync(element, targetElement); @@ -2111,7 +2111,7 @@ QHash<int, QByteArray> QQmlListModel::roleNames() const */ void QQmlListModel::setDynamicRoles(bool enableDynamicRoles) { - if (m_mainThread && m_agent == 0) { + if (m_mainThread && m_agent == nullptr) { if (enableDynamicRoles) { if (m_layout->roleCount()) qmlWarning(this) << tr("unable to enable dynamic roles as this model is not empty"); @@ -2605,15 +2605,15 @@ bool QQmlListModelParser::applyProperty(QV4::CompiledData::CompilationUnit *comp const quint32 targetObjectIndex = binding->value.objectIndex; const QV4::CompiledData::Object *target = qmlUnit->objectAt(targetObjectIndex); - ListModel *subModel = 0; + ListModel *subModel = nullptr; if (outterElementIndex == -1) { subModel = model; } else { const ListLayout::Role &role = model->getOrCreateListRole(elementName); if (role.type == ListLayout::Role::List) { subModel = model->getListProperty(outterElementIndex, role); - if (subModel == 0) { - subModel = new ListModel(role.subLayout, 0); + if (subModel == nullptr) { + subModel = new ListModel(role.subLayout, nullptr); QVariant vModel = QVariant::fromValue(subModel); model->setOrCreateProperty(outterElementIndex, elementName, vModel); } @@ -2640,7 +2640,7 @@ bool QQmlListModelParser::applyProperty(QV4::CompiledData::CompilationUnit *comp QString scriptStr = binding->valueAsScriptString(qmlUnit); if (definesEmptyList(scriptStr)) { const ListLayout::Role &role = model->getOrCreateListRole(elementName); - ListModel *emptyModel = new ListModel(role.subLayout, 0); + ListModel *emptyModel = new ListModel(role.subLayout, nullptr); value = QVariant::fromValue(emptyModel); } else if (binding->isFunctionExpression()) { QQmlBinding::Identifier id = binding->value.compiledScriptIndex; diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h index 147b845047..0a9d29ac05 100644 --- a/src/qml/types/qqmllistmodel_p.h +++ b/src/qml/types/qqmllistmodel_p.h @@ -84,7 +84,7 @@ class Q_QML_PRIVATE_EXPORT QQmlListModel : public QAbstractListModel Q_PROPERTY(bool dynamicRoles READ dynamicRoles WRITE setDynamicRoles) public: - QQmlListModel(QObject *parent=0); + QQmlListModel(QObject *parent=nullptr); ~QQmlListModel(); QModelIndex index(int row, int column, const QModelIndex &parent) const override; @@ -127,7 +127,7 @@ private: // Constructs a flat list model for a worker agent QQmlListModel(QQmlListModel *orig, QQmlListModelWorkerAgent *agent); - QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::ExecutionEngine *engine, QObject *parent=0); + QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::ExecutionEngine *engine, QObject *parent=nullptr); QV4::ExecutionEngine *engine() const; diff --git a/src/qml/types/qqmllistmodelworkeragent.cpp b/src/qml/types/qqmllistmodelworkeragent.cpp index a2750c926a..fe3eaa3198 100644 --- a/src/qml/types/qqmllistmodelworkeragent.cpp +++ b/src/qml/types/qqmllistmodelworkeragent.cpp @@ -86,7 +86,7 @@ void QQmlListModelWorkerAgent::release() void QQmlListModelWorkerAgent::modelDestroyed() { - m_orig = 0; + m_orig = nullptr; } int QQmlListModelWorkerAgent::count() const diff --git a/src/qml/types/qqmllistmodelworkeragent_p.h b/src/qml/types/qqmllistmodelworkeragent_p.h index 6973f55426..ae2d4b11e0 100644 --- a/src/qml/types/qqmllistmodelworkeragent_p.h +++ b/src/qml/types/qqmllistmodelworkeragent_p.h @@ -93,7 +93,7 @@ public: struct VariantRef { - VariantRef() : a(0) {} + VariantRef() : a(nullptr) {} VariantRef(const VariantRef &r) : a(r.a) { if (a) a->addref(); } VariantRef(QQmlListModelWorkerAgent *_a) : a(_a) { if (a) a->addref(); } ~VariantRef() { if (a) a->release(); } diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp index 54da0867d4..08740b4a6f 100644 --- a/src/qml/types/qqmlobjectmodel.cpp +++ b/src/qml/types/qqmlobjectmodel.cpp @@ -287,7 +287,7 @@ QQmlInstanceModel::ReleaseFlags QQmlObjectModel::release(QObject *item) if (!d->children[idx].deref()) return QQmlInstanceModel::Referenced; } - return 0; + return nullptr; } QString QQmlObjectModel::stringValue(int index, const QString &name) @@ -337,7 +337,7 @@ QObject *QQmlObjectModel::get(int index) const { Q_D(const QQmlObjectModel); if (index < 0 || index >= d->children.count()) - return 0; + return nullptr; return d->children.at(index).item; } diff --git a/src/qml/types/qqmlobjectmodel_p.h b/src/qml/types/qqmlobjectmodel_p.h index b3cf45ca62..267828dcdd 100644 --- a/src/qml/types/qqmlobjectmodel_p.h +++ b/src/qml/types/qqmlobjectmodel_p.h @@ -92,7 +92,7 @@ Q_SIGNALS: void destroyingItem(QObject *object); protected: - QQmlInstanceModel(QObjectPrivate &dd, QObject *parent = 0) + QQmlInstanceModel(QObjectPrivate &dd, QObject *parent = nullptr) : QObject(dd, parent) {} private: @@ -110,7 +110,7 @@ class Q_QML_PRIVATE_EXPORT QQmlObjectModel : public QQmlInstanceModel Q_CLASSINFO("DefaultProperty", "children") public: - QQmlObjectModel(QObject *parent=0); + QQmlObjectModel(QObject *parent=nullptr); ~QQmlObjectModel() {} int count() const override; diff --git a/src/qml/types/qqmltimer.cpp b/src/qml/types/qqmltimer.cpp index 2037c4f6cd..6554010f36 100644 --- a/src/qml/types/qqmltimer.cpp +++ b/src/qml/types/qqmltimer.cpp @@ -57,7 +57,7 @@ class QQmlTimerPrivate : public QObjectPrivate, public QAnimationJobChangeListen Q_DECLARE_PUBLIC(QQmlTimer) public: QQmlTimerPrivate() - : interval(1000), running(false), repeating(false), triggeredOnStart(false) + : running(false), repeating(false), triggeredOnStart(false) , classBegun(false), componentComplete(false), firstTick(true), awaitingTick(false) {} void animationFinished(QAbstractAnimationJob *) override; @@ -71,7 +71,7 @@ public: } } - int interval; + int interval = 1000; QPauseAnimationJob pause; bool running : 1; bool repeating : 1; diff --git a/src/qml/types/qqmltimer_p.h b/src/qml/types/qqmltimer_p.h index c97230501e..0160e97a2f 100644 --- a/src/qml/types/qqmltimer_p.h +++ b/src/qml/types/qqmltimer_p.h @@ -74,7 +74,7 @@ class Q_QML_PRIVATE_EXPORT QQmlTimer : public QObject, public QQmlParserStatus Q_PROPERTY(QObject *parent READ parent CONSTANT) public: - QQmlTimer(QObject *parent=0); + QQmlTimer(QObject *parent=nullptr); void setInterval(int interval); int interval() const; diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp index e0d1888f33..e8e897bab9 100644 --- a/src/qml/types/qquickpackage.cpp +++ b/src/qml/types/qquickpackage.cpp @@ -183,7 +183,7 @@ QObject *QQuickPackage::part(const QString &name) if (name == QLatin1String("default") && !d->dataList.isEmpty()) return d->dataList.at(0); - return 0; + return nullptr; } QQuickPackageAttached *QQuickPackage::qmlAttachedProperties(QObject *o) diff --git a/src/qml/types/qquickpackage_p.h b/src/qml/types/qquickpackage_p.h index ca383bfdcb..122c7fcb30 100644 --- a/src/qml/types/qquickpackage_p.h +++ b/src/qml/types/qquickpackage_p.h @@ -66,7 +66,7 @@ class Q_AUTOTEST_EXPORT QQuickPackage : public QObject Q_PROPERTY(QQmlListProperty<QObject> data READ data) public: - QQuickPackage(QObject *parent=0); + QQuickPackage(QObject *parent=nullptr); virtual ~QQuickPackage(); QQmlListProperty<QObject> data(); diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index 85afcf915b..dbc2769dd1 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -206,7 +206,7 @@ private: QQuickWorkerScriptEnginePrivate::WorkerEngine::WorkerEngine(QQuickWorkerScriptEnginePrivate *parent) : QV8Engine(new QV4::ExecutionEngine), p(parent) #if QT_CONFIG(qml_network) -, accessManager(0) +, accessManager(nullptr) #endif { m_v4Engine->v8Engine = this; @@ -293,7 +293,7 @@ QNetworkAccessManager *QQuickWorkerScriptEnginePrivate::WorkerEngine::networkAcc #endif QQuickWorkerScriptEnginePrivate::QQuickWorkerScriptEnginePrivate(QQmlEngine *engine) -: workerEngine(0), qmlengine(engine), m_nextId(0) +: workerEngine(nullptr), qmlengine(engine), m_nextId(0) { } @@ -510,7 +510,7 @@ QQuickWorkerScriptEngine::~QQuickWorkerScriptEngine() } QQuickWorkerScriptEnginePrivate::WorkerScript::WorkerScript() -: id(-1), initialized(false), owner(0) +: id(-1), initialized(false), owner(nullptr) { } @@ -537,7 +537,7 @@ void QQuickWorkerScriptEngine::removeWorkerScript(int id) { QQuickWorkerScriptEnginePrivate::WorkerScript* script = d->workers.value(id); if (script) { - script->owner = 0; + script->owner = nullptr; QCoreApplication::postEvent(d, new WorkerRemoveEvent(id)); } } @@ -568,7 +568,7 @@ void QQuickWorkerScriptEngine::run() qDeleteAll(d->workers); d->workers.clear(); - delete d->workerEngine; d->workerEngine = 0; + delete d->workerEngine; d->workerEngine = nullptr; } @@ -619,7 +619,7 @@ void QQuickWorkerScriptEngine::run() {Threaded ListModel Example} */ QQuickWorkerScript::QQuickWorkerScript(QObject *parent) -: QObject(parent), m_engine(0), m_scriptId(-1), m_componentComplete(true) +: QObject(parent), m_engine(nullptr), m_scriptId(-1), m_componentComplete(true) { } @@ -699,7 +699,7 @@ QQuickWorkerScriptEngine *QQuickWorkerScript::engine() QQmlEngine *engine = qmlEngine(this); if (!engine) { qWarning("QQuickWorkerScript: engine() called without qmlEngine() set"); - return 0; + return nullptr; } m_engine = QQmlEnginePrivate::get(engine)->getWorkerScriptEngine(); @@ -710,7 +710,7 @@ QQuickWorkerScriptEngine *QQuickWorkerScript::engine() return m_engine; } - return 0; + return nullptr; } void QQuickWorkerScript::componentComplete() diff --git a/src/qml/types/qquickworkerscript_p.h b/src/qml/types/qquickworkerscript_p.h index 8ea630c685..1a8d2ab076 100644 --- a/src/qml/types/qquickworkerscript_p.h +++ b/src/qml/types/qquickworkerscript_p.h @@ -67,7 +67,7 @@ class QQuickWorkerScriptEngine : public QThread { Q_OBJECT public: - QQuickWorkerScriptEngine(QQmlEngine *parent = 0); + QQuickWorkerScriptEngine(QQmlEngine *parent = nullptr); ~QQuickWorkerScriptEngine(); int registerWorkerScript(QQuickWorkerScript *); @@ -91,7 +91,7 @@ class Q_AUTOTEST_EXPORT QQuickWorkerScript : public QObject, public QQmlParserSt Q_INTERFACES(QQmlParserStatus) public: - QQuickWorkerScript(QObject *parent = 0); + QQuickWorkerScript(QObject *parent = nullptr); ~QQuickWorkerScript(); QUrl source() const; diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index b59e11c5ec..1cc347d6bc 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -121,8 +121,8 @@ class VDMModelDelegateDataType public: VDMModelDelegateDataType(QQmlAdaptorModel *model) : model(model) - , metaObject(0) - , propertyCache(0) + , metaObject(nullptr) + , propertyCache(nullptr) , propertyOffset(0) , signalOffset(0) , hasModelData(false) @@ -176,7 +176,7 @@ public: const int idx = item->modelIndex(); if (idx >= index && idx < index + count) { for (int i = 0; i < signalIndexes.count(); ++i) - QMetaObject::activate(item, signalIndexes.at(i), 0); + QMetaObject::activate(item, signalIndexes.at(i), nullptr); } } return changed; @@ -217,8 +217,8 @@ public: QV4::ExecutionEngine *v4 = data->v4; QV4::Scope scope(v4); QV4::ScopedObject proto(scope, v4->newObject()); - proto->defineAccessorProperty(QStringLiteral("index"), get_index, 0); - proto->defineAccessorProperty(QStringLiteral("hasModelChildren"), get_hasModelChildren, 0); + proto->defineAccessorProperty(QStringLiteral("index"), get_index, nullptr); + proto->defineAccessorProperty(QStringLiteral("hasModelChildren"), get_hasModelChildren, nullptr); QV4::ScopedProperty p(scope); typedef QHash<QByteArray, int>::const_iterator iterator; @@ -298,11 +298,11 @@ int QQmlDMCachedModelData::metaCall(QMetaObject::Call call, int id, void **argum const QMetaObject *meta = metaObject(); if (cachedData.count() > 1) { cachedData[propertyIndex] = *static_cast<QVariant *>(arguments[0]); - QMetaObject::activate(this, meta, propertyIndex, 0); + QMetaObject::activate(this, meta, propertyIndex, nullptr); } else if (cachedData.count() == 1) { cachedData[0] = *static_cast<QVariant *>(arguments[0]); - QMetaObject::activate(this, meta, 0, 0); - QMetaObject::activate(this, meta, 1, 0); + QMetaObject::activate(this, meta, 0, nullptr); + QMetaObject::activate(this, meta, 1, nullptr); } } else if (*type->model) { setValue(type->propertyRoles.at(propertyIndex), *static_cast<QVariant *>(arguments[0])); @@ -335,7 +335,7 @@ bool QQmlDMCachedModelData::resolveIndex(const QQmlAdaptorModel &, int idx) const QMetaObject *meta = metaObject(); const int propertyCount = type->propertyRoles.count(); for (int i = 0; i < propertyCount; ++i) - QMetaObject::activate(this, meta, i, 0); + QMetaObject::activate(this, meta, i, nullptr); return true; } else { return false; @@ -380,11 +380,11 @@ QV4::ReturnedValue QQmlDMCachedModelData::set_property(const QV4::FunctionObject if (!modelData->cachedData.isEmpty()) { if (modelData->cachedData.count() > 1) { modelData->cachedData[propertyId] = scope.engine->toVariant(argv[0], QVariant::Invalid); - QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, 0); + QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, nullptr); } else if (modelData->cachedData.count() == 1) { modelData->cachedData[0] = scope.engine->toVariant(argv[0], QVariant::Invalid); - QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, 0); - QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, 0); + QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, nullptr); + QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, nullptr); } } } @@ -750,7 +750,7 @@ public: QMetaObjectBuilder builder; VDMObjectDelegateDataType() - : metaObject(0) + : metaObject(nullptr) , propertyOffset(0) , signalOffset(0) , shared(true) @@ -760,7 +760,7 @@ public: VDMObjectDelegateDataType(const VDMObjectDelegateDataType &type) : QQmlRefCount() , QQmlAdaptorModel::Accessors() - , metaObject(0) + , metaObject(nullptr) , propertyOffset(type.propertyOffset) , signalOffset(type.signalOffset) , shared(false) @@ -804,7 +804,7 @@ public: dataType->initializeMetaType(model); return index >= 0 && index < model.list.count() ? new QQmlDMObjectData(metaType, dataType, index, qvariant_cast<QObject *>(model.list.at(index))) - : 0; + : nullptr; } void initializeMetaType(QQmlAdaptorModel &) @@ -852,7 +852,7 @@ public: QMetaObject::metacall(m_data->object, call, id - m_type->propertyOffset + objectPropertyOffset, arguments); return -1; } else if (id >= m_type->signalOffset && call == QMetaObject::InvokeMetaMethod) { - QMetaObject::activate(m_data, this, id - m_type->signalOffset, 0); + QMetaObject::activate(m_data, this, id - m_type->signalOffset, nullptr); return -1; } else { return m_data->qt_metacall(call, id, arguments); @@ -982,10 +982,10 @@ void QQmlAdaptorModel::setModel(const QVariant &variant, QQmlDelegateModel *vdm, accessors = new VDMObjectDelegateDataType; } else if (list.type() != QQmlListAccessor::Invalid && list.type() != QQmlListAccessor::Instance) { // Null QObject - setObject(0); + setObject(nullptr); accessors = &qt_vdm_list_accessors; } else { - setObject(0); + setObject(nullptr); accessors = &qt_vdm_null_accessors; } } @@ -1036,7 +1036,7 @@ int QQmlAdaptorModel::columnAt(int index) const void QQmlAdaptorModel::objectDestroyed(QObject *) { - setModel(QVariant(), 0, 0); + setModel(QVariant(), nullptr, nullptr); } QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4) @@ -1044,7 +1044,7 @@ QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4) { QV4::Scope scope(v4); QV4::ScopedObject proto(scope, v4->newObject()); - proto->defineAccessorProperty(QStringLiteral("index"), get_index, 0); + proto->defineAccessorProperty(QStringLiteral("index"), get_index, nullptr); proto->defineAccessorProperty(QStringLiteral("modelData"), QQmlDMListAccessorData::get_modelData, QQmlDMListAccessorData::set_modelData); listItemProto.set(v4, proto); diff --git a/src/qml/util/qqmladaptormodel_p.h b/src/qml/util/qqmladaptormodel_p.h index 75edcfd2ed..f0d3bcd186 100644 --- a/src/qml/util/qqmladaptormodel_p.h +++ b/src/qml/util/qqmladaptormodel_p.h @@ -76,7 +76,7 @@ public: virtual ~Accessors(); virtual int rowCount(const QQmlAdaptorModel &) const { return 0; } virtual int columnCount(const QQmlAdaptorModel &) const { return 0; } - virtual void cleanup(QQmlAdaptorModel &, QQmlDelegateModel * = 0) const {} + virtual void cleanup(QQmlAdaptorModel &, QQmlDelegateModel * = nullptr) const {} virtual QVariant value(const QQmlAdaptorModel &, int, const QString &) const { return QVariant(); } @@ -84,7 +84,7 @@ public: virtual QQmlDelegateModelItem *createItem( QQmlAdaptorModel &, QQmlDelegateModelItemMetaType *, - int) const { return 0; } + int) const { return nullptr; } virtual bool notify( const QQmlAdaptorModel &, diff --git a/src/qml/util/qqmlchangeset.cpp b/src/qml/util/qqmlchangeset.cpp index 79e3332331..ba876b42e2 100644 --- a/src/qml/util/qqmlchangeset.cpp +++ b/src/qml/util/qqmlchangeset.cpp @@ -120,7 +120,7 @@ void QQmlChangeSet::remove(int index, int count) { QVector<Change> removes; removes.append(Change(index, count)); - remove(&removes, 0); + remove(&removes, nullptr); } /*! diff --git a/src/qml/util/qqmlchangeset_p.h b/src/qml/util/qqmlchangeset_p.h index 8e1fa3f9f2..8347a3ff19 100644 --- a/src/qml/util/qqmlchangeset_p.h +++ b/src/qml/util/qqmlchangeset_p.h @@ -62,10 +62,10 @@ class Q_QML_PRIVATE_EXPORT QQmlChangeSet public: struct MoveKey { - MoveKey() : moveId(-1), offset(0) {} + MoveKey() {} MoveKey(int moveId, int offset) : moveId(moveId), offset(offset) {} - int moveId; - int offset; + int moveId = -1; + int offset = 0; }; // The storrage for Change (below). This struct is trivial, which it has to be in order to store @@ -119,7 +119,7 @@ public: void change(int index, int count); void insert(const QVector<Change> &inserts); - void remove(const QVector<Change> &removes, QVector<Change> *inserts = 0); + void remove(const QVector<Change> &removes, QVector<Change> *inserts = nullptr); void move(const QVector<Change> &removes, const QVector<Change> &inserts); void change(const QVector<Change> &changes); void apply(const QQmlChangeSet &changeSet); diff --git a/src/qml/util/qqmllistaccessor.cpp b/src/qml/util/qqmllistaccessor.cpp index 356584abdc..ad55519ad3 100644 --- a/src/qml/util/qqmllistaccessor.cpp +++ b/src/qml/util/qqmllistaccessor.cpp @@ -72,7 +72,7 @@ void QQmlListAccessor::setList(const QVariant &v, QQmlEngine *engine) if (d.userType() == qMetaTypeId<QJSValue>()) d = d.value<QJSValue>().toVariant(); - QQmlEnginePrivate *enginePrivate = engine?QQmlEnginePrivate::get(engine):0; + QQmlEnginePrivate *enginePrivate = engine?QQmlEnginePrivate::get(engine):nullptr; if (!d.isValid()) { m_type = Invalid; diff --git a/src/qml/util/qqmllistaccessor_p.h b/src/qml/util/qqmllistaccessor_p.h index bad5a5803c..bcd079adef 100644 --- a/src/qml/util/qqmllistaccessor_p.h +++ b/src/qml/util/qqmllistaccessor_p.h @@ -63,7 +63,7 @@ public: ~QQmlListAccessor(); QVariant list() const; - void setList(const QVariant &, QQmlEngine * = 0); + void setList(const QVariant &, QQmlEngine * = nullptr); bool isValid() const; diff --git a/src/qml/util/qqmllistcompositor.cpp b/src/qml/util/qqmllistcompositor.cpp index 05a4eaac39..8b0b8f48f0 100644 --- a/src/qml/util/qqmllistcompositor.cpp +++ b/src/qml/util/qqmllistcompositor.cpp @@ -1253,7 +1253,7 @@ void QQmlListCompositor::listItemsRemoved( QVector<QQmlChangeSet::Change> removals; removals.append(QQmlChangeSet::Change(index, count)); - listItemsRemoved(translatedRemovals, list, &removals, 0, 0); + listItemsRemoved(translatedRemovals, list, &removals, nullptr, nullptr); } /*! diff --git a/src/qml/util/qqmllistcompositor_p.h b/src/qml/util/qqmllistcompositor_p.h index 6ae9c47df3..172040559c 100644 --- a/src/qml/util/qqmllistcompositor_p.h +++ b/src/qml/util/qqmllistcompositor_p.h @@ -87,17 +87,17 @@ public: class Range { public: - Range() : next(this), previous(this), list(0), index(0), count(0), flags(0) {} + Range() : next(this), previous(this) {} Range(Range *next, void *list, int index, int count, uint flags) : next(next), previous(next->previous), list(list), index(index), count(count), flags(flags) { next->previous = this; previous->next = this; } Range *next; Range *previous; - void *list; - int index; - int count; - uint flags; + void *list = nullptr; + int index = 0; + int count = 0; + uint flags = 0; inline int start() const { return index; } inline int end() const { return index + count; } @@ -145,11 +145,11 @@ public: void setGroup(Group g) { group = g; groupFlag = 1 << g; } - Range *range; - int offset; - Group group; + Range *range = nullptr; + int offset = 0; + Group group = Default; int groupFlag; - int groupCount; + int groupCount = 0; union { struct { int cacheIndex; @@ -222,22 +222,22 @@ public: const iterator &end() { return m_end; } - void append(void *list, int index, int count, uint flags, QVector<Insert> *inserts = 0); - void insert(Group group, int before, void *list, int index, int count, uint flags, QVector<Insert> *inserts = 0); - iterator insert(iterator before, void *list, int index, int count, uint flags, QVector<Insert> *inserts = 0); + void append(void *list, int index, int count, uint flags, QVector<Insert> *inserts = nullptr); + void insert(Group group, int before, void *list, int index, int count, uint flags, QVector<Insert> *inserts = nullptr); + iterator insert(iterator before, void *list, int index, int count, uint flags, QVector<Insert> *inserts = nullptr); - void setFlags(Group fromGroup, int from, int count, Group group, int flags, QVector<Insert> *inserts = 0); - void setFlags(iterator from, int count, Group group, uint flags, QVector<Insert> *inserts = 0); - void setFlags(Group fromGroup, int from, int count, uint flags, QVector<Insert> *inserts = 0) { + void setFlags(Group fromGroup, int from, int count, Group group, int flags, QVector<Insert> *inserts = nullptr); + void setFlags(iterator from, int count, Group group, uint flags, QVector<Insert> *inserts = nullptr); + void setFlags(Group fromGroup, int from, int count, uint flags, QVector<Insert> *inserts = nullptr) { setFlags(fromGroup, from, count, fromGroup, flags, inserts); } - void setFlags(const iterator from, int count, uint flags, QVector<Insert> *inserts = 0) { + void setFlags(const iterator from, int count, uint flags, QVector<Insert> *inserts = nullptr) { setFlags(from, count, from.group, flags, inserts); } - void clearFlags(Group fromGroup, int from, int count, Group group, uint flags, QVector<Remove> *removals = 0); - void clearFlags(iterator from, int count, Group group, uint flags, QVector<Remove> *removals = 0); - void clearFlags(Group fromGroup, int from, int count, uint flags, QVector<Remove> *removals = 0) { + void clearFlags(Group fromGroup, int from, int count, Group group, uint flags, QVector<Remove> *removals = nullptr); + void clearFlags(iterator from, int count, Group group, uint flags, QVector<Remove> *removals = nullptr); + void clearFlags(Group fromGroup, int from, int count, uint flags, QVector<Remove> *removals = nullptr) { clearFlags(fromGroup, from, count, fromGroup, flags, removals); } - void clearFlags(const iterator &from, int count, uint flags, QVector<Remove> *removals = 0) { + void clearFlags(const iterator &from, int count, uint flags, QVector<Remove> *removals = nullptr) { clearFlags(from, count, from.group, flags, removals); } bool verifyMoveTo(Group fromGroup, int from, Group toGroup, int to, int count, Group group) const; @@ -249,8 +249,8 @@ public: int to, int count, Group group, - QVector<Remove> *removals = 0, - QVector<Insert> *inserts = 0); + QVector<Remove> *removals = nullptr, + QVector<Insert> *inserts = nullptr); void clear(); void listItemsInserted(void *list, int index, int count, QVector<Insert> *inserts); @@ -289,13 +289,13 @@ private: QVector<Remove> *translatedRemovals, void *list, QVector<QQmlChangeSet::Change> *removals, - QVector<QQmlChangeSet::Change> *insertions = 0, - QVector<MovedFlags> *movedFlags = 0); + QVector<QQmlChangeSet::Change> *insertions = nullptr, + QVector<MovedFlags> *movedFlags = nullptr); void listItemsInserted( QVector<Insert> *translatedInsertions, void *list, const QVector<QQmlChangeSet::Change> &insertions, - const QVector<MovedFlags> *movedFlags = 0); + const QVector<MovedFlags> *movedFlags = nullptr); void listItemsChanged( QVector<Change> *translatedChanges, void *list, @@ -308,8 +308,7 @@ Q_DECLARE_TYPEINFO(QQmlListCompositor::Change, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QQmlListCompositor::Remove, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QQmlListCompositor::Insert, Q_PRIMITIVE_TYPE); -inline QQmlListCompositor::iterator::iterator() - : range(0), offset(0), group(Default), groupCount(0) {} +inline QQmlListCompositor::iterator::iterator() {} inline QQmlListCompositor::iterator::iterator(const iterator &it) : range(it.range) , offset(it.offset) diff --git a/src/qmldebug/qqmldebugclient.cpp b/src/qmldebug/qqmldebugclient.cpp index 7f1e8c637c..d412b7b267 100644 --- a/src/qmldebug/qqmldebugclient.cpp +++ b/src/qmldebug/qqmldebugclient.cpp @@ -77,7 +77,7 @@ void QQmlDebugClientPrivate::addToConnection() Q_Q(QQmlDebugClient); if (connection && !connection->addClient(name, q)) { qWarning() << "QQmlDebugClient: Conflicting plugin name" << name; - connection = 0; + connection = nullptr; } } diff --git a/src/qmldebug/qqmldebugconnection.cpp b/src/qmldebug/qqmldebugconnection.cpp index 73ccd7c854..67bad8d812 100644 --- a/src/qmldebug/qqmldebugconnection.cpp +++ b/src/qmldebug/qqmldebugconnection.cpp @@ -63,15 +63,15 @@ class QQmlDebugConnectionPrivate : public QObjectPrivate public: QQmlDebugConnectionPrivate(); - QPacketProtocol *protocol; - QIODevice *device; - QLocalServer *server; + QPacketProtocol *protocol = nullptr; + QIODevice *device = nullptr; + QLocalServer *server = nullptr; QEventLoop handshakeEventLoop; QTimer handshakeTimer; - bool gotHello; - int currentDataStreamVersion; - int maximumDataStreamVersion; + bool gotHello = false; + int currentDataStreamVersion = QDataStream::Qt_4_7; + int maximumDataStreamVersion = QDataStream::Qt_DefaultCompiledVersion; QHash <QString, float> serverPlugins; QHash<QString, QQmlDebugClient *> plugins; QStringList removedPlugins; @@ -81,10 +81,7 @@ public: void flush(); }; -QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate() : - protocol(0), device(0), server(0), gotHello(false), - currentDataStreamVersion(QDataStream::Qt_4_7), - maximumDataStreamVersion(QDataStream::Qt_DefaultCompiledVersion) +QQmlDebugConnectionPrivate::QQmlDebugConnectionPrivate() { handshakeTimer.setSingleShot(true); handshakeTimer.setInterval(3000); @@ -303,7 +300,7 @@ void QQmlDebugConnection::close() if (d->device) { d->device->deleteLater(); - d->device = 0; + d->device = nullptr; } } diff --git a/src/qmldebug/qqmldebugconnection_p.h b/src/qmldebug/qqmldebugconnection_p.h index be425b6cbf..ad9376886c 100644 --- a/src/qmldebug/qqmldebugconnection_p.h +++ b/src/qmldebug/qqmldebugconnection_p.h @@ -64,7 +64,7 @@ class QQmlDebugConnection : public QObject Q_DISABLE_COPY(QQmlDebugConnection) Q_DECLARE_PRIVATE(QQmlDebugConnection) public: - QQmlDebugConnection(QObject *parent = 0); + QQmlDebugConnection(QObject *parent = nullptr); ~QQmlDebugConnection(); void connectToHost(const QString &hostName, quint16 port); diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index 817f9a5389..a02a0a806d 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -79,7 +79,7 @@ class QTestRootObject : public QObject Q_PROPERTY(bool hasTestCase READ hasTestCase WRITE setHasTestCase NOTIFY hasTestCaseChanged) Q_PROPERTY(QObject *defined READ defined) public: - QTestRootObject(QObject *parent = 0) + QTestRootObject(QObject *parent = nullptr) : QObject(parent), hasQuit(false), m_windowShown(false), m_hasTestCase(false) { m_defined = new QQmlPropertyMap(this); #if defined(QT_OPENGL_ES_2_ANGLE) @@ -191,7 +191,7 @@ bool qWaitForSignal(QObject *obj, const char* signal, int timeout = 5000) if (remaining <= 0) break; QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QTest::qSleep(10); } @@ -343,7 +343,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch } #endif - QCoreApplication *app = 0; + QCoreApplication *app = nullptr; if (!QCoreApplication::instance()) { #ifdef QT_QMLTEST_WITH_WIDGETS if (withWidgets) @@ -577,7 +577,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch } // Flush the current logging stream. - QuickTestResult::setProgramName(0); + QuickTestResult::setProgramName(nullptr); delete app; // Return the number of failures as the exit code. diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp index bf255e9cda..ee375a896c 100644 --- a/src/qmltest/quicktestevent.cpp +++ b/src/qmltest/quicktestevent.cpp @@ -190,7 +190,7 @@ namespace QtQuickTest me.setTimestamp(++lastMouseTimestamp); break; case MouseRelease: - me = QMouseEvent(QEvent::MouseButtonRelease, pos, window->mapToGlobal(pos), button, 0, stateKey); + me = QMouseEvent(QEvent::MouseButtonRelease, pos, window->mapToGlobal(pos), button, nullptr, stateKey); me.setTimestamp(++lastMouseTimestamp); lastMouseTimestamp += 500; // avoid double clicks being generated break; @@ -355,7 +355,7 @@ QWindow *QuickTestEvent::eventWindow(QObject *item) QQuickItem *testParentitem = qobject_cast<QQuickItem *>(parent()); if (testParentitem) return testParentitem->window(); - return 0; + return nullptr; } QWindow *QuickTestEvent::activeWindow() diff --git a/src/qmltest/quicktestevent_p.h b/src/qmltest/quicktestevent_p.h index 92477399bc..d586ff638d 100644 --- a/src/qmltest/quicktestevent_p.h +++ b/src/qmltest/quicktestevent_p.h @@ -81,7 +81,7 @@ class Q_QUICK_TEST_EXPORT QuickTestEvent : public QObject Q_OBJECT Q_PROPERTY(int defaultMouseDelay READ defaultMouseDelay FINAL) public: - QuickTestEvent(QObject *parent = 0); + QuickTestEvent(QObject *parent = nullptr); ~QuickTestEvent(); int defaultMouseDelay() const; @@ -115,7 +115,7 @@ public Q_SLOTS: QQuickTouchEventSequence *touchEvent(QObject *item = nullptr); private: - QWindow *eventWindow(QObject *item = 0); + QWindow *eventWindow(QObject *item = nullptr); QWindow *activeWindow(); QTouchDevice *touchDevice(); diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp index d7d692a80d..c4a3280cf6 100644 --- a/src/qmltest/quicktestresult.cpp +++ b/src/qmltest/quicktestresult.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE -static const char *globalProgramName = 0; +static const char *globalProgramName = nullptr; static bool loggingStarted = false; static QBenchmarkGlobalData globalBenchmarkData; @@ -88,7 +88,7 @@ class Q_QUICK_TEST_EXPORT QuickTestImageObject : public QObject Q_PROPERTY(QSize size READ size CONSTANT) public: - QuickTestImageObject(const QImage& img, QObject *parent = 0) + QuickTestImageObject(const QImage& img, QObject *parent = nullptr) : QObject(parent) , m_image(img) { @@ -172,9 +172,9 @@ class QuickTestResultPrivate { public: QuickTestResultPrivate() - : table(0) - , benchmarkIter(0) - , benchmarkData(0) + : table(nullptr) + , benchmarkIter(nullptr) + , benchmarkData(nullptr) , iterCount(0) { } @@ -261,10 +261,10 @@ void QuickTestResult::setFunctionName(const QString &name) QString fullName = d->testCaseName + QLatin1String("::") + name; QTestResult::setCurrentTestFunction (d->intern(fullName).constData()); - QTestPrivate::checkBlackLists(fullName.toUtf8().constData(), 0); + QTestPrivate::checkBlackLists(fullName.toUtf8().constData(), nullptr); } } else { - QTestResult::setCurrentTestFunction(0); + QTestResult::setCurrentTestFunction(nullptr); } d->functionName = name; emit functionNameChanged(); @@ -293,7 +293,7 @@ void QuickTestResult::setDataTag(const QString &tag) QTestPrivate::checkBlackLists((testCaseName() + QLatin1String("::") + functionName()).toUtf8().constData(), tag.toUtf8().constData()); emit dataTagChanged(); } else { - QTestResult::setCurrentTestData(0); + QTestResult::setCurrentTestData(nullptr); } } @@ -438,7 +438,7 @@ void QuickTestResult::clearTestTable() { Q_D(QuickTestResult); delete d->table; - d->table = 0; + d->table = nullptr; } void QuickTestResult::finishTestData() @@ -745,7 +745,7 @@ void QuickTestResult::stopBenchmark() { Q_D(QuickTestResult); delete d->benchmarkIter; - d->benchmarkIter = 0; + d->benchmarkIter = nullptr; } QObject *QuickTestResult::grabImage(QQuickItem *item) @@ -759,7 +759,7 @@ QObject *QuickTestResult::grabImage(QQuickItem *item) QQmlEngine::setContextForObject(o, qmlContext(this)); return o; } - return 0; + return nullptr; } QObject *QuickTestResult::findChild(QObject *parent, const QString &objectName) @@ -787,7 +787,7 @@ void QuickTestResult::setProgramName(const char *name) } else if (!name && loggingStarted) { QTestResult::setCurrentTestObject(globalProgramName); QTestLog::stopLogging(); - QTestResult::setCurrentTestObject(0); + QTestResult::setCurrentTestObject(nullptr); } globalProgramName = name; QTestResult::setCurrentTestObject(globalProgramName); diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h index af13299ee5..3973cf4072 100644 --- a/src/qmltest/quicktestresult_p.h +++ b/src/qmltest/quicktestresult_p.h @@ -77,7 +77,7 @@ class Q_QUICK_TEST_EXPORT QuickTestResult : public QObject Q_PROPERTY(int skipCount READ skipCount) Q_PROPERTY(QStringList functionsToRun READ functionsToRun) public: - QuickTestResult(QObject *parent = 0); + QuickTestResult(QObject *parent = nullptr); ~QuickTestResult(); // Values must match QBenchmarkIterationController::RunMode. diff --git a/src/quick/accessible/qaccessiblequickitem.cpp b/src/quick/accessible/qaccessiblequickitem.cpp index 2d6bb02af4..87e581384b 100644 --- a/src/quick/accessible/qaccessiblequickitem.cpp +++ b/src/quick/accessible/qaccessiblequickitem.cpp @@ -92,7 +92,7 @@ QAccessibleInterface *QAccessibleQuickItem::childAt(int x, int y) const { if (item()->clip()) { if (!rect().contains(x, y)) - return 0; + return nullptr; } const QList<QQuickItem*> kids = accessibleUnignoredChildren(item(), true); @@ -106,14 +106,14 @@ QAccessibleInterface *QAccessibleQuickItem::childAt(int x, int y) const } } - return 0; + return nullptr; } QAccessibleInterface *QAccessibleQuickItem::parent() const { QQuickItem *parent = item()->parentItem(); QQuickWindow *window = item()->window(); - QQuickItem *ci = window ? window->contentItem() : 0; + QQuickItem *ci = window ? window->contentItem() : nullptr; while (parent && !QQuickItemPrivate::get(parent)->isAccessible && parent != ci) parent = parent->parentItem(); @@ -131,7 +131,7 @@ QAccessibleInterface *QAccessibleQuickItem::parent() const return QAccessible::queryAccessibleInterface(parent); } } - return 0; + return nullptr; } QAccessibleInterface *QAccessibleQuickItem::child(int index) const @@ -139,7 +139,7 @@ QAccessibleInterface *QAccessibleQuickItem::child(int index) const QList<QQuickItem *> children = childItems(); if (index < 0 || index >= children.count()) - return 0; + return nullptr; QQuickItem *child = children.at(index); return QAccessible::queryAccessibleInterface(child); @@ -458,7 +458,7 @@ QTextDocument *QAccessibleQuickItem::textDocument() const QQuickTextDocument *qqdoc = docVariant.value<QQuickTextDocument*>(); return qqdoc->textDocument(); } - return 0; + return nullptr; } int QAccessibleQuickItem::characterCount() const diff --git a/src/quick/accessible/qaccessiblequickview.cpp b/src/quick/accessible/qaccessiblequickview.cpp index b3d1b6fc0f..3bb40546be 100644 --- a/src/quick/accessible/qaccessiblequickview.cpp +++ b/src/quick/accessible/qaccessiblequickview.cpp @@ -78,7 +78,7 @@ QAccessibleInterface *QAccessibleQuickWindow::child(int index) const const QList<QQuickItem*> &kids = rootItems(); if (index >= 0 && index < kids.count()) return QAccessible::queryAccessibleInterface(kids.at(index)); - return 0; + return nullptr; } QAccessibleInterface *QAccessibleQuickWindow::focusChild() const @@ -133,7 +133,7 @@ QAccessibleInterface *QAccessibleQuickWindow::childAt(int x, int y) const return childIface; } } - return 0; + return nullptr; } int QAccessibleQuickWindow::indexOfChild(const QAccessibleInterface *iface) const diff --git a/src/quick/accessible/qquickaccessiblefactory.cpp b/src/quick/accessible/qquickaccessiblefactory.cpp index a1fa695e5a..1aacf8e8bd 100644 --- a/src/quick/accessible/qquickaccessiblefactory.cpp +++ b/src/quick/accessible/qquickaccessiblefactory.cpp @@ -55,11 +55,11 @@ QAccessibleInterface *qQuickAccessibleFactory(const QString &classname, QObject Q_ASSERT(item); QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); if (!itemPrivate->isAccessible) - return 0; + return nullptr; return new QAccessibleQuickItem(item); } - return 0; + return nullptr; } #endif diff --git a/src/quick/designer/qqmldesignermetaobject.cpp b/src/quick/designer/qqmldesignermetaobject.cpp index 63364192c6..09493c30d6 100644 --- a/src/quick/designer/qqmldesignermetaobject.cpp +++ b/src/quick/designer/qqmldesignermetaobject.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE static QHash<QDynamicMetaObjectData *, bool> nodeInstanceMetaObjectList; -static void (*notifyPropertyChangeCallBack)(QObject*, const QQuickDesignerSupport::PropertyName &propertyName) = 0; +static void (*notifyPropertyChangeCallBack)(QObject*, const QQuickDesignerSupport::PropertyName &propertyName) = nullptr; struct MetaPropertyData { inline QPair<QVariant, bool> &getDataRef(int idx) { @@ -174,7 +174,7 @@ void QQmlDesignerMetaObject::setValue(int id, const QVariant &value) QPair<QVariant, bool> &prop = m_data->getDataRef(id); prop.first = propertyWriteValue(id, value); prop.second = true; - QMetaObject::activate(myObject(), id + m_type->signalOffset(), 0); + QMetaObject::activate(myObject(), id + m_type->signalOffset(), nullptr); } QVariant QQmlDesignerMetaObject::propertyWriteValue(int, const QVariant &value) @@ -187,7 +187,7 @@ const QAbstractDynamicMetaObject *QQmlDesignerMetaObject::dynamicMetaObjectParen if (QQmlVMEMetaObject::parent.isT1()) return QQmlVMEMetaObject::parent.asT1()->toDynamicMetaObject(QQmlVMEMetaObject::object); else - return 0; + return nullptr; } const QMetaObject *QQmlDesignerMetaObject::metaObjectParent() const @@ -218,7 +218,7 @@ int QQmlDesignerMetaObject::openMetaCall(QObject *o, QMetaObject::Call call, int prop.first = propertyWriteValue(propId, *reinterpret_cast<QVariant *>(a[0])); prop.second = true; //propertyWritten(propId); - activate(myObject(), m_type->signalOffset() + propId, 0); + activate(myObject(), m_type->signalOffset() + propId, nullptr); } } return -1; diff --git a/src/quick/designer/qquickdesignercustomobjectdata.cpp b/src/quick/designer/qquickdesignercustomobjectdata.cpp index ca9c1259fd..59e086b5a3 100644 --- a/src/quick/designer/qquickdesignercustomobjectdata.cpp +++ b/src/quick/designer/qquickdesignercustomobjectdata.cpp @@ -180,7 +180,7 @@ void QQuickDesignerCustomObjectData::doResetProperty(QQmlContext *context, const QQmlAbstractBinding *binding = QQmlPropertyPrivate::binding(property); if (binding && !(hasValidResetBinding(propertyName) && getResetBinding(propertyName) == binding)) { - binding->setEnabled(false, 0); + binding->setEnabled(false, nullptr); } diff --git a/src/quick/designer/qquickdesignersupport.cpp b/src/quick/designer/qquickdesignersupport.cpp index 88971e3172..1851c25a77 100644 --- a/src/quick/designer/qquickdesignersupport.cpp +++ b/src/quick/designer/qquickdesignersupport.cpp @@ -78,7 +78,7 @@ QQuickDesignerSupport::~QQuickDesignerSupport() void QQuickDesignerSupport::refFromEffectItem(QQuickItem *referencedItem, bool hide) { - if (referencedItem == 0) + if (referencedItem == nullptr) return; QQuickItemPrivate::get(referencedItem)->refFromEffectItem(hide); @@ -114,7 +114,7 @@ void QQuickDesignerSupport::refFromEffectItem(QQuickItem *referencedItem, bool h void QQuickDesignerSupport::derefFromEffectItem(QQuickItem *referencedItem, bool unhide) { - if (referencedItem == 0) + if (referencedItem == nullptr) return; delete m_itemTextureHash.take(referencedItem); @@ -123,7 +123,7 @@ void QQuickDesignerSupport::derefFromEffectItem(QQuickItem *referencedItem, bool QImage QQuickDesignerSupport::renderImageForItem(QQuickItem *referencedItem, const QRectF &boundingRect, const QSize &imageSize) { - if (referencedItem == 0 || referencedItem->parentItem() == 0) { + if (referencedItem == nullptr || referencedItem->parentItem() == nullptr) { qDebug() << __FILE__ << __LINE__ << "Warning: Item can be rendered."; return QImage(); } @@ -131,7 +131,7 @@ QImage QQuickDesignerSupport::renderImageForItem(QQuickItem *referencedItem, con QSGLayer *renderTexture = m_itemTextureHash.value(referencedItem); Q_ASSERT(renderTexture); - if (renderTexture == 0) + if (renderTexture == nullptr) return QImage(); renderTexture->setRect(boundingRect); renderTexture->setSize(imageSize); @@ -150,7 +150,7 @@ QImage QQuickDesignerSupport::renderImageForItem(QQuickItem *referencedItem, con bool QQuickDesignerSupport::isDirty(QQuickItem *referencedItem, DirtyType dirtyType) { - if (referencedItem == 0) + if (referencedItem == nullptr) return false; return QQuickItemPrivate::get(referencedItem)->dirtyAttributes & dirtyType; @@ -158,7 +158,7 @@ bool QQuickDesignerSupport::isDirty(QQuickItem *referencedItem, DirtyType dirtyT void QQuickDesignerSupport::addDirty(QQuickItem *referencedItem, QQuickDesignerSupport::DirtyType dirtyType) { - if (referencedItem == 0) + if (referencedItem == nullptr) return; QQuickItemPrivate::get(referencedItem)->dirtyAttributes |= dirtyType; @@ -166,7 +166,7 @@ void QQuickDesignerSupport::addDirty(QQuickItem *referencedItem, QQuickDesignerS void QQuickDesignerSupport::resetDirty(QQuickItem *referencedItem) { - if (referencedItem == 0) + if (referencedItem == nullptr) return; QQuickItemPrivate::get(referencedItem)->dirtyAttributes = 0x0; @@ -175,7 +175,7 @@ void QQuickDesignerSupport::resetDirty(QQuickItem *referencedItem) QTransform QQuickDesignerSupport::windowTransform(QQuickItem *referencedItem) { - if (referencedItem == 0) + if (referencedItem == nullptr) return QTransform(); return QQuickItemPrivate::get(referencedItem)->itemToWindowTransform(); @@ -183,7 +183,7 @@ QTransform QQuickDesignerSupport::windowTransform(QQuickItem *referencedItem) QTransform QQuickDesignerSupport::parentTransform(QQuickItem *referencedItem) { - if (referencedItem == 0) + if (referencedItem == nullptr) return QTransform(); QTransform parentTransform; @@ -294,31 +294,31 @@ bool QQuickDesignerSupport::hasAnchor(QQuickItem *item, const QString &name) return false; if (name == QLatin1String("anchors.fill")) - return anchors(item)->fill() != 0; + return anchors(item)->fill() != nullptr; if (name == QLatin1String("anchors.centerIn")) - return anchors(item)->centerIn() != 0; + return anchors(item)->centerIn() != nullptr; if (name == QLatin1String("anchors.right")) - return anchors(item)->right().item != 0; + return anchors(item)->right().item != nullptr; if (name == QLatin1String("anchors.top")) - return anchors(item)->top().item != 0; + return anchors(item)->top().item != nullptr; if (name == QLatin1String("anchors.left")) - return anchors(item)->left().item != 0; + return anchors(item)->left().item != nullptr; if (name == QLatin1String("anchors.bottom")) - return anchors(item)->bottom().item != 0; + return anchors(item)->bottom().item != nullptr; if (name == QLatin1String("anchors.horizontalCenter")) - return anchors(item)->horizontalCenter().item != 0; + return anchors(item)->horizontalCenter().item != nullptr; if (name == QLatin1String("anchors.verticalCenter")) - return anchors(item)->verticalCenter().item != 0; + return anchors(item)->verticalCenter().item != nullptr; if (name == QLatin1String("anchors.baseline")) - return anchors(item)->baseline().item != 0; + return anchors(item)->baseline().item != nullptr; return anchors(item)->usedAnchors().testFlag(anchorLineFlagForName(name)); } @@ -337,7 +337,7 @@ QQuickItem *QQuickDesignerSupport::anchorCenterInTargetItem(QQuickItem *item) QPair<QString, QObject*> QQuickDesignerSupport::anchorLineTarget(QQuickItem *item, const QString &name, QQmlContext *context) { - QObject *targetObject = 0; + QObject *targetObject = nullptr; QString targetName; if (name == QLatin1String("anchors.fill")) { diff --git a/src/quick/designer/qquickdesignersupportitems.cpp b/src/quick/designer/qquickdesignersupportitems.cpp index 38ba46e702..9fadbb2122 100644 --- a/src/quick/designer/qquickdesignersupportitems.cpp +++ b/src/quick/designer/qquickdesignersupportitems.cpp @@ -55,11 +55,11 @@ QT_BEGIN_NAMESPACE -static void (*fixResourcePathsForObjectCallBack)(QObject*) = 0; +static void (*fixResourcePathsForObjectCallBack)(QObject*) = nullptr; static void stopAnimation(QObject *object) { - if (object == 0) + if (object == nullptr) return; QQuickTransition *transition = qobject_cast<QQuickTransition*>(object); @@ -203,7 +203,7 @@ QObject *QQuickDesignerSupportItems::createPrimitive(const QString &typeName, in Q_UNUSED(disableComponentComplete) - QObject *object = 0; + QObject *object = nullptr; QQmlType type = QQmlMetaType::qmlType(typeName, majorNumber, minorNumber); if (isCrashingType(type)) { @@ -214,7 +214,7 @@ QObject *QQuickDesignerSupportItems::createPrimitive(const QString &typeName, in } else { if (type.typeName() == "QQmlComponent") { - object = new QQmlComponent(context->engine(), 0); + object = new QQmlComponent(context->engine(), nullptr); } else { object = type.create(); } @@ -235,7 +235,7 @@ QObject *QQuickDesignerSupportItems::createPrimitive(const QString &typeName, in tweakObjects(object); - if (object && QQmlEngine::contextForObject(object) == 0) + if (object && QQmlEngine::contextForObject(object) == nullptr) QQmlEngine::setContextForObject(object, context); QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership); diff --git a/src/quick/designer/qquickdesignersupportmetainfo.cpp b/src/quick/designer/qquickdesignersupportmetainfo.cpp index b398bae55d..9c8a642837 100644 --- a/src/quick/designer/qquickdesignersupportmetainfo.cpp +++ b/src/quick/designer/qquickdesignersupportmetainfo.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE bool QQuickDesignerSupportMetaInfo::isSubclassOf(QObject *object, const QByteArray &superTypeName) { - if (object == 0) + if (object == nullptr) return false; const QMetaObject *metaObject = object->metaObject(); diff --git a/src/quick/designer/qquickdesignersupportproperties.cpp b/src/quick/designer/qquickdesignersupportproperties.cpp index a4d1fd0dc1..674f811f8f 100644 --- a/src/quick/designer/qquickdesignersupportproperties.cpp +++ b/src/quick/designer/qquickdesignersupportproperties.cpp @@ -134,7 +134,7 @@ QQuickDesignerSupport::PropertyNameList QQuickDesignerSupportProperties::propert QObjectList localObjectList; - if (inspectedObjects == 0) + if (inspectedObjects == nullptr) inspectedObjects = &localObjectList; @@ -191,7 +191,7 @@ QQuickDesignerSupport::PropertyNameList QQuickDesignerSupportProperties::allProp QObjectList localObjectList; - if (inspectedObjects == 0) + if (inspectedObjects == nullptr) inspectedObjects = &localObjectList; diff --git a/src/quick/designer/qquickdesignersupportproperties_p.h b/src/quick/designer/qquickdesignersupportproperties_p.h index a2872be060..02e75ea886 100644 --- a/src/quick/designer/qquickdesignersupportproperties_p.h +++ b/src/quick/designer/qquickdesignersupportproperties_p.h @@ -92,10 +92,10 @@ public: static bool isPropertyBlackListed(const QQuickDesignerSupport::PropertyName &propertyName); static QQuickDesignerSupport::PropertyNameList propertyNameListForWritableProperties(QObject *object, const QQuickDesignerSupport::PropertyName &baseName = QQuickDesignerSupport::PropertyName(), - QObjectList *inspectedObjects = 0); + QObjectList *inspectedObjects = nullptr); static QQuickDesignerSupport::PropertyNameList allPropertyNames(QObject *object, const QQuickDesignerSupport::PropertyName &baseName = QQuickDesignerSupport::PropertyName(), - QObjectList *inspectedObjects = 0); + QObjectList *inspectedObjects = nullptr); static bool hasFullImplementedListInterface(const QQmlListReference &list); }; diff --git a/src/quick/designer/qquickdesignersupportpropertychanges.cpp b/src/quick/designer/qquickdesignersupportpropertychanges.cpp index 5cafcfc360..0ee8857325 100644 --- a/src/quick/designer/qquickdesignersupportpropertychanges.cpp +++ b/src/quick/designer/qquickdesignersupportpropertychanges.cpp @@ -59,7 +59,7 @@ QObject *QQuickDesignerSupportPropertyChanges::targetObject(QObject *propertyCha QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges); if (!propertyChange) - return 0; + return nullptr; return propertyChange->object(); } @@ -114,7 +114,7 @@ QObject *QQuickDesignerSupportPropertyChanges::stateObject(QObject *propertyChan QQuickPropertyChanges *propertyChange = qobject_cast<QQuickPropertyChanges*>(propertyChanges); if (!propertyChange) - return 0; + return nullptr; return propertyChange->state(); } diff --git a/src/quick/handlers/qquickdraghandler_p.h b/src/quick/handlers/qquickdraghandler_p.h index 50f56d78a4..363df31a64 100644 --- a/src/quick/handlers/qquickdraghandler_p.h +++ b/src/quick/handlers/qquickdraghandler_p.h @@ -93,7 +93,7 @@ class Q_AUTOTEST_EXPORT QQuickDragHandler : public QQuickSinglePointHandler Q_PROPERTY(QVector2D translation READ translation NOTIFY translationChanged) public: - explicit QQuickDragHandler(QObject *parent = 0); + explicit QQuickDragHandler(QObject *parent = nullptr); ~QQuickDragHandler(); void handleEventPoint(QQuickEventPoint *point) override; diff --git a/src/quick/handlers/qquickmultipointhandler_p.h b/src/quick/handlers/qquickmultipointhandler_p.h index 05c3876246..67e550d387 100644 --- a/src/quick/handlers/qquickmultipointhandler_p.h +++ b/src/quick/handlers/qquickmultipointhandler_p.h @@ -65,7 +65,7 @@ class Q_AUTOTEST_EXPORT QQuickMultiPointHandler : public QQuickPointerDeviceHand Q_PROPERTY(qreal pointDistanceThreshold READ pointDistanceThreshold WRITE setPointDistanceThreshold NOTIFY pointDistanceThresholdChanged) public: - explicit QQuickMultiPointHandler(QObject *parent = 0, int minimumPointCount = 2); + explicit QQuickMultiPointHandler(QObject *parent = nullptr, int minimumPointCount = 2); ~QQuickMultiPointHandler(); int minimumPointCount() const { return m_minimumPointCount; } diff --git a/src/quick/handlers/qquickpinchhandler_p.h b/src/quick/handlers/qquickpinchhandler_p.h index 7d6b7d9509..9a17971416 100644 --- a/src/quick/handlers/qquickpinchhandler_p.h +++ b/src/quick/handlers/qquickpinchhandler_p.h @@ -82,7 +82,7 @@ public: }; Q_ENUM(PinchOrigin) - explicit QQuickPinchHandler(QObject *parent = 0); + explicit QQuickPinchHandler(QObject *parent = nullptr); ~QQuickPinchHandler(); qreal minimumScale() const { return m_minimumScale; } diff --git a/src/quick/handlers/qquickpointerdevicehandler_p.h b/src/quick/handlers/qquickpointerdevicehandler_p.h index 9e30fa0be4..1638604ea7 100644 --- a/src/quick/handlers/qquickpointerdevicehandler_p.h +++ b/src/quick/handlers/qquickpointerdevicehandler_p.h @@ -63,7 +63,7 @@ class Q_AUTOTEST_EXPORT QQuickPointerDeviceHandler : public QQuickPointerHandler Q_PROPERTY(Qt::KeyboardModifiers acceptedModifiers READ acceptedModifiers WRITE setAcceptedModifiers NOTIFY acceptedModifiersChanged) public: - explicit QQuickPointerDeviceHandler(QObject *parent = 0); + explicit QQuickPointerDeviceHandler(QObject *parent = nullptr); ~QQuickPointerDeviceHandler(); QQuickPointerDevice::DeviceTypes acceptedDevices() const { return m_acceptedDevices; } diff --git a/src/quick/handlers/qquickpointerhandler_p.h b/src/quick/handlers/qquickpointerhandler_p.h index 06a8248468..9ea6a8b5e2 100644 --- a/src/quick/handlers/qquickpointerhandler_p.h +++ b/src/quick/handlers/qquickpointerhandler_p.h @@ -72,7 +72,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerHandler : public QObject, public QQmlP Q_PROPERTY(GrabPermissions grabPermissions READ grabPermissions WRITE setGrabPermissions NOTIFY grabPermissionChanged) public: - explicit QQuickPointerHandler(QObject *parent = 0); + explicit QQuickPointerHandler(QObject *parent = nullptr); virtual ~QQuickPointerHandler(); enum GrabPermission { diff --git a/src/quick/handlers/qquicksinglepointhandler_p.h b/src/quick/handlers/qquicksinglepointhandler_p.h index 386cea253a..7606b4f7ba 100644 --- a/src/quick/handlers/qquicksinglepointhandler_p.h +++ b/src/quick/handlers/qquicksinglepointhandler_p.h @@ -111,7 +111,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickSinglePointHandler : public QQuickPointerDevi Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged) Q_PROPERTY(QQuickHandlerPoint point READ point NOTIFY pointChanged) public: - explicit QQuickSinglePointHandler(QObject *parent = 0); + explicit QQuickSinglePointHandler(QObject *parent = nullptr); virtual ~QQuickSinglePointHandler() { } Qt::MouseButtons acceptedButtons() const { return m_acceptedButtons; } diff --git a/src/quick/handlers/qquicktaphandler_p.h b/src/quick/handlers/qquicktaphandler_p.h index 6504ec87f0..e92d2029ba 100644 --- a/src/quick/handlers/qquicktaphandler_p.h +++ b/src/quick/handlers/qquicktaphandler_p.h @@ -75,7 +75,7 @@ public: }; Q_ENUM(GesturePolicy) - explicit QQuickTapHandler(QObject *parent = 0); + explicit QQuickTapHandler(QObject *parent = nullptr); ~QQuickTapHandler(); bool isPressed() const { return m_pressed; } diff --git a/src/quick/items/context2d/qquickcanvascontext_p.h b/src/quick/items/context2d/qquickcanvascontext_p.h index 0746b7dcd3..95100d2912 100644 --- a/src/quick/items/context2d/qquickcanvascontext_p.h +++ b/src/quick/items/context2d/qquickcanvascontext_p.h @@ -69,7 +69,7 @@ class QQuickCanvasContext : public QObject Q_OBJECT public: - QQuickCanvasContext(QObject *parent = 0); + QQuickCanvasContext(QObject *parent = nullptr); ~QQuickCanvasContext(); virtual QStringList contextNames() const = 0; diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp index 0739889e67..59917ce531 100644 --- a/src/quick/items/context2d/qquickcanvasitem.cpp +++ b/src/quick/items/context2d/qquickcanvasitem.cpp @@ -71,7 +71,7 @@ public: }; QQuickCanvasPixmap::QQuickCanvasPixmap(const QImage& image) - : m_pixmap(0) + : m_pixmap(nullptr) , m_image(image) { @@ -123,7 +123,7 @@ QHash<QQmlEngine *,QQuickContext2DRenderThread*> QQuickContext2DRenderThread::re QMutex QQuickContext2DRenderThread::renderThreadsMutex; QQuickContext2DRenderThread::QQuickContext2DRenderThread(QQmlEngine *eng) - : QThread(eng), m_engine(eng), m_eventLoopQuitHack(0) + : QThread(eng), m_engine(eng), m_eventLoopQuitHack(nullptr) { Q_ASSERT(eng); m_eventLoopQuitHack = new QObject; @@ -144,7 +144,7 @@ QQuickContext2DRenderThread::~QQuickContext2DRenderThread() QQuickContext2DRenderThread *QQuickContext2DRenderThread::instance(QQmlEngine *engine) { - QQuickContext2DRenderThread *thread = 0; + QQuickContext2DRenderThread *thread = nullptr; renderThreadsMutex.lock(); if (renderThreads.contains(engine)) thread = renderThreads.value(engine); @@ -183,7 +183,7 @@ public: QQuickCanvasItemPrivate::QQuickCanvasItemPrivate() : QQuickItemPrivate() - , context(0) + , context(nullptr) , canvasSize(1, 1) , tileSize(1, 1) , hasCanvasSize(false) @@ -192,9 +192,9 @@ QQuickCanvasItemPrivate::QQuickCanvasItemPrivate() , available(false) , renderTarget(QQuickCanvasItem::Image) , renderStrategy(QQuickCanvasItem::Immediate) - , textureProvider(0) - , node(0) - , nodeTexture(0) + , textureProvider(nullptr) + , node(nullptr) + , nodeTexture(nullptr) { implicitAntialiasing = true; } @@ -634,16 +634,16 @@ void QQuickCanvasItem::releaseResources() if (d->context) { delete d->context; - d->context = 0; + d->context = nullptr; } - d->node = 0; // managed by the scene graph, just reset the pointer + d->node = nullptr; // managed by the scene graph, just reset the pointer if (d->textureProvider) { QQuickWindowQObjectCleanupJob::schedule(window(), d->textureProvider); - d->textureProvider = 0; + d->textureProvider = nullptr; } if (d->nodeTexture) { QQuickWindowQObjectCleanupJob::schedule(window(), d->nodeTexture); - d->nodeTexture = 0; + d->nodeTexture = nullptr; } } @@ -663,12 +663,12 @@ void QQuickCanvasItem::invalidateSceneGraph() Q_D(QQuickCanvasItem); if (d->context) d->context->deleteLater(); - d->context = 0; - d->node = 0; // managed by the scene graph, just reset the pointer + d->context = nullptr; + d->node = nullptr; // managed by the scene graph, just reset the pointer delete d->textureProvider; - d->textureProvider = 0; + d->textureProvider = nullptr; delete d->nodeTexture; - d->nodeTexture = 0; + d->nodeTexture = nullptr; } void QQuickCanvasItem::schedulePolish() @@ -698,14 +698,14 @@ void QQuickCanvasItem::itemChange(QQuickItem::ItemChange change, const QQuickIte return; } - if (value.window== 0) + if (value.window== nullptr) return; d->window = value.window; QSGRenderContext *context = QQuickWindowPrivate::get(d->window)->context; // Rendering to FramebufferObject needs a valid OpenGL context. - if (context != 0 && (d->renderTarget != FramebufferObject || context->isValid())) { + if (context != nullptr && (d->renderTarget != FramebufferObject || context->isValid())) { // Defer the call. In some (arguably incorrect) cases we get here due // to ItemSceneChange with the user-supplied property values not yet // set. Work this around by a deferred invoke. (QTBUG-49692) @@ -763,11 +763,11 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData if (!d->context || d->canvasWindow.size().isEmpty()) { if (d->textureProvider) { - d->textureProvider->tex = 0; + d->textureProvider->tex = nullptr; d->textureProvider->fireTextureChanged(); } delete oldNode; - return 0; + return nullptr; } QSGInternalImageNode *node = static_cast<QSGInternalImageNode *>(oldNode); @@ -792,13 +792,13 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData QSGTexture *texture = factory->textureForNextFrame(d->nodeTexture, window()); if (!texture) { delete node; - d->node = 0; - d->nodeTexture = 0; + d->node = nullptr; + d->nodeTexture = nullptr; if (d->textureProvider) { - d->textureProvider->tex = 0; + d->textureProvider->tex = nullptr; d->textureProvider->fireTextureChanged(); } - return 0; + return nullptr; } d->nodeTexture = texture; @@ -833,7 +833,7 @@ QSGTextureProvider *QQuickCanvasItem::textureProvider() const if (!w || !w->isSceneGraphInitialized() || QThread::currentThread() != QQuickWindowPrivate::get(w)->context->thread()) { qWarning("QQuickCanvasItem::textureProvider: can only be queried on the rendering thread of an exposed window"); - return 0; + return nullptr; } #endif if (!d->textureProvider) @@ -879,7 +879,7 @@ void QQuickCanvasItem::getContext(QQmlV4Function *args) QString contextId = str->toQString(); - if (d->context != 0) { + if (d->context != nullptr) { if (d->context->contextNames().contains(contextId, Qt::CaseInsensitive)) { args->setReturnValue(d->context->v4value()); return; diff --git a/src/quick/items/context2d/qquickcanvasitem_p.h b/src/quick/items/context2d/qquickcanvasitem_p.h index 59de847680..7dc981a6eb 100644 --- a/src/quick/items/context2d/qquickcanvasitem_p.h +++ b/src/quick/items/context2d/qquickcanvasitem_p.h @@ -114,7 +114,7 @@ public: }; Q_ENUM(RenderStrategy) - QQuickCanvasItem(QQuickItem *parent = 0); + QQuickCanvasItem(QQuickItem *parent = nullptr); ~QQuickCanvasItem(); bool isAvailable() const; diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 434765aaa1..af8048f2e4 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -641,7 +641,7 @@ public: o->defineDefaultProperty(QStringLiteral("createLinearGradient"), method_createLinearGradient, 0); o->defineDefaultProperty(QStringLiteral("strokeRect"), method_strokeRect, 0); o->defineDefaultProperty(QStringLiteral("closePath"), method_closePath, 0); - o->defineAccessorProperty(QStringLiteral("canvas"), QQuickJSContext2DPrototype::method_get_canvas, 0); + o->defineAccessorProperty(QStringLiteral("canvas"), QQuickJSContext2DPrototype::method_get_canvas, nullptr); return o->d(); } @@ -943,9 +943,9 @@ void QV4::Heap::QQuickJSContext2DImageData::init() QV4::Scope scope(internalClass->engine); QV4::ScopedObject o(scope, this); - o->defineAccessorProperty(QStringLiteral("width"), ::QQuickJSContext2DImageData::method_get_width, 0); - o->defineAccessorProperty(QStringLiteral("height"), ::QQuickJSContext2DImageData::method_get_height, 0); - o->defineAccessorProperty(QStringLiteral("data"), ::QQuickJSContext2DImageData::method_get_data, 0); + o->defineAccessorProperty(QStringLiteral("width"), ::QQuickJSContext2DImageData::method_get_width, nullptr); + o->defineAccessorProperty(QStringLiteral("height"), ::QQuickJSContext2DImageData::method_get_height, nullptr); + o->defineAccessorProperty(QStringLiteral("data"), ::QQuickJSContext2DImageData::method_get_data, nullptr); } DEFINE_OBJECT_VTABLE(QQuickJSContext2DImageData); @@ -4051,10 +4051,10 @@ QMutex QQuickContext2D::mutex; QQuickContext2D::QQuickContext2D(QObject *parent) : QQuickCanvasContext(parent) , m_buffer(new QQuickContext2DCommandBuffer) - , m_v4engine(0) - , m_surface(0) - , m_glContext(0) - , m_thread(0) + , m_v4engine(nullptr) + , m_surface(nullptr) + , m_glContext(nullptr) + , m_thread(nullptr) , m_grabbed(false) { } @@ -4062,7 +4062,7 @@ QQuickContext2D::QQuickContext2D(QObject *parent) QQuickContext2D::~QQuickContext2D() { mutex.lock(); - m_texture->setItem(0); + m_texture->setItem(nullptr); delete m_buffer; if (m_renderTarget == QQuickCanvasItem::FramebufferObject) { @@ -4242,7 +4242,7 @@ QImage QQuickContext2D::toImage(const QRectF& bounds) } else { #if QT_CONFIG(opengl) QQuickWindow *window = m_canvas->window(); - QOpenGLContext *ctx = window ? window->openglContext() : 0; + QOpenGLContext *ctx = window ? window->openglContext() : nullptr; if (ctx && ctx->isValid()) { if (ctx == QOpenGLContext::currentContext()) { flush(); @@ -4310,7 +4310,7 @@ QQuickContext2DEngineData::QQuickContext2DEngineData(QV4::ExecutionEngine *v4) gradientProto = proto; proto = scope.engine->newObject(); - proto->defineAccessorProperty(scope.engine->id_length(), QQuickJSContext2DPixelData::proto_get_length, 0); + proto->defineAccessorProperty(scope.engine->id_length(), QQuickJSContext2DPixelData::proto_get_length, nullptr); pixelArrayProto = proto; } @@ -4394,7 +4394,7 @@ void QQuickContext2D::setV4Engine(QV4::ExecutionEngine *engine) if (m_v4engine != engine) { m_v4engine = engine; - if (m_v4engine == 0) + if (m_v4engine == nullptr) return; QQuickContext2DEngineData *ed = engineData(engine); diff --git a/src/quick/items/context2d/qquickcontext2d_p.h b/src/quick/items/context2d/qquickcontext2d_p.h index 334bf08329..4cc07027b1 100644 --- a/src/quick/items/context2d/qquickcontext2d_p.h +++ b/src/quick/items/context2d/qquickcontext2d_p.h @@ -181,7 +181,7 @@ public: QQuickContext2D::TextBaseLineType textBaseline; }; - QQuickContext2D(QObject *parent = 0); + QQuickContext2D(QObject *parent = nullptr); ~QQuickContext2D(); QStringList contextNames() const override; @@ -199,7 +199,7 @@ public: QQuickCanvasItem* canvas() const { return m_canvas; } QQuickContext2DCommandBuffer* buffer() const { return m_buffer; } - bool bufferValid() const { return m_buffer != 0; } + bool bufferValid() const { return m_buffer != nullptr; } void popState(); void pushState(); void reset(); diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp index a8bf14ba9f..69ff3b3852 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture.cpp +++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp @@ -93,12 +93,12 @@ struct GLAcquireContext { }; #endif QQuickContext2DTexture::QQuickContext2DTexture() - : m_context(0) + : m_context(nullptr) #if QT_CONFIG(opengl) - , m_gl(0) + , m_gl(nullptr) #endif - , m_surface(0) - , m_item(0) + , m_surface(nullptr) + , m_item(nullptr) , m_canvasDevicePixelRatio(1) , m_canvasWindowChanged(false) , m_dirtyTexture(false) @@ -159,7 +159,7 @@ void QQuickContext2DTexture::setItem(QQuickCanvasItem* item) m_context = (QQuickContext2D*) item->rawContext(); // FIXME m_state = m_context->state; } else { - m_context = 0; + m_context = nullptr; } } @@ -257,7 +257,7 @@ void QQuickContext2DTexture::paintWithoutTiles(QQuickContext2DCommandBuffer *ccb bool QQuickContext2DTexture::canvasDestroyed() { - return m_item == 0; + return m_item == nullptr; } void QQuickContext2DTexture::paint(QQuickContext2DCommandBuffer *ccb) @@ -349,7 +349,7 @@ QRect QQuickContext2DTexture::createTiles(const QRect& window) int ht = xx + h1; int vt = yy + v1; - QQuickContext2DTile* tile = 0; + QQuickContext2DTile* tile = nullptr; QPoint pos(ht * tw, vt * th); QRect rect(pos, m_tileSize); @@ -420,9 +420,9 @@ static inline QSize npotAdjustedSize(const QSize &size) QQuickContext2DFBOTexture::QQuickContext2DFBOTexture() : QQuickContext2DTexture() - , m_fbo(0) - , m_multisampledFbo(0) - , m_paint_device(0) + , m_fbo(nullptr) + , m_multisampledFbo(nullptr) + , m_paint_device(nullptr) { m_displayTextures[0] = 0; m_displayTextures[1] = 0; @@ -567,15 +567,15 @@ QPaintDevice* QQuickContext2DFBOTexture::beginPainting() delete m_fbo; delete m_multisampledFbo; delete m_paint_device; - m_fbo = 0; - m_multisampledFbo = 0; - m_paint_device = 0; - return 0; + m_fbo = nullptr; + m_multisampledFbo = nullptr; + m_paint_device = nullptr; + return nullptr; } else if (!m_fbo || m_canvasWindowChanged) { delete m_fbo; delete m_multisampledFbo; delete m_paint_device; - m_paint_device = 0; + m_paint_device = nullptr; m_fboSize = npotAdjustedSize(m_canvasWindow.size() * m_canvasDevicePixelRatio); m_canvasWindowChanged = false; @@ -722,7 +722,7 @@ QPaintDevice* QQuickContext2DImageTexture::beginPainting() QQuickContext2DTexture::beginPainting(); if (m_canvasWindow.size().isEmpty()) - return 0; + return nullptr; if (m_canvasWindowChanged) { diff --git a/src/quick/items/context2d/qquickcontext2dtexture_p.h b/src/quick/items/context2d/qquickcontext2dtexture_p.h index 0e1fbd5d34..9c4870f328 100644 --- a/src/quick/items/context2d/qquickcontext2dtexture_p.h +++ b/src/quick/items/context2d/qquickcontext2dtexture_p.h @@ -146,7 +146,7 @@ protected: virtual QVector2D scaleFactor() const { return QVector2D(1, 1); } void paintWithoutTiles(QQuickContext2DCommandBuffer *ccb); - virtual QPaintDevice* beginPainting() {m_painting = true; return 0; } + virtual QPaintDevice* beginPainting() {m_painting = true; return nullptr; } virtual void endPainting() {m_painting = false;} virtual QQuickContext2DTile* createTile() const = 0; virtual void compositeTile(QQuickContext2DTile* tile) = 0; diff --git a/src/quick/items/context2d/qquickcontext2dtile.cpp b/src/quick/items/context2d/qquickcontext2dtile.cpp index d31fee7f91..0ee3de6bcc 100644 --- a/src/quick/items/context2d/qquickcontext2dtile.cpp +++ b/src/quick/items/context2d/qquickcontext2dtile.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE QQuickContext2DTile::QQuickContext2DTile() : m_dirty(true) , m_rect(QRect(0, 0, 1, 1)) - , m_device(0) + , m_device(nullptr) { } @@ -95,12 +95,12 @@ QPainter* QQuickContext2DTile::createPainter(bool smooth, bool antialiasing) return &m_painter; } - return 0; + return nullptr; } #if QT_CONFIG(opengl) QQuickContext2DFBOTile::QQuickContext2DFBOTile() : QQuickContext2DTile() - , m_fbo(0) + , m_fbo(nullptr) { } diff --git a/src/quick/items/qquickaccessibleattached.cpp b/src/quick/items/qquickaccessibleattached.cpp index c559ee8887..252d6538e2 100644 --- a/src/quick/items/qquickaccessibleattached.cpp +++ b/src/quick/items/qquickaccessibleattached.cpp @@ -410,7 +410,7 @@ void QQuickAccessibleAttached::setIgnored(bool ignored) bool QQuickAccessibleAttached::doAction(const QString &actionName) { - QMetaMethod *sig = 0; + QMetaMethod *sig = nullptr; if (actionName == QAccessibleActionInterface::pressAction()) sig = &sigPress; else if (actionName == QAccessibleActionInterface::toggleAction()) diff --git a/src/quick/items/qquickanchors.cpp b/src/quick/items/qquickanchors.cpp index 4367e230bc..8ee4229013 100644 --- a/src/quick/items/qquickanchors.cpp +++ b/src/quick/items/qquickanchors.cpp @@ -252,35 +252,35 @@ void QQuickAnchorsPrivate::clearItem(QQuickItem *item) if (!item) return; if (fill == item) - fill = 0; + fill = nullptr; if (centerIn == item) - centerIn = 0; + centerIn = nullptr; if (leftAnchorItem == item) { - leftAnchorItem = 0; + leftAnchorItem = nullptr; usedAnchors &= ~QQuickAnchors::LeftAnchor; } if (rightAnchorItem == item) { - rightAnchorItem = 0; + rightAnchorItem = nullptr; usedAnchors &= ~QQuickAnchors::RightAnchor; } if (topAnchorItem == item) { - topAnchorItem = 0; + topAnchorItem = nullptr; usedAnchors &= ~QQuickAnchors::TopAnchor; } if (bottomAnchorItem == item) { - bottomAnchorItem = 0; + bottomAnchorItem = nullptr; usedAnchors &= ~QQuickAnchors::BottomAnchor; } if (vCenterAnchorItem == item) { - vCenterAnchorItem = 0; + vCenterAnchorItem = nullptr; usedAnchors &= ~QQuickAnchors::VCenterAnchor; } if (hCenterAnchorItem == item) { - hCenterAnchorItem = 0; + hCenterAnchorItem = nullptr; usedAnchors &= ~QQuickAnchors::HCenterAnchor; } if (baselineAnchorItem == item) { - baselineAnchorItem = 0; + baselineAnchorItem = nullptr; usedAnchors &= ~QQuickAnchors::BaselineAnchor; } } @@ -462,7 +462,7 @@ void QQuickAnchorsPrivate::updateOnComplete() std::sort(dependencies, dependencies + 9); - QQuickItem *lastDependency = 0; + QQuickItem *lastDependency = nullptr; for (int i = 0; i < 9; ++i) { QQuickItem *dependency = dependencies[i]; if (lastDependency != dependency) { @@ -542,7 +542,7 @@ void QQuickAnchors::setFill(QQuickItem *f) void QQuickAnchors::resetFill() { - setFill(0); + setFill(nullptr); } QQuickItem *QQuickAnchors::centerIn() const @@ -578,7 +578,7 @@ void QQuickAnchors::setCenterIn(QQuickItem* c) void QQuickAnchors::resetCenterIn() { - setCenterIn(0); + setCenterIn(nullptr); } bool QQuickAnchorsPrivate::calcStretch(QQuickItem *edge1Item, diff --git a/src/quick/items/qquickanchors_p.h b/src/quick/items/qquickanchors_p.h index bc1e6c10f5..bf83867abb 100644 --- a/src/quick/items/qquickanchors_p.h +++ b/src/quick/items/qquickanchors_p.h @@ -86,7 +86,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickAnchors : public QObject Q_PROPERTY(bool alignWhenCentered READ alignWhenCentered WRITE setAlignWhenCentered NOTIFY centerAlignedChanged) public: - QQuickAnchors(QQuickItem *item, QObject *parent=0); + QQuickAnchors(QQuickItem *item, QObject *parent=nullptr); virtual ~QQuickAnchors(); enum Anchor diff --git a/src/quick/items/qquickanchors_p_p.h b/src/quick/items/qquickanchors_p_p.h index ae6ca02786..0a834276ae 100644 --- a/src/quick/items/qquickanchors_p_p.h +++ b/src/quick/items/qquickanchors_p_p.h @@ -60,15 +60,15 @@ QT_BEGIN_NAMESPACE class QQuickAnchorLine { public: - QQuickAnchorLine() : item(0), anchorLine(QQuickAnchors::InvalidAnchor) {} + QQuickAnchorLine() {} QQuickAnchorLine(QQuickItem *i, QQuickAnchors::Anchor l) : item(i), anchorLine(l) {} QQuickAnchorLine(QQuickItem *i, uint l) : item(i) , anchorLine(static_cast<QQuickAnchors::Anchor>(l)) { Q_ASSERT(l < ((QQuickAnchors::BaselineAnchor << 1) - 1)); } - QQuickItem *item; - QQuickAnchors::Anchor anchorLine; + QQuickItem *item = nullptr; + QQuickAnchors::Anchor anchorLine = QQuickAnchors::InvalidAnchor; }; inline bool operator==(const QQuickAnchorLine& a, const QQuickAnchorLine& b) diff --git a/src/quick/items/qquickanimatedimage.cpp b/src/quick/items/qquickanimatedimage.cpp index 5c9f893b63..26dfdb07a6 100644 --- a/src/quick/items/qquickanimatedimage.cpp +++ b/src/quick/items/qquickanimatedimage.cpp @@ -55,12 +55,12 @@ QT_BEGIN_NAMESPACE QQuickPixmap* QQuickAnimatedImagePrivate::infoForCurrentFrame(QQmlEngine *engine) { if (!movie) - return 0; + return nullptr; int current = movie->currentFrameNumber(); if (!frameMap.contains(current)) { QUrl requestedUrl; - QQuickPixmap *pixmap = 0; + QQuickPixmap *pixmap = nullptr; if (engine && !movie->fileName().isEmpty()) { requestedUrl.setUrl(QString::fromUtf8("quickanimatedimage://%1#%2") .arg(movie->fileName()) @@ -295,7 +295,7 @@ void QQuickAnimatedImage::setSource(const QUrl &url) #if QT_CONFIG(qml_network) if (d->reply) { d->reply->deleteLater(); - d->reply = 0; + d->reply = nullptr; } #endif diff --git a/src/quick/items/qquickanimatedimage_p.h b/src/quick/items/qquickanimatedimage_p.h index 678907a6e2..6b5db215bd 100644 --- a/src/quick/items/qquickanimatedimage_p.h +++ b/src/quick/items/qquickanimatedimage_p.h @@ -76,7 +76,7 @@ class Q_AUTOTEST_EXPORT QQuickAnimatedImage : public QQuickImage Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged) public: - QQuickAnimatedImage(QQuickItem *parent=0); + QQuickAnimatedImage(QQuickItem *parent=nullptr); ~QQuickAnimatedImage(); bool isPlaying() const; diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp index 58eb81fbbd..5234ee65cb 100644 --- a/src/quick/items/qquickanimatedsprite.cpp +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -105,7 +105,7 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty int QtQuick::AnimatedSprite::frameDuration - Duration of each frame of the animation. Values equal to or below 0 are invalid. + Duration of each frame of the animation in milliseconds. Values equal to or below 0 are invalid. If frameRate is valid then it will be used to calculate the duration of the frames. If not, and frameDuration is valid, then frameDuration will be used. @@ -220,7 +220,6 @@ QT_BEGIN_NAMESPACE \l loops property is set to \c AnimatedSprite.Infinite. */ -//TODO: Implicitly size element to size of sprite QQuickAnimatedSprite::QQuickAnimatedSprite(QQuickItem *parent) : QQuickItem(*(new QQuickAnimatedSpritePrivate), parent) { @@ -526,6 +525,7 @@ void QQuickAnimatedSprite::setFrameHeight(int arg) if (d->m_sprite->m_frameHeight != arg) { d->m_sprite->setFrameHeight(arg); Q_EMIT frameHeightChanged(arg); + setImplicitHeight(frameHeight()); reloadImage(); } } @@ -537,6 +537,7 @@ void QQuickAnimatedSprite::setFrameWidth(int arg) if (d->m_sprite->m_frameWidth != arg) { d->m_sprite->setFrameWidth(arg); Q_EMIT frameWidthChanged(arg); + setImplicitWidth(frameWidth()); reloadImage(); } } @@ -651,6 +652,17 @@ QSGSpriteNode* QQuickAnimatedSprite::initNode() if (image.isNull()) return nullptr; + // If frameWidth or frameHeight are not explicitly set, frameWidth + // will be set to the width of the image divided by the number of frames, + // and frameHeight will be set to the height of the image. + // In this case, QQuickAnimatedSprite currently won't emit frameWidth/HeightChanged + // at all, so we have to do this here, as it's the only place where assembledImage() + // is called (which calculates the "implicit" frameWidth/Height. + // In addition, currently the "implicit" frameWidth/Height are only calculated once, + // even after changing to a different source. + setImplicitWidth(frameWidth()); + setImplicitHeight(frameHeight()); + QSGSpriteNode *node = d->sceneGraphContext()->createSpriteNode(); d->m_sheetSize = QSize(image.size()); diff --git a/src/quick/items/qquickanimatedsprite_p.h b/src/quick/items/qquickanimatedsprite_p.h index f2e52947cd..ff59591c9f 100644 --- a/src/quick/items/qquickanimatedsprite_p.h +++ b/src/quick/items/qquickanimatedsprite_p.h @@ -94,7 +94,7 @@ class Q_AUTOTEST_EXPORT QQuickAnimatedSprite : public QQuickItem Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY currentFrameChanged) public: - explicit QQuickAnimatedSprite(QQuickItem *parent = 0); + explicit QQuickAnimatedSprite(QQuickItem *parent = nullptr); enum LoopParameters { Infinite = -1 }; diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp index 75e3a3dbed..4bf34f0417 100644 --- a/src/quick/items/qquickborderimage.cpp +++ b/src/quick/items/qquickborderimage.cpp @@ -278,7 +278,7 @@ void QQuickBorderImage::setSource(const QUrl &url) #if QT_CONFIG(qml_network) if (d->sciReply) { d->sciReply->deleteLater(); - d->sciReply = 0; + d->sciReply = nullptr; } #endif @@ -559,12 +559,12 @@ void QQuickBorderImage::sciRequestFinished() if (d->sciReply->error() != QNetworkReply::NoError) { d->status = Error; d->sciReply->deleteLater(); - d->sciReply = 0; + d->sciReply = nullptr; emit statusChanged(d->status); } else { QQuickGridScaledImage sci(d->sciReply); d->sciReply->deleteLater(); - d->sciReply = 0; + d->sciReply = nullptr; setGridScaledImage(sci); } } @@ -629,7 +629,7 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat if (!texture || width() <= 0 || height() <= 0) { delete oldNode; - return 0; + return nullptr; } QSGInternalImageNode *node = static_cast<QSGInternalImageNode *>(oldNode); diff --git a/src/quick/items/qquickborderimage_p.h b/src/quick/items/qquickborderimage_p.h index f43e6c8e1e..61bd26ba83 100644 --- a/src/quick/items/qquickborderimage_p.h +++ b/src/quick/items/qquickborderimage_p.h @@ -69,7 +69,7 @@ class Q_AUTOTEST_EXPORT QQuickBorderImage : public QQuickImageBase Q_PROPERTY(QSize sourceSize READ sourceSize NOTIFY sourceSizeChanged) public: - QQuickBorderImage(QQuickItem *parent=0); + QQuickBorderImage(QQuickItem *parent=nullptr); ~QQuickBorderImage(); QQuickScaleGrid *border(); diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index 6dc005a03c..d377b1dad4 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -67,8 +67,8 @@ public: return static_cast<QQuickDragAttachedPrivate *>(QObjectPrivate::get(attached)); } QQuickDragAttachedPrivate() - : attachedItem(0) - , mimeData(0) + : attachedItem(nullptr) + , mimeData(nullptr) , proposedAction(Qt::MoveAction) , supportedActions(Qt::MoveAction | Qt::CopyAction | Qt::LinkAction) , active(false) @@ -231,7 +231,7 @@ void QQuickDragAttachedPrivate::deliverLeaveEvent() if (window) { QDragLeaveEvent event; deliverEvent(window, &event); - window = 0; + window = nullptr; } } @@ -686,7 +686,7 @@ int QQuickDragAttached::drop() return acceptedAction; d->active = false; - QObject *target = 0; + QObject *target = nullptr; if (d->window) { QPoint scenePos = d->attachedItem->mapToScene(d->hotSpot).toPoint(); @@ -732,7 +732,7 @@ void QQuickDragAttached::cancel() d->deliverLeaveEvent(); if (d->target) { - d->target = 0; + d->target = nullptr; emit targetChanged(); } @@ -783,7 +783,7 @@ Qt::DropAction QQuickDragAttachedPrivate::startDrag(Qt::DropActions supportedAct deliverLeaveEvent(); if (target) { - target = 0; + target = nullptr; emit q->targetChanged(); } @@ -836,7 +836,7 @@ void QQuickDragAttached::startDrag(QQmlV4Function *args) } QQuickDrag::QQuickDrag(QObject *parent) -: QObject(parent), _target(0), _axis(XAndYAxis), _xmin(-FLT_MAX), +: QObject(parent), _target(nullptr), _axis(XAndYAxis), _xmin(-FLT_MAX), _xmax(FLT_MAX), _ymin(-FLT_MAX), _ymax(FLT_MAX), _active(false), _filterChildren(false), _smoothed(true), _threshold(QGuiApplication::styleHints()->startDragDistance()) { @@ -861,9 +861,9 @@ void QQuickDrag::setTarget(QQuickItem *t) void QQuickDrag::resetTarget() { - if (_target == 0) + if (_target == nullptr) return; - _target = 0; + _target = nullptr; emit targetChanged(); } diff --git a/src/quick/items/qquickdrag_p.h b/src/quick/items/qquickdrag_p.h index 17e9d8c690..6bfbae74c9 100644 --- a/src/quick/items/qquickdrag_p.h +++ b/src/quick/items/qquickdrag_p.h @@ -83,7 +83,7 @@ class QQuickDragGrabber typedef QIntrusiveList<Item, &Item::node> ItemList; public: - QQuickDragGrabber() : m_target(0) {} + QQuickDragGrabber() : m_target(nullptr) {} ~QQuickDragGrabber() { while (!m_items.isEmpty()) delete m_items.first(); } @@ -94,10 +94,10 @@ public: else if (!m_items.isEmpty()) return *m_items.first(); else - return 0; + return nullptr; } void setTarget(QObject *target) { m_target = target; } - void resetTarget() { m_target = 0; } + void resetTarget() { m_target = nullptr; } bool isEmpty() const { return m_items.isEmpty(); } @@ -136,7 +136,7 @@ class QQuickDragMimeData : public QMimeData Q_OBJECT public: QQuickDragMimeData() - : m_source(0) + : m_source(nullptr) { } @@ -173,7 +173,7 @@ class Q_AUTOTEST_EXPORT QQuickDrag : public QObject //### consider drag and drop public: - QQuickDrag(QObject *parent=0); + QQuickDrag(QObject *parent=nullptr); ~QQuickDrag(); enum DragType { None, Automatic, Internal }; diff --git a/src/quick/items/qquickdroparea.cpp b/src/quick/items/qquickdroparea.cpp index c7606f90e1..b77fb40cb1 100644 --- a/src/quick/items/qquickdroparea.cpp +++ b/src/quick/items/qquickdroparea.cpp @@ -78,7 +78,7 @@ public: }; QQuickDropAreaPrivate::QQuickDropAreaPrivate() - : drag(0) + : drag(nullptr) , containsDrag(false) { } @@ -303,7 +303,7 @@ void QQuickDropArea::dragLeaveEvent(QDragLeaveEvent *) emit exited(); d->containsDrag = false; - d->source = 0; + d->source = nullptr; emit containsDragChanged(); if (d->drag) emit d->drag->sourceChanged(); @@ -328,7 +328,7 @@ void QQuickDropArea::dropEvent(QDropEvent *event) emit dropped(&dragTargetEvent); d->containsDrag = false; - d->source = 0; + d->source = nullptr; emit containsDragChanged(); if (d->drag) emit d->drag->sourceChanged(); diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index 0f7e44e0e2..e430832fe7 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -84,7 +84,7 @@ class QQuickKeyEvent : public QObject public: QQuickKeyEvent() - : event(QEvent::None, 0, 0) + : event(QEvent::None, 0, nullptr) {} void reset(QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, @@ -135,14 +135,14 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseEvent : public QObject public: QQuickMouseEvent() - : _x(0), _y(0), _button(Qt::NoButton), _buttons(Qt::NoButton), _modifiers(Qt::NoModifier) - , _source(Qt::MouseEventNotSynthesized), _wasHeld(false), _isClick(false), _accepted(false) - , _flags(Qt::MouseEventFlags(0)) + : _buttons(Qt::NoButton), _modifiers(Qt::NoModifier) + , _wasHeld(false), _isClick(false), _accepted(false) + , _flags(Qt::MouseEventFlags(nullptr)) {} void reset(qreal x, qreal y, Qt::MouseButton button, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, bool isClick = false, bool wasHeld = false, - Qt::MouseEventFlags flags = 0) + Qt::MouseEventFlags flags = nullptr) { _x = x; _y = y; @@ -175,12 +175,12 @@ public: void setAccepted(bool accepted) { _accepted = accepted; } int flags() const { return _flags; } private: - qreal _x; - qreal _y; - Qt::MouseButton _button; + qreal _x = 0; + qreal _y = 0; + Qt::MouseButton _button = Qt::NoButton; Qt::MouseButtons _buttons; Qt::KeyboardModifiers _modifiers; - Qt::MouseEventSource _source; + Qt::MouseEventSource _source = Qt::MouseEventNotSynthesized; bool _wasHeld : 1; bool _isClick : 1; bool _accepted : 1; @@ -201,8 +201,7 @@ class QQuickWheelEvent : public QObject public: QQuickWheelEvent() - : _x(0), _y(0), _buttons(Qt::NoButton), _modifiers(Qt::NoModifier) - , _inverted(false), _accepted(false) + : _buttons(Qt::NoButton), _modifiers(Qt::NoModifier) {} void reset(qreal x, qreal y, const QPoint &angleDelta, const QPoint &pixelDelta, @@ -229,14 +228,14 @@ public: void setAccepted(bool accepted) { _accepted = accepted; } private: - qreal _x; - qreal _y; + qreal _x = 0; + qreal _y = 0; QPoint _angleDelta; QPoint _pixelDelta; Qt::MouseButtons _buttons; Qt::KeyboardModifiers _modifiers; - bool _inverted; - bool _accepted; + bool _inverted = false; + bool _accepted = false; }; class Q_QUICK_PRIVATE_EXPORT QQuickCloseEvent : public QObject @@ -245,14 +244,13 @@ class Q_QUICK_PRIVATE_EXPORT QQuickCloseEvent : public QObject Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted) public: - QQuickCloseEvent() - : _accepted(true) {} + QQuickCloseEvent() {} bool isAccepted() { return _accepted; } void setAccepted(bool accepted) { _accepted = accepted; } private: - bool _accepted; + bool _accepted = true; }; class Q_QUICK_PRIVATE_EXPORT QQuickEventPoint : public QObject @@ -394,10 +392,8 @@ public: QQuickPointerEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QObject(parent) , m_device(device) - , m_event(nullptr) - , m_button(Qt::NoButton) , m_pressedButtons(Qt::NoButton) - { } + {} virtual ~QQuickPointerEvent(); @@ -441,8 +437,8 @@ public: // helpers for C++ only (during event delivery) protected: QQuickPointerDevice *m_device; - QInputEvent *m_event; // original event as received by QQuickWindow - Qt::MouseButton m_button; + QInputEvent *m_event = nullptr; // original event as received by QQuickWindow + Qt::MouseButton m_button = Qt::NoButton; Qt::MouseButtons m_pressedButtons; Q_DISABLE_COPY(QQuickPointerEvent) @@ -487,9 +483,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerTouchEvent : public QQuickPointerEvent public: QQuickPointerTouchEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QQuickPointerEvent(parent, device) - , m_pointCount(0) , m_synthMouseEvent(QEvent::MouseMove, QPointF(), Qt::NoButton, Qt::NoButton, Qt::NoModifier) - { } + {} QQuickPointerEvent *reset(QEvent *) override; void localize(QQuickItem *target) override; @@ -515,7 +510,7 @@ public: QTouchEvent *asTouchEvent() const; private: - int m_pointCount; + int m_pointCount = 0; QVector<QQuickEventTouchPoint *> m_touchPoints; mutable QMouseEvent m_synthMouseEvent; diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 95d1229c8d..8cb64377cc 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -172,13 +172,13 @@ class QQuickFlickableReboundTransition : public QQuickTransitionManager { public: QQuickFlickableReboundTransition(QQuickFlickable *f, const QString &name) - : flickable(f), axisData(0), propName(name), active(false) + : flickable(f), axisData(nullptr), propName(name), active(false) { } ~QQuickFlickableReboundTransition() { - flickable = 0; + flickable = nullptr; } bool startTransition(QQuickFlickablePrivate::AxisData *data, qreal toPos) { @@ -252,12 +252,12 @@ QQuickFlickablePrivate::QQuickFlickablePrivate() , lastPressTime(0) , deceleration(QML_FLICK_DEFAULTDECELERATION) , maxVelocity(QML_FLICK_DEFAULTMAXVELOCITY), reportedVelocitySmoothing(100) - , delayedPressEvent(0), pressDelay(0), fixupDuration(400) - , flickBoost(1.0), fixupMode(Normal), vTime(0), visibleArea(0) + , delayedPressEvent(nullptr), pressDelay(0), fixupDuration(400) + , flickBoost(1.0), fixupMode(Normal), vTime(0), visibleArea(nullptr) , flickableDirection(QQuickFlickable::AutoFlickDirection) , boundsBehavior(QQuickFlickable::DragAndOvershootBounds) , boundsMovement(QQuickFlickable::FollowBoundsBehavior) - , rebound(0) + , rebound(nullptr) { } @@ -317,7 +317,7 @@ void QQuickFlickablePrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometr { Q_Q(QQuickFlickable); if (item == contentItem) { - Qt::Orientations orient = 0; + Qt::Orientations orient = nullptr; if (change.xChange()) orient |= Qt::Horizontal; if (change.yChange()) @@ -1555,7 +1555,7 @@ void QQuickFlickablePrivate::clearDelayedPress() if (delayedPressEvent) { delayedPressTimer.stop(); delete delayedPressEvent; - delayedPressEvent = 0; + delayedPressEvent = nullptr; } } @@ -1565,7 +1565,7 @@ void QQuickFlickablePrivate::replayDelayedPress() if (delayedPressEvent) { // Losing the grab will clear the delayed press event; take control of it here QScopedPointer<QMouseEvent> mouseEvent(delayedPressEvent); - delayedPressEvent = 0; + delayedPressEvent = nullptr; delayedPressTimer.stop(); // If we have the grab, release before delivering the event @@ -1858,7 +1858,7 @@ int QQuickFlickablePrivate::data_count(QQmlListProperty<QObject> *) QObject *QQuickFlickablePrivate::data_at(QQmlListProperty<QObject> *, int) { // XXX todo - return 0; + return nullptr; } void QQuickFlickablePrivate::data_clear(QQmlListProperty<QObject> *) diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h index 4ad01323a4..939e3af698 100644 --- a/src/quick/items/qquickflickable_p.h +++ b/src/quick/items/qquickflickable_p.h @@ -115,7 +115,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickFlickable : public QQuickItem Q_CLASSINFO("DefaultProperty", "flickableData") public: - QQuickFlickable(QQuickItem *parent=0); + QQuickFlickable(QQuickItem *parent=nullptr); ~QQuickFlickable(); QQmlListProperty<QObject> flickableData(); diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h index c2531e6012..08f069e830 100644 --- a/src/quick/items/qquickflickable_p_p.h +++ b/src/quick/items/qquickflickable_p_p.h @@ -99,7 +99,7 @@ public: struct AxisData { AxisData(QQuickFlickablePrivate *fp, void (QQuickFlickablePrivate::*func)(qreal)) : move(fp, func) - , transitionToBounds(0) + , transitionToBounds(nullptr) , viewSize(-1), lastPos(0), previousDragDelta(0), velocity(0), startMargin(0), endMargin(0) , origin(0), overshoot(0) , transitionTo(0) @@ -284,7 +284,7 @@ class QQuickFlickableVisibleArea : public QObject Q_PROPERTY(qreal heightRatio READ heightRatio NOTIFY heightRatioChanged) public: - QQuickFlickableVisibleArea(QQuickFlickable *parent=0); + QQuickFlickableVisibleArea(QQuickFlickable *parent=nullptr); qreal xPosition() const; qreal widthRatio() const; diff --git a/src/quick/items/qquickflipable.cpp b/src/quick/items/qquickflipable.cpp index 4273ed4881..fbba8eed89 100644 --- a/src/quick/items/qquickflipable.cpp +++ b/src/quick/items/qquickflipable.cpp @@ -68,7 +68,7 @@ class QQuickFlipablePrivate : public QQuickItemPrivate { Q_DECLARE_PUBLIC(QQuickFlipable) public: - QQuickFlipablePrivate() : current(QQuickFlipable::Front), front(0), back(0), sideDirty(false) {} + QQuickFlipablePrivate() : current(QQuickFlipable::Front), front(nullptr), back(nullptr), sideDirty(false) {} void transformChanged() override; void updateSide(); @@ -178,7 +178,7 @@ void QQuickFlipable::setBack(QQuickItem *back) qmlWarning(this) << tr("back is a write-once property"); return; } - if (back == 0) + if (back == nullptr) return; d->back = back; d->back->setParentItem(this); diff --git a/src/quick/items/qquickflipable_p.h b/src/quick/items/qquickflipable_p.h index ec922725ef..d70cd02d35 100644 --- a/src/quick/items/qquickflipable_p.h +++ b/src/quick/items/qquickflipable_p.h @@ -74,7 +74,7 @@ class Q_AUTOTEST_EXPORT QQuickFlipable : public QQuickItem //### flipAxis //### flipRotation public: - QQuickFlipable(QQuickItem *parent=0); + QQuickFlipable(QQuickItem *parent=nullptr); ~QQuickFlipable(); QQuickItem *front() const; diff --git a/src/quick/items/qquickfocusscope_p.h b/src/quick/items/qquickfocusscope_p.h index b65e543343..af750fc127 100644 --- a/src/quick/items/qquickfocusscope_p.h +++ b/src/quick/items/qquickfocusscope_p.h @@ -59,7 +59,7 @@ class Q_AUTOTEST_EXPORT QQuickFocusScope : public QQuickItem { Q_OBJECT public: - QQuickFocusScope(QQuickItem *parent=0); + QQuickFocusScope(QQuickItem *parent=nullptr); virtual ~QQuickFocusScope(); }; diff --git a/src/quick/items/qquickframebufferobject.cpp b/src/quick/items/qquickframebufferobject.cpp index 9b133a823e..48f8b8db5c 100644 --- a/src/quick/items/qquickframebufferobject.cpp +++ b/src/quick/items/qquickframebufferobject.cpp @@ -57,7 +57,7 @@ public: QQuickFramebufferObjectPrivate() : followsItemSize(true) , mirrorVertically(false) - , node(0) + , node(nullptr) { } @@ -194,10 +194,10 @@ class QSGFramebufferObjectNode : public QSGTextureProvider, public QSGSimpleText public: QSGFramebufferObjectNode() - : window(0) - , fbo(0) - , msDisplayFbo(0) - , renderer(0) + : window(nullptr) + , fbo(nullptr) + , msDisplayFbo(nullptr) + , renderer(nullptr) , renderPending(true) , invalidatePending(false) , devicePixelRatio(1) @@ -282,13 +282,13 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode // that easily so with this logic, the renderer only goes away when // the scenegraph is invalidated or it is removed from the scene. if (!n && (width() <= 0 || height() <= 0)) - return 0; + return nullptr; Q_D(QQuickFramebufferObject); if (!n) { if (!isOpenGL(d->sceneGraphRenderContext())) - return 0; + return nullptr; if (!d->node) d->node = new QSGFramebufferObjectNode; n = d->node; @@ -315,9 +315,9 @@ QSGNode *QQuickFramebufferObject::updatePaintNode(QSGNode *node, UpdatePaintNode if (n->fbo && ((d->followsItemSize && n->fbo->size() != desiredFboSize) || n->invalidatePending)) { delete n->texture(); delete n->fbo; - n->fbo = 0; + n->fbo = nullptr; delete n->msDisplayFbo; - n->msDisplayFbo = 0; + n->msDisplayFbo = nullptr; n->invalidatePending = false; } @@ -368,10 +368,10 @@ QSGTextureProvider *QQuickFramebufferObject::textureProvider() const QQuickWindow *w = window(); if (!w || !w->openglContext() || QThread::currentThread() != w->openglContext()->thread()) { qWarning("QQuickFramebufferObject::textureProvider: can only be queried on the rendering thread of an exposed window"); - return 0; + return nullptr; } if (!isOpenGL(d->sceneGraphRenderContext())) - return 0; + return nullptr; if (!d->node) d->node = new QSGFramebufferObjectNode; return d->node; @@ -386,13 +386,13 @@ void QQuickFramebufferObject::releaseResources() // forget about the node. Since it is the node we returned from updatePaintNode // it will be managed by the scene graph. Q_D(QQuickFramebufferObject); - d->node = 0; + d->node = nullptr; } void QQuickFramebufferObject::invalidateSceneGraph() { Q_D(QQuickFramebufferObject); - d->node = 0; + d->node = nullptr; } /*! @@ -411,7 +411,7 @@ void QQuickFramebufferObject::invalidateSceneGraph() * GUI thread is blocked. */ QQuickFramebufferObject::Renderer::Renderer() - : data(0) + : data(nullptr) { } @@ -439,7 +439,7 @@ QQuickFramebufferObject::Renderer::~Renderer() */ QOpenGLFramebufferObject *QQuickFramebufferObject::Renderer::framebufferObject() const { - return data ? ((QSGFramebufferObjectNode *) data)->fbo : 0; + return data ? ((QSGFramebufferObjectNode *) data)->fbo : nullptr; } /*! diff --git a/src/quick/items/qquickgenericshadereffect.cpp b/src/quick/items/qquickgenericshadereffect.cpp index 305ef7e778..248c2b6ec3 100644 --- a/src/quick/items/qquickgenericshadereffect.cpp +++ b/src/quick/items/qquickgenericshadereffect.cpp @@ -61,7 +61,7 @@ QQuickGenericShaderEffect::QQuickGenericShaderEffect(QQuickShaderEffect *item, Q , m_mgr(nullptr) , m_fragNeedsUpdate(true) , m_vertNeedsUpdate(true) - , m_dirty(0) + , m_dirty(nullptr) { qRegisterMetaType<QSGGuiThreadShaderEffectManager::ShaderInfo::Type>("ShaderInfo::Type"); for (int i = 0; i < NShader; ++i) @@ -134,7 +134,7 @@ void QQuickGenericShaderEffect::setMesh(const QVariant &mesh) return; if (m_mesh) - disconnect(m_mesh, SIGNAL(geometryChanged()), this, 0); + disconnect(m_mesh, SIGNAL(geometryChanged()), this, nullptr); m_mesh = newMesh; @@ -290,7 +290,7 @@ QSGNode *QQuickGenericShaderEffect::handleUpdatePaintNode(QSGNode *oldNode, QQui m_dirty &= ~QSGShaderEffectNode::DirtyShaderGeometry; } - m_dirty = 0; + m_dirty = nullptr; for (int i = 0; i < NShader; ++i) { m_dirtyConstants[i].clear(); m_dirtyTextures[i].clear(); diff --git a/src/quick/items/qquickgenericshadereffect_p.h b/src/quick/items/qquickgenericshadereffect_p.h index ab19816493..3f6f92921b 100644 --- a/src/quick/items/qquickgenericshadereffect_p.h +++ b/src/quick/items/qquickgenericshadereffect_p.h @@ -66,7 +66,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGenericShaderEffect : public QObject Q_OBJECT public: - QQuickGenericShaderEffect(QQuickShaderEffect *item, QObject *parent = 0); + QQuickGenericShaderEffect(QQuickShaderEffect *item, QObject *parent = nullptr); ~QQuickGenericShaderEffect(); QByteArray fragmentShader() const { return m_fragShader; } diff --git a/src/quick/items/qquickgraphicsinfo.cpp b/src/quick/items/qquickgraphicsinfo.cpp index a36133874b..e809bdd827 100644 --- a/src/quick/items/qquickgraphicsinfo.cpp +++ b/src/quick/items/qquickgraphicsinfo.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE QQuickGraphicsInfo::QQuickGraphicsInfo(QQuickItem *item) : QObject(item) - , m_window(0) + , m_window(nullptr) , m_api(Unknown) , m_shaderType(UnknownShadingLanguage) , m_shaderCompilationType(ShaderCompilationType(0)) diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp index b2adf96f0e..1f5cda9d18 100644 --- a/src/quick/items/qquickgridview.cpp +++ b/src/quick/items/qquickgridview.cpp @@ -230,7 +230,7 @@ public: : flow(QQuickGridView::FlowLeftToRight) , cellWidth(100), cellHeight(100), columns(1) , snapMode(QQuickGridView::NoSnap) - , highlightXAnimator(0), highlightYAnimator(0) + , highlightXAnimator(nullptr), highlightYAnimator(nullptr) {} ~QQuickGridViewPrivate() { @@ -390,7 +390,7 @@ FxViewItem *QQuickGridViewPrivate::snapItemAt(qreal pos) const if (itemTop+rowSize()/2 >= pos && itemTop - rowSize()/2 <= pos) return item; } - return 0; + return nullptr; } int QQuickGridViewPrivate::snapIndex() const @@ -508,7 +508,7 @@ bool QQuickGridViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal } int colNum = qFloor((colPos+colSize()/2) / colSize()); - FxGridItemSG *item = 0; + FxGridItemSG *item = nullptr; bool changed = false; QQmlIncubator::IncubationMode incubationMode = doBuffer ? QQmlIncubator::Asynchronous : QQmlIncubator::AsynchronousIfNested; @@ -580,7 +580,7 @@ void QQuickGridViewPrivate::removeItem(FxViewItem *item) bool QQuickGridViewPrivate::removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) { - FxGridItemSG *item = 0; + FxGridItemSG *item = nullptr; bool changed = false; while (visibleItems.count() > 1 @@ -700,14 +700,14 @@ void QQuickGridViewPrivate::createHighlight() bool changed = false; if (highlight) { if (trackedItem == highlight) - trackedItem = 0; + trackedItem = nullptr; delete highlight; - highlight = 0; + highlight = nullptr; delete highlightXAnimator; delete highlightYAnimator; - highlightXAnimator = 0; - highlightYAnimator = 0; + highlightXAnimator = nullptr; + highlightYAnimator = nullptr; changed = true; } @@ -2410,7 +2410,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } else { while (i >= 0) { // item is before first visible e.g. in cache buffer - FxViewItem *item = 0; + FxViewItem *item = nullptr; if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i)))) item->index = modelIndex + i; if (!item) @@ -2462,7 +2462,7 @@ bool QQuickGridViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch int i = 0; int to = buffer+displayMarginEnd+tempPos+size()-1; while (i < count && rowPos <= to + rowSize()*(columns - colNum)/qreal(columns+1)) { - FxViewItem *item = 0; + FxViewItem *item = nullptr; if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i)))) item->index = modelIndex + i; bool newItem = !item; diff --git a/src/quick/items/qquickgridview_p.h b/src/quick/items/qquickgridview_p.h index 5c6da2b433..7daeaf41a1 100644 --- a/src/quick/items/qquickgridview_p.h +++ b/src/quick/items/qquickgridview_p.h @@ -81,7 +81,7 @@ public: }; Q_ENUM(Flow) - QQuickGridView(QQuickItem *parent=0); + QQuickGridView(QQuickItem *parent=nullptr); ~QQuickGridView(); void setHighlightFollowsCurrentItem(bool) override; diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index 7e13e5e0e1..dc2cd17b4e 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -57,7 +57,7 @@ class QQuickImageTextureProvider : public QSGTextureProvider Q_OBJECT public: QQuickImageTextureProvider() - : m_texture(0) + : m_texture(nullptr) , m_smooth(false) { } @@ -97,7 +97,7 @@ QQuickImagePrivate::QQuickImagePrivate() , mipmap(false) , hAlign(QQuickImage::AlignHCenter) , vAlign(QQuickImage::AlignVCenter) - , provider(0) + , provider(nullptr) { } @@ -583,7 +583,7 @@ QSGTextureProvider *QQuickImage::textureProvider() const if (!d->window || !d->sceneGraphRenderContext() || QThread::currentThread() != d->sceneGraphRenderContext()->thread()) { qWarning("QQuickImage::textureProvider: can only be queried on the rendering thread of an exposed window"); - return 0; + return nullptr; } if (!d->provider) { @@ -601,7 +601,7 @@ void QQuickImage::invalidateSceneGraph() { Q_D(QQuickImage); delete d->provider; - d->provider = 0; + d->provider = nullptr; } void QQuickImage::releaseResources() @@ -609,7 +609,7 @@ void QQuickImage::releaseResources() Q_D(QQuickImage); if (d->provider) { QQuickWindowQObjectCleanupJob::schedule(window(), d->provider); - d->provider = 0; + d->provider = nullptr; } } @@ -628,7 +628,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) if (!texture || width() <= 0 || height() <= 0) { delete oldNode; - return 0; + return nullptr; } QSGInternalImageNode *node = static_cast<QSGInternalImageNode *>(oldNode); @@ -736,7 +736,7 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) || nsrect.isEmpty() || !qt_is_finite(nsrect.width()) || !qt_is_finite(nsrect.height())) { delete node; - return 0; + return nullptr; } if (d->pixmapChanged) { diff --git a/src/quick/items/qquickimage_p.h b/src/quick/items/qquickimage_p.h index 09b2c1eeb7..7fb4413900 100644 --- a/src/quick/items/qquickimage_p.h +++ b/src/quick/items/qquickimage_p.h @@ -70,7 +70,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickImage : public QQuickImageBase Q_PROPERTY(bool autoTransform READ autoTransform WRITE setAutoTransform NOTIFY autoTransformChanged REVISION 2) public: - QQuickImage(QQuickItem *parent=0); + QQuickImage(QQuickItem *parent=nullptr); ~QQuickImage(); enum HAlignment { AlignLeft = Qt::AlignLeft, diff --git a/src/quick/items/qquickimagebase_p.h b/src/quick/items/qquickimagebase_p.h index 4d4a6fceaf..eb04a1d162 100644 --- a/src/quick/items/qquickimagebase_p.h +++ b/src/quick/items/qquickimagebase_p.h @@ -70,7 +70,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickImageBase : public QQuickImplicitSizeItem Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged) public: - QQuickImageBase(QQuickItem *parent=0); + QQuickImageBase(QQuickItem *parent=nullptr); ~QQuickImageBase(); enum Status { Null, Ready, Loading, Error }; Q_ENUM(Status) diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 18e0d30ed5..3a88c49e8d 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -89,7 +89,7 @@ Q_DECLARE_LOGGING_CATEGORY(DBG_MOUSE_TARGET) Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE) Q_DECLARE_LOGGING_CATEGORY(lcTransient) -void debugFocusTree(QQuickItem *item, QQuickItem *scope = 0, int depth = 1) +void debugFocusTree(QQuickItem *item, QQuickItem *scope = nullptr, int depth = 1) { if (DBG_FOCUS().isEnabled(QtDebugMsg)) { qCDebug(DBG_FOCUS) @@ -303,9 +303,9 @@ void QQuickContents::itemChildAdded(QQuickItem *, QQuickItem *item) } QQuickItemKeyFilter::QQuickItemKeyFilter(QQuickItem *item) -: m_processPost(false), m_next(0) +: m_processPost(false), m_next(nullptr) { - QQuickItemPrivate *p = item?QQuickItemPrivate::get(item):0; + QQuickItemPrivate *p = item?QQuickItemPrivate::get(item):nullptr; if (p) { m_next = p->extra.value().keyHandler; p->extra->keyHandler = this; @@ -786,7 +786,7 @@ const SigMap sigMap[] = { { Qt::Key_Menu, "menuPressed" }, { Qt::Key_VolumeUp, "volumeUpPressed" }, { Qt::Key_VolumeDown, "volumeDownPressed" }, - { 0, 0 } + { 0, nullptr } }; QByteArray QQuickKeysAttached::keyToSignal(int key) @@ -1570,7 +1570,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) */ -QQuickLayoutMirroringAttached::QQuickLayoutMirroringAttached(QObject *parent) : QObject(parent), itemPrivate(0) +QQuickLayoutMirroringAttached::QQuickLayoutMirroringAttached(QObject *parent) : QObject(parent), itemPrivate(nullptr) { if (QQuickItem *item = qobject_cast<QQuickItem *>(parent)) itemPrivate = QQuickItemPrivate::get(item); @@ -1724,7 +1724,7 @@ void QQuickItemPrivate::setLayoutMirror(bool mirror) */ QQuickEnterKeyAttached::QQuickEnterKeyAttached(QObject *parent) - : QObject(parent), itemPrivate(0), keyType(Qt::EnterKeyDefault) + : QObject(parent), itemPrivate(nullptr), keyType(Qt::EnterKeyDefault) { if (QQuickItem *item = qobject_cast<QQuickItem*>(parent)) { itemPrivate = QQuickItemPrivate::get(item); @@ -1777,7 +1777,7 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) if (oldSubFocusItem) { QQuickItem *sfi = scopePrivate->subFocusItem->parentItem(); while (sfi && sfi != scope) { - QQuickItemPrivate::get(sfi)->subFocusItem = 0; + QQuickItemPrivate::get(sfi)->subFocusItem = nullptr; sfi = sfi->parentItem(); } } @@ -1790,7 +1790,7 @@ void QQuickItemPrivate::updateSubFocusItem(QQuickItem *scope, bool focus) sfi = sfi->parentItem(); } } else { - scopePrivate->subFocusItem = 0; + scopePrivate->subFocusItem = nullptr; } } @@ -2375,13 +2375,13 @@ QQuickItem::~QQuickItem() if (d->windowRefCount > 1) d->windowRefCount = 1; // Make sure window is set to null in next call to derefWindow(). if (d->parentItem) - setParentItem(0); + setParentItem(nullptr); else if (d->window) d->derefWindow(); // XXX todo - optimize while (!d->childItems.isEmpty()) - d->childItems.constFirst()->setParentItem(0); + d->childItems.constFirst()->setParentItem(nullptr); if (!d->changeListeners.isEmpty()) { const auto listeners = d->changeListeners; // NOTE: intentional copy (QTBUG-54732) @@ -2421,14 +2421,14 @@ QQuickItem::~QQuickItem() } if (d->extra.isAllocated()) { - delete d->extra->contents; d->extra->contents = 0; + delete d->extra->contents; d->extra->contents = nullptr; #if QT_CONFIG(quick_shadereffect) - delete d->extra->layer; d->extra->layer = 0; + delete d->extra->layer; d->extra->layer = nullptr; #endif } - delete d->_anchors; d->_anchors = 0; - delete d->_stateGroup; d->_stateGroup = 0; + delete d->_anchors; d->_anchors = nullptr; + delete d->_stateGroup; d->_stateGroup = nullptr; } /*! @@ -2543,7 +2543,7 @@ QQuickItem* QQuickItemPrivate::nextPrevItemInTabFocusChain(QQuickItem *item, boo bool all = QGuiApplication::styleHints()->tabFocusBehavior() == Qt::TabFocusAllControls; - QQuickItem *from = 0; + QQuickItem *from = nullptr; bool isTabFence = item->d_func()->isTabFence; if (forward) { if (!isTabFence) @@ -2678,7 +2678,7 @@ void QQuickItem::setParentItem(QQuickItem *parentItem) if (parentItem) { QQuickItem *itemAncestor = parentItem; - while (itemAncestor != 0) { + while (itemAncestor != nullptr) { if (Q_UNLIKELY(itemAncestor == this)) { qWarning() << "QQuickItem::setParentItem: Parent" << parentItem << "is already part of the subtree of" << this; return; @@ -2690,12 +2690,12 @@ void QQuickItem::setParentItem(QQuickItem *parentItem) d->removeFromDirtyList(); QQuickItem *oldParentItem = d->parentItem; - QQuickItem *scopeFocusedItem = 0; + QQuickItem *scopeFocusedItem = nullptr; if (oldParentItem) { QQuickItemPrivate *op = QQuickItemPrivate::get(oldParentItem); - QQuickItem *scopeItem = 0; + QQuickItem *scopeItem = nullptr; if (hasFocus() || op->subFocusItem == this) scopeFocusedItem = this; @@ -2725,7 +2725,7 @@ void QQuickItem::setParentItem(QQuickItem *parentItem) QQuickWindowPrivate::get(d->window)->parentlessItems.remove(this); } - QQuickWindow *parentWindow = parentItem ? QQuickItemPrivate::get(parentItem)->window : 0; + QQuickWindow *parentWindow = parentItem ? QQuickItemPrivate::get(parentItem)->window : nullptr; if (d->window == parentWindow) { // Avoid freeing and reallocating resources if the window stays the same. d->parentItem = parentItem; @@ -2745,7 +2745,7 @@ void QQuickItem::setParentItem(QQuickItem *parentItem) QQuickWindowPrivate::get(d->window)->parentlessItems.insert(this); d->setEffectiveVisibleRecur(d->calcEffectiveVisible()); - d->setEffectiveEnableRecur(0, d->calcEffectiveEnable()); + d->setEffectiveEnableRecur(nullptr, d->calcEffectiveEnable()); if (d->parentItem) { if (!scopeFocusedItem) { @@ -2995,7 +2995,7 @@ void QQuickItemPrivate::refWindow(QQuickWindow *c) // derefWindow() decrements the reference count. Q_Q(QQuickItem); - Q_ASSERT((window != 0) == (windowRefCount > 0)); + Q_ASSERT((window != nullptr) == (windowRefCount > 0)); Q_ASSERT(c); if (++windowRefCount > 1) { if (c != window) @@ -3003,7 +3003,7 @@ void QQuickItemPrivate::refWindow(QQuickWindow *c) return; // Window already set. } - Q_ASSERT(window == 0); + Q_ASSERT(window == nullptr); window = c; if (polishScheduled) @@ -3027,7 +3027,7 @@ void QQuickItemPrivate::refWindow(QQuickWindow *c) void QQuickItemPrivate::derefWindow() { Q_Q(QQuickItem); - Q_ASSERT((window != 0) == (windowRefCount > 0)); + Q_ASSERT((window != nullptr) == (windowRefCount > 0)); if (!window) return; // This can happen when destroying recursive shader effect sources. @@ -3043,7 +3043,7 @@ void QQuickItemPrivate::derefWindow() c->removeGrabber(q); #if QT_CONFIG(cursor) if (c->cursorItem == q) { - c->cursorItem = 0; + c->cursorItem = nullptr; window->unsetCursor(); } #endif @@ -3053,17 +3053,17 @@ void QQuickItemPrivate::derefWindow() if (!parentItem) c->parentlessItems.remove(q); - window = 0; + window = nullptr; - itemNodeInstance = 0; + itemNodeInstance = nullptr; if (extra.isAllocated()) { - extra->opacityNode = 0; - extra->clipNode = 0; - extra->rootNode = 0; + extra->opacityNode = nullptr; + extra->clipNode = nullptr; + extra->rootNode = nullptr; } - paintNode = 0; + paintNode = nullptr; for (int ii = 0; ii < childItems.count(); ++ii) { QQuickItem *child = childItems.at(ii); @@ -3073,8 +3073,8 @@ void QQuickItemPrivate::derefWindow() dirty(Window); if (extra.isAllocated() && extra->screenAttached) - extra->screenAttached->windowChanged(0); - itemChange(QQuickItem::ItemSceneChange, (QQuickWindow *)0); + extra->screenAttached->windowChanged(nullptr); + itemChange(QQuickItem::ItemSceneChange, (QQuickWindow *)nullptr); } @@ -3160,8 +3160,8 @@ bool QQuickItem::isComponentComplete() const } QQuickItemPrivate::QQuickItemPrivate() - : _anchors(0) - , _stateGroup(0) + : _anchors(nullptr) + , _stateGroup(nullptr) , flags(0) , widthValid(false) , heightValid(false) @@ -3202,13 +3202,13 @@ QQuickItemPrivate::QQuickItemPrivate() , touchEnabled(false) #endif , dirtyAttributes(0) - , nextDirtyItem(0) - , prevDirtyItem(0) - , window(0) + , nextDirtyItem(nullptr) + , prevDirtyItem(nullptr) + , window(nullptr) , windowRefCount(0) - , parentItem(0) + , parentItem(nullptr) , sortedChildItems(&childItems) - , subFocusItem(0) + , subFocusItem(nullptr) , x(0) , y(0) , width(0) @@ -3216,8 +3216,8 @@ QQuickItemPrivate::QQuickItemPrivate() , implicitWidth(0) , implicitHeight(0) , baselineOffset(0) - , itemNodeInstance(0) - , paintNode(0) + , itemNodeInstance(nullptr) + , paintNode(nullptr) { } @@ -3342,7 +3342,7 @@ QObject *QQuickItemPrivate::data_at(QQmlListProperty<QObject> *property, int i) const int j = i - resourcesCount; if (j < children_count(&childrenProperty)) return children_at(&childrenProperty, j); - return 0; + return nullptr; } void QQuickItemPrivate::data_clear(QQmlListProperty<QObject> *property) @@ -3396,7 +3396,7 @@ QQuickItem *QQuickItemPrivate::children_at(QQmlListProperty<QQuickItem> *prop, i { QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object)); if (index >= p->childItems.count() || index < 0) - return 0; + return nullptr; else return p->childItems.at(index); } @@ -3408,7 +3408,7 @@ void QQuickItemPrivate::children_append(QQmlListProperty<QQuickItem> *prop, QQui QQuickItem *that = static_cast<QQuickItem *>(prop->object); if (o->parentItem() == that) - o->setParentItem(0); + o->setParentItem(nullptr); o->setParentItem(that); } @@ -3424,7 +3424,7 @@ void QQuickItemPrivate::children_clear(QQmlListProperty<QQuickItem> *prop) QQuickItem *that = static_cast<QQuickItem *>(prop->object); QQuickItemPrivate *p = QQuickItemPrivate::get(that); while (!p->childItems.isEmpty()) - p->childItems.at(0)->setParentItem(0); + p->childItems.at(0)->setParentItem(nullptr); } int QQuickItemPrivate::visibleChildren_count(QQmlListProperty<QQuickItem> *prop) @@ -3444,14 +3444,14 @@ QQuickItem *QQuickItemPrivate::visibleChildren_at(QQmlListProperty<QQuickItem> * QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object)); const int childCount = p->childItems.count(); if (index >= childCount || index < 0) - return 0; + return nullptr; int visibleCount = -1; for (int i = 0; i < childCount; i++) { if (p->childItems.at(i)->isVisible()) visibleCount++; if (visibleCount == index) return p->childItems.at(i); } - return 0; + return nullptr; } int QQuickItemPrivate::transform_count(QQmlListProperty<QQuickTransform> *prop) @@ -3515,7 +3515,7 @@ QQuickTransform *QQuickItemPrivate::transform_at(QQmlListProperty<QQuickTransfor QQuickItemPrivate *p = QQuickItemPrivate::get(that); if (idx < 0 || idx >= p->transforms.count()) - return 0; + return nullptr; else return p->transforms.at(idx); } @@ -3662,7 +3662,7 @@ void QQuickItemPrivate::siblingOrderChanged() QQmlListProperty<QObject> QQuickItemPrivate::data() { - return QQmlListProperty<QObject>(q_func(), 0, QQuickItemPrivate::data_append, + return QQmlListProperty<QObject>(q_func(), nullptr, QQuickItemPrivate::data_append, QQuickItemPrivate::data_count, QQuickItemPrivate::data_at, QQuickItemPrivate::data_clear); @@ -3841,11 +3841,11 @@ QSGNode *QQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *upda { Q_UNUSED(updatePaintNodeData) delete oldNode; - return 0; + return nullptr; } QQuickItem::UpdatePaintNodeData::UpdatePaintNodeData() -: transformNode(0) +: transformNode(nullptr) { } @@ -4410,7 +4410,7 @@ void QQuickItem::mapFromItem(QQmlV4Function *args) const QV4::Scope scope(v4); QV4::ScopedValue item(scope, (*args)[0]); - QQuickItem *itemObj = 0; + QQuickItem *itemObj = nullptr; if (!item->isNull()) { QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>()); if (qobjectWrapper) @@ -4498,7 +4498,7 @@ void QQuickItem::mapToItem(QQmlV4Function *args) const QV4::Scope scope(v4); QV4::ScopedValue item(scope, (*args)[0]); - QQuickItem *itemObj = 0; + QQuickItem *itemObj = nullptr; if (!item->isNull()) { QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, item->as<QV4::QObjectWrapper>()); if (qobjectWrapper) @@ -4731,12 +4731,12 @@ QQuickItem *QQuickItem::childAt(qreal x, qreal y) const && child->height() > point.y()) return child; } - return 0; + return nullptr; } QQmlListProperty<QObject> QQuickItemPrivate::resources() { - return QQmlListProperty<QObject>(q_func(), 0, QQuickItemPrivate::resources_append, + return QQmlListProperty<QObject>(q_func(), nullptr, QQuickItemPrivate::resources_append, QQuickItemPrivate::resources_count, QQuickItemPrivate::resources_at, QQuickItemPrivate::resources_clear); @@ -4761,7 +4761,7 @@ QQmlListProperty<QObject> QQuickItemPrivate::resources() */ QQmlListProperty<QQuickItem> QQuickItemPrivate::children() { - return QQmlListProperty<QQuickItem>(q_func(), 0, QQuickItemPrivate::children_append, + return QQmlListProperty<QQuickItem>(q_func(), nullptr, QQuickItemPrivate::children_append, QQuickItemPrivate::children_count, QQuickItemPrivate::children_at, QQuickItemPrivate::children_clear); @@ -4781,7 +4781,7 @@ QQmlListProperty<QQuickItem> QQuickItemPrivate::children() QQmlListProperty<QQuickItem> QQuickItemPrivate::visibleChildren() { return QQmlListProperty<QQuickItem>(q_func(), - 0, + nullptr, QQuickItemPrivate::visibleChildren_count, QQuickItemPrivate::visibleChildren_at); @@ -4931,7 +4931,7 @@ void QQuickItem::setState(const QString &state) */ QQmlListProperty<QQuickTransform> QQuickItem::transform() { - return QQmlListProperty<QQuickTransform>(this, 0, QQuickItemPrivate::transform_append, + return QQmlListProperty<QQuickTransform>(this, nullptr, QQuickItemPrivate::transform_append, QQuickItemPrivate::transform_count, QQuickItemPrivate::transform_at, QQuickItemPrivate::transform_clear); @@ -6065,8 +6065,8 @@ void QQuickItemPrivate::removeFromDirtyList() if (prevDirtyItem) { if (nextDirtyItem) QQuickItemPrivate::get(nextDirtyItem)->prevDirtyItem = prevDirtyItem; *prevDirtyItem = nextDirtyItem; - prevDirtyItem = 0; - nextDirtyItem = 0; + prevDirtyItem = nullptr; + nextDirtyItem = nullptr; } Q_ASSERT(!prevDirtyItem); Q_ASSERT(!nextDirtyItem); @@ -7135,7 +7135,7 @@ QQuickItem *QQuickItem::scopedFocusItem() const { Q_D(const QQuickItem); if (!isFocusScope()) - return 0; + return nullptr; else return d->subFocusItem; } @@ -8056,7 +8056,7 @@ QSGTextureProvider *QQuickItem::textureProvider() const #if QT_CONFIG(quick_shadereffect) Q_D(const QQuickItem); return d->extra.isAllocated() && d->extra->layer && d->extra->layer->effectSource() ? - d->extra->layer->effectSource()->textureProvider() : 0; + d->extra->layer->effectSource()->textureProvider() : nullptr; #else return 0; #endif @@ -8095,9 +8095,9 @@ QQuickItemLayer::QQuickItemLayer(QQuickItem *item) , m_wrapMode(QQuickShaderEffectSource::ClampToEdge) , m_format(QQuickShaderEffectSource::RGBA) , m_name("source") - , m_effectComponent(0) - , m_effect(0) - , m_effectSource(0) + , m_effectComponent(nullptr) + , m_effect(nullptr) + , m_effectSource(nullptr) , m_textureMirroring(QQuickShaderEffectSource::MirrorVertically) , m_samples(0) { @@ -8198,7 +8198,7 @@ void QQuickItemLayer::deactivate() deactivateEffect(); delete m_effectSource; - m_effectSource = 0; + m_effectSource = nullptr; QQuickItemPrivate *id = QQuickItemPrivate::get(m_item); id->removeItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Opacity | QQuickItemPrivate::Parent | QQuickItemPrivate::Visibility | QQuickItemPrivate::SiblingOrder); @@ -8235,7 +8235,7 @@ void QQuickItemLayer::deactivateEffect() Q_ASSERT(m_effectComponent); delete m_effect; - m_effect = 0; + m_effect = nullptr; } @@ -8543,7 +8543,7 @@ void QQuickItemLayer::itemParentChanged(QQuickItem *item, QQuickItem *parent) Q_UNUSED(item) Q_ASSERT(item == m_item); Q_ASSERT(parent != m_effectSource); - Q_ASSERT(parent == 0 || parent != m_effect); + Q_ASSERT(parent == nullptr || parent != m_effect); m_effectSource->setParentItem(parent); if (parent) @@ -8615,16 +8615,16 @@ void QQuickItemLayer::updateMatrix() QQuickItemPrivate::ExtraData::ExtraData() : z(0), scale(1), rotation(0), opacity(1), - contents(0), screenAttached(0), layoutDirectionAttached(0), - enterKeyAttached(0), - keyHandler(0), + contents(nullptr), screenAttached(nullptr), layoutDirectionAttached(nullptr), + enterKeyAttached(nullptr), + keyHandler(nullptr), #if QT_CONFIG(quick_shadereffect) - layer(0), + layer(nullptr), #endif effectRefCount(0), hideRefCount(0), recursiveEffectRefCount(0), - opacityNode(0), clipNode(0), rootNode(0), - acceptedMouseButtons(0), origin(QQuickItem::Center), + opacityNode(nullptr), clipNode(nullptr), rootNode(nullptr), + acceptedMouseButtons(nullptr), origin(QQuickItem::Center), transparentForPositioner(false) { } diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index ee854bb2ac..1a3be437af 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -97,7 +97,7 @@ public: QRectF rectF() const { return m_contents; } - inline void calcGeometry(QQuickItem *changed = 0); + inline void calcGeometry(QQuickItem *changed = nullptr); void complete(); protected: @@ -108,8 +108,8 @@ protected: //void itemVisibilityChanged(QQuickItem *item) private: - bool calcHeight(QQuickItem *changed = 0); - bool calcWidth(QQuickItem *changed = 0); + bool calcHeight(QQuickItem *changed = nullptr); + bool calcWidth(QQuickItem *changed = nullptr); void updateRect(); QQuickItem *m_item; @@ -330,7 +330,7 @@ public: Q_DECLARE_FLAGS(ChangeTypes, ChangeType) struct ChangeListener { - ChangeListener(QQuickItemChangeListener *l = nullptr, QQuickItemPrivate::ChangeTypes t = 0) : listener(l), types(t), gTypes(QQuickGeometryChange::All) {} + ChangeListener(QQuickItemChangeListener *l = nullptr, QQuickItemPrivate::ChangeTypes t = nullptr) : listener(l), types(t), gTypes(QQuickGeometryChange::All) {} ChangeListener(QQuickItemChangeListener *l, QQuickGeometryChange gt) : listener(l), types(Geometry), gTypes(gt) {} QQuickItemChangeListener *listener; QQuickItemPrivate::ChangeTypes types; @@ -605,9 +605,9 @@ public: - (rootNode) (shader effect source's root node) */ - QSGOpacityNode *opacityNode() const { return extra.isAllocated()?extra->opacityNode:0; } - QQuickDefaultClipNode *clipNode() const { return extra.isAllocated()?extra->clipNode:0; } - QSGRootNode *rootNode() const { return extra.isAllocated()?extra->rootNode:0; } + QSGOpacityNode *opacityNode() const { return extra.isAllocated()?extra->opacityNode:nullptr; } + QQuickDefaultClipNode *clipNode() const { return extra.isAllocated()?extra->clipNode:nullptr; } + QSGRootNode *rootNode() const { return extra.isAllocated()?extra->rootNode:nullptr; } QSGTransformNode *itemNodeInstance; QSGNode *paintNode; @@ -639,7 +639,7 @@ public: class QQuickItemKeyFilter { public: - QQuickItemKeyFilter(QQuickItem * = 0); + QQuickItemKeyFilter(QQuickItem * = nullptr); virtual ~QQuickItemKeyFilter(); virtual void keyPressed(QKeyEvent *event, bool post); @@ -661,17 +661,15 @@ class QQuickKeyNavigationAttachedPrivate : public QObjectPrivate { public: QQuickKeyNavigationAttachedPrivate() - : QObjectPrivate(), - left(0), right(0), up(0), down(0), tab(0), backtab(0), - leftSet(false), rightSet(false), upSet(false), downSet(false), + : leftSet(false), rightSet(false), upSet(false), downSet(false), tabSet(false), backtabSet(false) {} - QQuickItem *left; - QQuickItem *right; - QQuickItem *up; - QQuickItem *down; - QQuickItem *tab; - QQuickItem *backtab; + QQuickItem *left = nullptr; + QQuickItem *right = nullptr; + QQuickItem *up = nullptr; + QQuickItem *down = nullptr; + QQuickItem *tab = nullptr; + QQuickItem *backtab = nullptr; bool leftSet : 1; bool rightSet : 1; bool upSet : 1; @@ -694,7 +692,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickKeyNavigationAttached : public QObject, publi Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) public: - QQuickKeyNavigationAttached(QObject * = 0); + QQuickKeyNavigationAttached(QObject * = nullptr); QQuickItem *left() const; void setLeft(QQuickItem *); @@ -739,7 +737,7 @@ class QQuickLayoutMirroringAttached : public QObject Q_PROPERTY(bool childrenInherit READ childrenInherit WRITE setChildrenInherit NOTIFY childrenInheritChanged) public: - explicit QQuickLayoutMirroringAttached(QObject *parent = 0); + explicit QQuickLayoutMirroringAttached(QObject *parent = nullptr); bool enabled() const; void setEnabled(bool); @@ -782,8 +780,7 @@ class QQuickKeysAttachedPrivate : public QObjectPrivate { public: QQuickKeysAttachedPrivate() - : QObjectPrivate(), inPress(false), inRelease(false) - , inIM(false), enabled(true), imeItem(0), item(0) + : inPress(false), inRelease(false), inIM(false), enabled(true) {} //loop detection @@ -793,9 +790,9 @@ public: bool enabled : 1; - QQuickItem *imeItem; + QQuickItem *imeItem = nullptr; QList<QQuickItem *> targets; - QQuickItem *item; + QQuickItem *item = nullptr; QQuickKeyEvent theKeyEvent; }; @@ -809,7 +806,7 @@ class QQuickKeysAttached : public QObject, public QQuickItemKeyFilter Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged) public: - QQuickKeysAttached(QObject *parent=0); + QQuickKeysAttached(QObject *parent=nullptr); ~QQuickKeysAttached(); bool enabled() const { Q_D(const QQuickKeysAttached); return d->enabled; } @@ -898,7 +895,7 @@ private: Qt::MouseButtons QQuickItemPrivate::acceptedMouseButtons() const { return ((extra.flag() ? Qt::LeftButton : Qt::MouseButton(0)) | - (extra.isAllocated() ? extra->acceptedMouseButtons : Qt::MouseButtons(0))); + (extra.isAllocated() ? extra->acceptedMouseButtons : Qt::MouseButtons(nullptr))); } QSGContext *QQuickItemPrivate::sceneGraphContext() const @@ -920,7 +917,7 @@ void QQuickItemPrivate::markSortedChildrenDirty(QQuickItem *child) if (child->z() != 0. || sortedChildItems != &childItems) { if (sortedChildItems != &childItems) delete sortedChildItems; - sortedChildItems = 0; + sortedChildItems = nullptr; } } diff --git a/src/quick/items/qquickitemanimation.cpp b/src/quick/items/qquickitemanimation.cpp index 4b5c81b4d4..e913e5ba05 100644 --- a/src/quick/items/qquickitemanimation.cpp +++ b/src/quick/items/qquickitemanimation.cpp @@ -371,7 +371,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act if (data->actions.count()) { QSequentialAnimationGroupJob *topLevelGroup = new QSequentialAnimationGroupJob; - QActionAnimation *viaAction = d->via ? new QActionAnimation : 0; + QActionAnimation *viaAction = d->via ? new QActionAnimation : nullptr; QActionAnimation *targetAction = new QActionAnimation; //we'll assume the common case by far is to have children, and always create ag QParallelAnimationGroupJob *ag = new QParallelAnimationGroupJob; @@ -409,7 +409,7 @@ QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &act delete data; delete viaData; } - return 0; + return nullptr; } /*! @@ -922,12 +922,12 @@ QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actio pa->setEasingCurve(d->easingCurve); return initInstance(pa); } else { - pa->setFromSourcedValue(0); - pa->setAnimValue(0); + pa->setFromSourcedValue(nullptr); + pa->setAnimValue(nullptr); delete pa; delete data; } - return 0; + return nullptr; } void QQuickPathAnimationUpdater::setValue(qreal v) @@ -955,7 +955,7 @@ void QQuickPathAnimationUpdater::setValue(qreal v) qreal angle; bool fixed = orientation == QQuickPathAnimation::Fixed; - QPointF currentPos = !painterPath.isEmpty() ? path->sequentialPointAt(painterPath, pathLength, attributePoints, prevBez, v, fixed ? 0 : &angle) : path->sequentialPointAt(v, fixed ? 0 : &angle); + QPointF currentPos = !painterPath.isEmpty() ? path->sequentialPointAt(painterPath, pathLength, attributePoints, prevBez, v, fixed ? nullptr : &angle) : path->sequentialPointAt(v, fixed ? nullptr : &angle); //adjust position according to anchor point if (!anchorPoint.isNull()) { diff --git a/src/quick/items/qquickitemanimation_p.h b/src/quick/items/qquickitemanimation_p.h index 3b3fad9cc4..b803455f12 100644 --- a/src/quick/items/qquickitemanimation_p.h +++ b/src/quick/items/qquickitemanimation_p.h @@ -68,7 +68,7 @@ class Q_AUTOTEST_EXPORT QQuickParentAnimation : public QQuickAnimationGroup Q_PROPERTY(QQuickItem *via READ via WRITE setVia NOTIFY viaChanged) public: - QQuickParentAnimation(QObject *parent=0); + QQuickParentAnimation(QObject *parent=nullptr); virtual ~QQuickParentAnimation(); QQuickItem *target() const; @@ -89,7 +89,7 @@ protected: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; }; class QQuickAnchorAnimationPrivate; @@ -102,7 +102,7 @@ class Q_AUTOTEST_EXPORT QQuickAnchorAnimation : public QQuickAbstractAnimation Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing NOTIFY easingChanged) public: - QQuickAnchorAnimation(QObject *parent=0); + QQuickAnchorAnimation(QObject *parent=nullptr); virtual ~QQuickAnchorAnimation(); QQmlListProperty<QQuickItem> targets(); @@ -121,7 +121,7 @@ protected: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; }; #if QT_CONFIG(quick_path) @@ -145,7 +145,7 @@ class Q_AUTOTEST_EXPORT QQuickPathAnimation : public QQuickAbstractAnimation Q_PROPERTY(qreal endRotation READ endRotation WRITE setEndRotation NOTIFY endRotationChanged) public: - QQuickPathAnimation(QObject *parent=0); + QQuickPathAnimation(QObject *parent=nullptr); virtual ~QQuickPathAnimation(); enum Orientation { @@ -188,7 +188,7 @@ protected: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; Q_SIGNALS: void durationChanged(int); void easingChanged(const QEasingCurve &); diff --git a/src/quick/items/qquickitemanimation_p_p.h b/src/quick/items/qquickitemanimation_p_p.h index 2d075dfab3..83b9899197 100644 --- a/src/quick/items/qquickitemanimation_p_p.h +++ b/src/quick/items/qquickitemanimation_p_p.h @@ -65,7 +65,7 @@ class QQuickParentAnimationPrivate : public QQuickAnimationGroupPrivate Q_DECLARE_PUBLIC(QQuickParentAnimation) public: QQuickParentAnimationPrivate() - : QQuickAnimationGroupPrivate(), target(0), newParent(0), via(0) {} + : QQuickAnimationGroupPrivate(), target(nullptr), newParent(nullptr), via(nullptr) {} QQuickItem *target; QQuickItem *newParent; @@ -91,7 +91,7 @@ public: class QQuickPathAnimationUpdater : public QQuickBulkValueUpdater { public: - QQuickPathAnimationUpdater() : path(0), pathLength(0), target(0), reverse(false), + QQuickPathAnimationUpdater() : path(nullptr), pathLength(0), target(nullptr), reverse(false), fromSourced(false), fromDefined(false), toDefined(false), toX(0), toY(0), currentV(0), orientation(QQuickPathAnimation::Fixed), entryInterval(0), exitInterval(0) {} @@ -128,10 +128,10 @@ class QQuickPathAnimationPrivate; class QQuickPathAnimationAnimator : public QQuickBulkValueAnimator { public: - QQuickPathAnimationAnimator(QQuickPathAnimationPrivate * = 0); + QQuickPathAnimationAnimator(QQuickPathAnimationPrivate * = nullptr); ~QQuickPathAnimationAnimator(); - void clearTemplate() { animationTemplate = 0; } + void clearTemplate() { animationTemplate = nullptr; } QQuickPathAnimationUpdater *pathUpdater() const { return static_cast<QQuickPathAnimationUpdater*>(getAnimValue()); } private: @@ -142,7 +142,7 @@ class QQuickPathAnimationPrivate : public QQuickAbstractAnimationPrivate { Q_DECLARE_PUBLIC(QQuickPathAnimation) public: - QQuickPathAnimationPrivate() : path(0), target(0), + QQuickPathAnimationPrivate() : path(nullptr), target(nullptr), orientation(QQuickPathAnimation::Fixed), entryDuration(0), exitDuration(0), duration(250) {} QQuickPath *path; diff --git a/src/quick/items/qquickitemchangelistener_p.h b/src/quick/items/qquickitemchangelistener_p.h index cb0af75c4c..31d06c9983 100644 --- a/src/quick/items/qquickitemchangelistener_p.h +++ b/src/quick/items/qquickitemchangelistener_p.h @@ -135,7 +135,7 @@ public: virtual void itemImplicitWidthChanged(QQuickItem *) {} virtual void itemImplicitHeightChanged(QQuickItem *) {} - virtual QQuickAnchorsPrivate *anchorPrivate() { return 0; } + virtual QQuickAnchorsPrivate *anchorPrivate() { return nullptr; } }; QT_END_NAMESPACE diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp index c3f8d4f024..003fde8c9e 100644 --- a/src/quick/items/qquickitemgrabresult.cpp +++ b/src/quick/items/qquickitemgrabresult.cpp @@ -62,9 +62,9 @@ class QQuickItemGrabResultPrivate : public QObjectPrivate { public: QQuickItemGrabResultPrivate() - : cacheEntry(0) - , qmlEngine(0) - , texture(0) + : cacheEntry(nullptr) + , qmlEngine(nullptr) + , texture(nullptr) { } @@ -266,7 +266,7 @@ void QQuickItemGrabResult::render() d->image = d->texture->toImage(); delete d->texture; - d->texture = 0; + d->texture = nullptr; disconnect(d->window.data(), &QQuickWindow::beforeSynchronizing, this, &QQuickItemGrabResult::setup); disconnect(d->window.data(), &QQuickWindow::afterRendering, this, &QQuickItemGrabResult::render); @@ -281,17 +281,17 @@ QQuickItemGrabResult *QQuickItemGrabResultPrivate::create(QQuickItem *item, cons if (size.width() < 1 || size.height() < 1) { qmlWarning(item) << "grabToImage: item has invalid dimensions"; - return 0; + return nullptr; } if (!item->window()) { qmlWarning(item) << "grabToImage: item is not attached to a window"; - return 0; + return nullptr; } if (!item->window()->isVisible()) { qmlWarning(item) << "grabToImage: item's window is not visible"; - return 0; + return nullptr; } QQuickItemGrabResult *result = new QQuickItemGrabResult(); diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 21aca04fdc..f2e055e874 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -54,7 +54,7 @@ Q_LOGGING_CATEGORY(lcItemViewDelegateLifecycle, "qt.quick.itemview.lifecycle") FxViewItem::FxViewItem(QQuickItem *i, QQuickItemView *v, bool own, QQuickItemViewAttached *attached) : item(i) , view(v) - , transitionableItem(0) + , transitionableItem(nullptr) , attached(attached) , ownItem(own) , releaseAfterTransition(false) @@ -69,9 +69,9 @@ FxViewItem::~FxViewItem() delete transitionableItem; if (ownItem && item) { trackGeometry(false); - item->setParentItem(0); + item->setParentItem(nullptr); item->deleteLater(); - item = 0; + item = nullptr; } } @@ -275,7 +275,7 @@ QQuickItemView::~QQuickItemView() QQuickItem *QQuickItemView::currentItem() const { Q_D(const QQuickItemView); - return d->currentItem ? d->currentItem->item : 0; + return d->currentItem ? d->currentItem->item : nullptr; } QVariant QQuickItemView::model() const @@ -304,12 +304,12 @@ void QQuickItemView::setModel(const QVariant &m) QQmlInstanceModel *oldModel = d->model; d->clear(); - d->model = 0; + d->model = nullptr; d->setPosition(d->contentStartOffset()); d->modelVariant = model; QObject *object = qvariant_cast<QObject*>(model); - QQmlInstanceModel *vim = 0; + QQmlInstanceModel *vim = nullptr; if (object && (vim = qobject_cast<QQmlInstanceModel *>(object))) { if (d->ownModel) { delete oldModel; @@ -362,7 +362,7 @@ QQmlComponent *QQuickItemView::delegate() const return dataModel->delegate(); } - return 0; + return nullptr; } void QQuickItemView::setDelegate(QQmlComponent *delegate) @@ -382,7 +382,7 @@ void QQuickItemView::setDelegate(QQmlComponent *delegate) if (isComponentComplete()) { d->releaseVisibleItems(); d->releaseItem(d->currentItem); - d->currentItem = 0; + d->currentItem = nullptr; d->updateSectionCriteria(); d->refill(); d->moveReason = QQuickItemViewPrivate::SetIndex; @@ -586,7 +586,7 @@ QQmlComponent *QQuickItemView::header() const QQuickItem *QQuickItemView::headerItem() const { Q_D(const QQuickItemView); - return d->header ? d->header->item : 0; + return d->header ? d->header->item : nullptr; } void QQuickItemView::setHeader(QQmlComponent *headerComponent) @@ -595,7 +595,7 @@ void QQuickItemView::setHeader(QQmlComponent *headerComponent) if (d->headerComponent != headerComponent) { d->applyPendingChanges(); delete d->header; - d->header = 0; + d->header = nullptr; d->headerComponent = headerComponent; d->markExtentsDirty(); @@ -621,7 +621,7 @@ QQmlComponent *QQuickItemView::footer() const QQuickItem *QQuickItemView::footerItem() const { Q_D(const QQuickItemView); - return d->footer ? d->footer->item : 0; + return d->footer ? d->footer->item : nullptr; } void QQuickItemView::setFooter(QQmlComponent *footerComponent) @@ -630,7 +630,7 @@ void QQuickItemView::setFooter(QQmlComponent *footerComponent) if (d->footerComponent != footerComponent) { d->applyPendingChanges(); delete d->footer; - d->footer = 0; + d->footer = nullptr; d->footerComponent = footerComponent; if (isComponentComplete()) { @@ -666,7 +666,7 @@ void QQuickItemView::setHighlight(QQmlComponent *highlightComponent) QQuickItem *QQuickItemView::highlightItem() const { Q_D(const QQuickItemView); - return d->highlight ? d->highlight->item : 0; + return d->highlight ? d->highlight->item : nullptr; } bool QQuickItemView::highlightFollowsCurrentItem() const @@ -799,7 +799,7 @@ void QQuickItemView::setHighlightMoveDuration(int duration) QQuickTransition *QQuickItemView::populateTransition() const { Q_D(const QQuickItemView); - return d->transitioner ? d->transitioner->populateTransition : 0; + return d->transitioner ? d->transitioner->populateTransition : nullptr; } void QQuickItemView::setPopulateTransition(QQuickTransition *transition) @@ -815,7 +815,7 @@ void QQuickItemView::setPopulateTransition(QQuickTransition *transition) QQuickTransition *QQuickItemView::addTransition() const { Q_D(const QQuickItemView); - return d->transitioner ? d->transitioner->addTransition : 0; + return d->transitioner ? d->transitioner->addTransition : nullptr; } void QQuickItemView::setAddTransition(QQuickTransition *transition) @@ -831,7 +831,7 @@ void QQuickItemView::setAddTransition(QQuickTransition *transition) QQuickTransition *QQuickItemView::addDisplacedTransition() const { Q_D(const QQuickItemView); - return d->transitioner ? d->transitioner->addDisplacedTransition : 0; + return d->transitioner ? d->transitioner->addDisplacedTransition : nullptr; } void QQuickItemView::setAddDisplacedTransition(QQuickTransition *transition) @@ -847,7 +847,7 @@ void QQuickItemView::setAddDisplacedTransition(QQuickTransition *transition) QQuickTransition *QQuickItemView::moveTransition() const { Q_D(const QQuickItemView); - return d->transitioner ? d->transitioner->moveTransition : 0; + return d->transitioner ? d->transitioner->moveTransition : nullptr; } void QQuickItemView::setMoveTransition(QQuickTransition *transition) @@ -863,7 +863,7 @@ void QQuickItemView::setMoveTransition(QQuickTransition *transition) QQuickTransition *QQuickItemView::moveDisplacedTransition() const { Q_D(const QQuickItemView); - return d->transitioner ? d->transitioner->moveDisplacedTransition : 0; + return d->transitioner ? d->transitioner->moveDisplacedTransition : nullptr; } void QQuickItemView::setMoveDisplacedTransition(QQuickTransition *transition) @@ -879,7 +879,7 @@ void QQuickItemView::setMoveDisplacedTransition(QQuickTransition *transition) QQuickTransition *QQuickItemView::removeTransition() const { Q_D(const QQuickItemView); - return d->transitioner ? d->transitioner->removeTransition : 0; + return d->transitioner ? d->transitioner->removeTransition : nullptr; } void QQuickItemView::setRemoveTransition(QQuickTransition *transition) @@ -895,7 +895,7 @@ void QQuickItemView::setRemoveTransition(QQuickTransition *transition) QQuickTransition *QQuickItemView::removeDisplacedTransition() const { Q_D(const QQuickItemView); - return d->transitioner ? d->transitioner->removeDisplacedTransition : 0; + return d->transitioner ? d->transitioner->removeDisplacedTransition : nullptr; } void QQuickItemView::setRemoveDisplacedTransition(QQuickTransition *transition) @@ -911,7 +911,7 @@ void QQuickItemView::setRemoveDisplacedTransition(QQuickTransition *transition) QQuickTransition *QQuickItemView::displacedTransition() const { Q_D(const QQuickItemView); - return d->transitioner ? d->transitioner->displacedTransition : 0; + return d->transitioner ? d->transitioner->displacedTransition : nullptr; } void QQuickItemView::setDisplacedTransition(QQuickTransition *transition) @@ -1234,7 +1234,7 @@ void QQuickItemViewPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometry // start new transitions bool prevInLayout = inLayout; if (!inLayout) { - FxViewItem *actualItem = transitioner ? visibleItem(currentIndex) : 0; + FxViewItem *actualItem = transitioner ? visibleItem(currentIndex) : nullptr; if (actualItem && actualItem->transitionRunning()) inLayout = true; } @@ -1558,14 +1558,14 @@ QQuickItemViewPrivate::QQuickItemViewPrivate() , layoutDirection(Qt::LeftToRight), verticalLayoutDirection(QQuickItemView::TopToBottom) , moveReason(Other) , visibleIndex(0) - , currentIndex(-1), currentItem(0) - , trackedItem(0), requestedIndex(-1) - , highlightComponent(0), highlight(0) + , currentIndex(-1), currentItem(nullptr) + , trackedItem(nullptr), requestedIndex(-1) + , highlightComponent(nullptr), highlight(nullptr) , highlightRange(QQuickItemView::NoHighlightRange) , highlightRangeStart(0), highlightRangeEnd(0) , highlightMoveDuration(150) - , headerComponent(0), header(0), footerComponent(0), footer(0) - , transitioner(0) + , headerComponent(nullptr), header(nullptr), footerComponent(nullptr), footer(nullptr) + , transitioner(nullptr) , minExtent(0), maxExtent(0) , ownModel(false), wrap(false) , keyNavigationEnabled(true) @@ -1583,7 +1583,7 @@ QQuickItemViewPrivate::QQuickItemViewPrivate() QQuickItemViewPrivate::~QQuickItemViewPrivate() { if (transitioner) - transitioner->setChangeListener(0); + transitioner->setChangeListener(nullptr); delete transitioner; } @@ -1649,7 +1649,7 @@ FxViewItem *QQuickItemViewPrivate::visibleItem(int modelIndex) const { return item; } } - return 0; + return nullptr; } // should rename to firstItemInView() to avoid confusion with other "*visible*" methods @@ -1709,7 +1709,7 @@ void QQuickItemViewPrivate::updateCurrent(int modelIndex) if (currentItem->attached) currentItem->attached->setIsCurrentItem(false); releaseItem(currentItem); - currentItem = 0; + currentItem = nullptr; currentIndex = modelIndex; emit q->currentIndexChanged(); emit q->currentItemChanged(); @@ -1766,11 +1766,11 @@ void QQuickItemViewPrivate::clear() auto oldCurrentItem = currentItem; releaseItem(currentItem); - currentItem = 0; + currentItem = nullptr; if (oldCurrentItem) emit q->currentItemChanged(); createHighlight(); - trackedItem = 0; + trackedItem = nullptr; if (requestedIndex >= 0) { if (model) @@ -1865,9 +1865,9 @@ void QQuickItemViewPrivate::regenerate(bool orientationChanged) if (q->isComponentComplete()) { if (orientationChanged) { delete header; - header = 0; + header = nullptr; delete footer; - footer = 0; + footer = nullptr; } clear(); updateHeader(); @@ -2126,7 +2126,7 @@ bool QQuickItemViewPrivate::applyModelChanges(ChangeResult *totalInsertionResult currentItem->attached->setIsCurrentItem(false); auto oldCurrentItem = currentItem; releaseItem(currentItem); - currentItem = 0; + currentItem = nullptr; if (oldCurrentItem) emit q->currentItemChanged(); } @@ -2345,7 +2345,7 @@ FxViewItem *QQuickItemViewPrivate::createItem(int modelIndex, QQmlIncubator::Inc Q_Q(QQuickItemView); if (requestedIndex == modelIndex && incubationMode == QQmlIncubator::Asynchronous) - return 0; + return nullptr; for (int i=0; i<releasePendingTransition.count(); i++) { if (releasePendingTransition.at(i)->index == modelIndex @@ -2377,7 +2377,7 @@ FxViewItem *QQuickItemViewPrivate::createItem(int modelIndex, QQmlIncubator::Inc } } inRequest = false; - return 0; + return nullptr; } else { item->setParentItem(q->contentItem()); if (requestedIndex == modelIndex) @@ -2430,7 +2430,7 @@ void QQuickItemView::destroyingItem(QObject *object) Q_D(QQuickItemView); QQuickItem* item = qmlobject_cast<QQuickItem*>(object); if (item) { - item->setParentItem(0); + item->setParentItem(nullptr); d->unrequestedItems.remove(item); } } @@ -2441,7 +2441,7 @@ bool QQuickItemViewPrivate::releaseItem(FxViewItem *item) if (!item || !model) return true; if (trackedItem == item) - trackedItem = 0; + trackedItem = nullptr; item->trackGeometry(false); QQmlInstanceModel::ReleaseFlags flags = model->release(item->item); @@ -2451,7 +2451,7 @@ bool QQuickItemViewPrivate::releaseItem(FxViewItem *item) QQuickItemPrivate::get(item->item)->setCulled(true); unrequestedItems.insert(item->item, model->indexOf(item->item, q)); } else if (flags & QQmlInstanceModel::Destroyed) { - item->item->setParentItem(0); + item->item->setParentItem(nullptr); } } delete item; @@ -2467,7 +2467,7 @@ QQuickItem *QQuickItemViewPrivate::createComponentItem(QQmlComponent *component, { Q_Q(const QQuickItemView); - QQuickItem *item = 0; + QQuickItem *item = nullptr; if (component) { QQmlContext *creationContext = component->creationContext(); QQmlContext *context = new QQmlContext( diff --git a/src/quick/items/qquickitemview_p.h b/src/quick/items/qquickitemview_p.h index b38bc6174f..483fc1a09f 100644 --- a/src/quick/items/qquickitemview_p.h +++ b/src/quick/items/qquickitemview_p.h @@ -128,7 +128,7 @@ public: }; Q_ENUM(VerticalLayoutDirection) - QQuickItemView(QQuickFlickablePrivate &dd, QQuickItem *parent = 0); + QQuickItemView(QQuickFlickablePrivate &dd, QQuickItem *parent = nullptr); ~QQuickItemView(); QVariant model() const; diff --git a/src/quick/items/qquickitemviewtransition.cpp b/src/quick/items/qquickitemviewtransition.cpp index 745e5b275f..5cd28d0acb 100644 --- a/src/quick/items/qquickitemviewtransition.cpp +++ b/src/quick/items/qquickitemviewtransition.cpp @@ -69,11 +69,11 @@ protected: QQuickItemViewTransitionJob::QQuickItemViewTransitionJob() - : m_transitioner(0) - , m_item(0) + : m_transitioner(nullptr) + , m_item(nullptr) , m_type(QQuickItemViewTransitioner::NoTransition) , m_isTarget(false) - , m_wasDeleted(0) + , m_wasDeleted(nullptr) { } @@ -143,12 +143,12 @@ void QQuickItemViewTransitionJob::finished() m_transitioner->finishedTransition(this, m_item); if (deleted) return; - m_wasDeleted = 0; + m_wasDeleted = nullptr; - m_transitioner = 0; + m_transitioner = nullptr; } - m_item = 0; + m_item = nullptr; m_toPos.setX(0); m_toPos.setY(0); m_type = QQuickItemViewTransitioner::NoTransition; @@ -157,12 +157,12 @@ void QQuickItemViewTransitionJob::finished() QQuickItemViewTransitioner::QQuickItemViewTransitioner() - : populateTransition(0) - , addTransition(0), addDisplacedTransition(0) - , moveTransition(0), moveDisplacedTransition(0) - , removeTransition(0), removeDisplacedTransition(0) - , displacedTransition(0) - , changeListener(0) + : populateTransition(nullptr) + , addTransition(nullptr), addDisplacedTransition(nullptr) + , moveTransition(nullptr), moveDisplacedTransition(nullptr) + , removeTransition(nullptr), removeDisplacedTransition(nullptr) + , displacedTransition(nullptr) + , changeListener(nullptr) , usePopulateTransition(false) { } @@ -172,7 +172,7 @@ QQuickItemViewTransitioner::~QQuickItemViewTransitioner() typedef QSet<QQuickItemViewTransitionJob *>::iterator JobIt; for (JobIt it = runningJobs.begin(), end = runningJobs.end(); it != end; ++it) - (*it)->m_transitioner = 0; + (*it)->m_transitioner = nullptr; } bool QQuickItemViewTransitioner::canTransition(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const @@ -249,12 +249,12 @@ void QQuickItemViewTransitioner::resetTargetLists() QQuickTransition *QQuickItemViewTransitioner::transitionObject(QQuickItemViewTransitioner::TransitionType type, bool asTarget) const { if (type == QQuickItemViewTransitioner::NoTransition) - return 0; + return nullptr; if (type == PopulateTransition) asTarget = true; // no separate displaced transition - QQuickTransition *trans = 0; + QQuickTransition *trans = nullptr; switch (type) { case NoTransition: break; @@ -276,7 +276,7 @@ QQuickTransition *QQuickItemViewTransitioner::transitionObject(QQuickItemViewTra trans = displacedTransition; if (trans && trans->enabled()) return trans; - return 0; + return nullptr; } const QList<int> &QQuickItemViewTransitioner::targetIndexes(QQuickItemViewTransitioner::TransitionType type) const @@ -328,7 +328,7 @@ void QQuickItemViewTransitioner::finishedTransition(QQuickItemViewTransitionJob QQuickItemViewTransitionableItem::QQuickItemViewTransitionableItem(QQuickItem *i) : item(i) - , transition(0) + , transition(nullptr) , nextTransitionType(QQuickItemViewTransitioner::NoTransition) , isTransitionTarget(false) , nextTransitionToSet(false) @@ -563,7 +563,7 @@ void QQuickItemViewTransitionableItem::stopTransition() QQuickViewTransitionAttached::QQuickViewTransitionAttached(QObject *parent) - : QObject(parent), m_item(0), m_index(-1) + : QObject(parent), m_item(nullptr), m_index(-1) { } /*! diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 54dfbafaa2..33becd71ec 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -176,9 +176,9 @@ public: , snapMode(QQuickListView::NoSnap) , headerPositioning(QQuickListView::InlineHeader) , footerPositioning(QQuickListView::InlineFooter) - , highlightPosAnimator(0), highlightWidthAnimator(0), highlightHeightAnimator(0) + , highlightPosAnimator(nullptr), highlightWidthAnimator(nullptr), highlightHeightAnimator(nullptr) , highlightMoveVelocity(400), highlightResizeVelocity(400), highlightResizeDuration(-1) - , sectionCriteria(0), currentSectionItem(0), nextSectionItem(0) + , sectionCriteria(nullptr), currentSectionItem(nullptr), nextSectionItem(nullptr) , overshootDist(0.0), correctFlick(false), inFlickCorrection(false) { highlightMoveDuration = -1; //override default value set in base class @@ -195,8 +195,8 @@ public: //---------------------------------------------------------------------------- QQuickViewSection::QQuickViewSection(QQuickListView *parent) - : QObject(parent), m_criteria(FullString), m_delegate(0), m_labelPositioning(InlineLabels) - , m_view(parent ? QQuickListViewPrivate::get(parent) : 0) + : QObject(parent), m_criteria(FullString), m_delegate(nullptr), m_labelPositioning(InlineLabels) + , m_view(parent ? QQuickListViewPrivate::get(parent) : nullptr) { } @@ -258,7 +258,7 @@ public: } inline QQuickItem *section() const { - return item && attached ? static_cast<QQuickListViewAttached*>(attached)->m_sectionItem : 0; + return item && attached ? static_cast<QQuickListViewAttached*>(attached)->m_sectionItem : nullptr; } void setSection(QQuickItem *s) { static_cast<QQuickListViewAttached*>(attached)->m_sectionItem = s; @@ -389,7 +389,7 @@ bool QQuickListViewPrivate::isBottomToTop() const FxViewItem *QQuickListViewPrivate::itemBefore(int modelIndex) const { if (modelIndex < visibleIndex) - return 0; + return nullptr; int idx = 1; int lastIndex = -1; while (idx < visibleItems.count()) { @@ -402,7 +402,7 @@ FxViewItem *QQuickListViewPrivate::itemBefore(int modelIndex) const } if (lastIndex == modelIndex-1) return visibleItems.constLast(); - return 0; + return nullptr; } void QQuickListViewPrivate::setPosition(qreal pos) @@ -530,7 +530,7 @@ qreal QQuickListViewPrivate::snapPosAt(qreal pos) FxViewItem *QQuickListViewPrivate::snapItemAt(qreal pos) { - FxViewItem *snapItem = 0; + FxViewItem *snapItem = nullptr; qreal prevItemSize = 0; for (FxViewItem *item : qAsConst(visibleItems)) { if (item->index == -1) @@ -561,13 +561,13 @@ void QQuickListViewPrivate::clear() { for (int i = 0; i < sectionCacheSize; ++i) { delete sectionCache[i]; - sectionCache[i] = 0; + sectionCache[i] = nullptr; } visiblePos = 0; releaseSectionItem(currentSectionItem); - currentSectionItem = 0; + currentSectionItem = nullptr; releaseSectionItem(nextSectionItem); - nextSectionItem = 0; + nextSectionItem = nullptr; lastVisibleSection = QString(); QQuickItemViewPrivate::clear(); } @@ -629,13 +629,13 @@ bool QQuickListViewPrivate::releaseItem(FxViewItem *item) if (!sectionCache[i]) { sectionCache[i] = att->m_sectionItem; sectionCache[i]->setVisible(false); - att->m_sectionItem = 0; + att->m_sectionItem = nullptr; break; } ++i; } while (i < sectionCacheSize); delete att->m_sectionItem; - att->m_sectionItem = 0; + att->m_sectionItem = nullptr; } return released; @@ -672,7 +672,7 @@ bool QQuickListViewPrivate::addVisibleItems(qreal fillFrom, qreal fillTo, qreal QQmlIncubator::IncubationMode incubationMode = doBuffer ? QQmlIncubator::Asynchronous : QQmlIncubator::AsynchronousIfNested; bool changed = false; - FxListItemSG *item = 0; + FxListItemSG *item = nullptr; qreal pos = itemEnd; while (modelIndex < model->count() && pos <= fillTo) { if (!(item = static_cast<FxListItemSG*>(createItem(modelIndex, incubationMode)))) @@ -722,7 +722,7 @@ void QQuickListViewPrivate::removeItem(FxViewItem *item) bool QQuickListViewPrivate::removeNonVisibleItems(qreal bufferFrom, qreal bufferTo) { - FxViewItem *item = 0; + FxViewItem *item = nullptr; bool changed = false; // Remove items from the start of the view. @@ -864,16 +864,16 @@ void QQuickListViewPrivate::createHighlight() bool changed = false; if (highlight) { if (trackedItem == highlight) - trackedItem = 0; + trackedItem = nullptr; delete highlight; - highlight = 0; + highlight = nullptr; delete highlightPosAnimator; delete highlightWidthAnimator; delete highlightHeightAnimator; - highlightPosAnimator = 0; - highlightWidthAnimator = 0; - highlightHeightAnimator = 0; + highlightPosAnimator = nullptr; + highlightWidthAnimator = nullptr; + highlightHeightAnimator = nullptr; changed = true; } @@ -962,13 +962,13 @@ bool QQuickListViewPrivate::movingFromHighlight() QQuickItem * QQuickListViewPrivate::getSectionItem(const QString §ion) { Q_Q(QQuickListView); - QQuickItem *sectionItem = 0; + QQuickItem *sectionItem = nullptr; int i = sectionCacheSize-1; while (i >= 0 && !sectionCache[i]) --i; if (i >= 0) { sectionItem = sectionCache[i]; - sectionCache[i] = 0; + sectionCache[i] = nullptr; sectionItem->setVisible(true); QQmlContext *context = QQmlEngine::contextForObject(sectionItem)->parentContext(); context->setContextProperty(QLatin1String("section"), section); @@ -1025,13 +1025,13 @@ void QQuickListViewPrivate::releaseSectionItems() if (listItem->section()) { qreal pos = listItem->position(); releaseSectionItem(listItem->section()); - listItem->setSection(0); + listItem->setSection(nullptr); listItem->setPosition(pos); } } for (int i = 0; i < sectionCacheSize; ++i) { delete sectionCache[i]; - sectionCache[i] = 0; + sectionCache[i] = nullptr; } } @@ -1053,7 +1053,7 @@ void QQuickListViewPrivate::updateInlineSection(FxListItemSG *listItem) } else if (listItem->section()) { qreal pos = listItem->position(); releaseSectionItem(listItem->section()); - listItem->setSection(0); + listItem->setSection(nullptr); listItem->setPosition(pos); } } @@ -1069,8 +1069,8 @@ void QQuickListViewPrivate::updateStickySections() qreal startPos = hasStickyHeader() ? header->endPosition() : viewPos; qreal endPos = hasStickyFooter() ? footer->position() : viewPos + size(); - QQuickItem *sectionItem = 0; - QQuickItem *lastSectionItem = 0; + QQuickItem *sectionItem = nullptr; + QQuickItem *lastSectionItem = nullptr; int index = 0; while (index < visibleItems.count()) { if (QQuickItem *section = static_cast<FxListItemSG *>(visibleItems.at(index))->section()) { @@ -1129,7 +1129,7 @@ void QQuickListViewPrivate::updateStickySections() currentSectionItem->setX(pos); } else if (currentSectionItem) { releaseSectionItem(currentSectionItem); - currentSectionItem = 0; + currentSectionItem = nullptr; } // Next section footer @@ -1161,7 +1161,7 @@ void QQuickListViewPrivate::updateStickySections() nextSectionItem->setX(pos); } else if (nextSectionItem) { releaseSectionItem(nextSectionItem); - nextSectionItem = 0; + nextSectionItem = nullptr; } } @@ -1177,7 +1177,7 @@ void QQuickListViewPrivate::updateSections() QString prevSection; if (visibleIndex > 0) prevSection = sectionAt(visibleIndex-1); - QQuickListViewAttached *prevAtt = 0; + QQuickListViewAttached *prevAtt = nullptr; int prevIdx = -1; int idx = -1; for (FxViewItem *item : qAsConst(visibleItems)) { @@ -3266,7 +3266,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } else { for (i = count-1; i >= 0 && pos >= from; --i) { // item is before first visible e.g. in cache buffer - FxViewItem *item = 0; + FxViewItem *item = nullptr; if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i)))) item->index = modelIndex + i; if (!item) @@ -3307,7 +3307,7 @@ bool QQuickListViewPrivate::applyInsertionChange(const QQmlChangeSet::Change &ch } else { for (int i = 0; i < count && pos <= lastVisiblePos; ++i) { visibleAffected = true; - FxViewItem *item = 0; + FxViewItem *item = nullptr; if (change.isMove() && (item = currentChanges.removedItems.take(change.moveKey(modelIndex + i)))) item->index = modelIndex + i; bool newItem = !item; diff --git a/src/quick/items/qquicklistview_p.h b/src/quick/items/qquicklistview_p.h index f8db0f0f8f..9a9b325b1e 100644 --- a/src/quick/items/qquicklistview_p.h +++ b/src/quick/items/qquicklistview_p.h @@ -71,7 +71,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickViewSection : public QObject Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged) Q_PROPERTY(int labelPositioning READ labelPositioning WRITE setLabelPositioning NOTIFY labelPositioningChanged) public: - QQuickViewSection(QQuickListView *parent=0); + QQuickViewSection(QQuickListView *parent=nullptr); QString property() const { return m_property; } void setProperty(const QString &); @@ -132,7 +132,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickListView : public QQuickItemView Q_CLASSINFO("DefaultProperty", "data") public: - QQuickListView(QQuickItem *parent=0); + QQuickListView(QQuickItem *parent=nullptr); ~QQuickListView(); qreal spacing() const; @@ -206,7 +206,7 @@ class QQuickListViewAttached : public QQuickItemViewAttached public: QQuickListViewAttached(QObject *parent) - : QQuickItemViewAttached(parent), m_sectionItem(0) {} + : QQuickItemViewAttached(parent), m_sectionItem(nullptr) {} ~QQuickListViewAttached() {} public: diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index 33e22c1e95..34f30e81a3 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -54,7 +54,7 @@ static const QQuickItemPrivate::ChangeTypes watchedChanges = QQuickItemPrivate::Geometry | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight; QQuickLoaderPrivate::QQuickLoaderPrivate() - : item(0), object(0), component(0), itemContext(0), incubator(0), updatingSize(false), + : item(nullptr), object(nullptr), component(nullptr), itemContext(nullptr), incubator(nullptr), updatingSize(false), active(true), loadingFromSource(false), asynchronous(false) { } @@ -62,7 +62,7 @@ QQuickLoaderPrivate::QQuickLoaderPrivate() QQuickLoaderPrivate::~QQuickLoaderPrivate() { delete itemContext; - itemContext = 0; + itemContext = nullptr; delete incubator; disposeInitialPropertyValues(); } @@ -96,7 +96,7 @@ void QQuickLoaderPrivate::clear() incubator->clear(); delete itemContext; - itemContext = 0; + itemContext = nullptr; // Prevent any bindings from running while waiting for deletion. Without // this we may get transient errors from use of 'parent', for example. @@ -111,7 +111,7 @@ void QQuickLoaderPrivate::clear() QObject::disconnect(component, SIGNAL(progressChanged(qreal)), q, SIGNAL(progressChanged())); component->deleteLater(); - component = 0; + component = nullptr; } componentStrongReference.clear(); source = QUrl(); @@ -122,13 +122,13 @@ void QQuickLoaderPrivate::clear() // We can't delete immediately because our item may have triggered // the Loader to load a different item. - item->setParentItem(0); + item->setParentItem(nullptr); item->setVisible(false); - item = 0; + item = nullptr; } if (object) { object->deleteLater(); - object = 0; + object = nullptr; } } @@ -356,7 +356,7 @@ void QQuickLoader::setActive(bool newVal) if (d->incubator) { d->incubator->clear(); delete d->itemContext; - d->itemContext = 0; + d->itemContext = nullptr; } // Prevent any bindings from running while waiting for deletion. Without @@ -371,13 +371,13 @@ void QQuickLoader::setActive(bool newVal) // We can't delete immediately because our item may have triggered // the Loader to load a different item. - d->item->setParentItem(0); + d->item->setParentItem(nullptr); d->item->setVisible(false); - d->item = 0; + d->item = nullptr; } if (d->object) { d->object->deleteLater(); - d->object = 0; + d->object = nullptr; emit itemChanged(); } emit statusChanged(); @@ -499,7 +499,7 @@ void QQuickLoader::setSourceComponent(QQmlComponent *comp) void QQuickLoader::resetSourceComponent() { - setSourceComponent(0); + setSourceComponent(nullptr); } void QQuickLoader::loadFromSourceComponent() @@ -656,7 +656,7 @@ void QQuickLoaderPrivate::setInitialState(QObject *obj) if (obj) { QQml_setParent_noEvent(itemContext, obj); QQml_setParent_noEvent(obj, q); - itemContext = 0; + itemContext = nullptr; } if (initialPropertyValues.isUndefined()) @@ -700,7 +700,7 @@ void QQuickLoaderPrivate::incubatorStateChanged(QQmlIncubator::Status status) if (!incubator->errors().isEmpty()) QQmlEnginePrivate::warning(qmlEngine(q), incubator->errors()); delete itemContext; - itemContext = 0; + itemContext = nullptr; delete incubator->object(); source = QUrl(); emit q->itemChanged(); diff --git a/src/quick/items/qquickloader_p.h b/src/quick/items/qquickloader_p.h index b5137c0783..de1dfa9da5 100644 --- a/src/quick/items/qquickloader_p.h +++ b/src/quick/items/qquickloader_p.h @@ -69,7 +69,7 @@ class Q_AUTOTEST_EXPORT QQuickLoader : public QQuickImplicitSizeItem Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged) public: - QQuickLoader(QQuickItem *parent = 0); + QQuickLoader(QQuickItem *parent = nullptr); virtual ~QQuickLoader(); bool active() const; diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index cea8293ceb..052da9fe82 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -60,13 +60,13 @@ Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE) QQuickMouseAreaPrivate::QQuickMouseAreaPrivate() : enabled(true), scrollGestureEnabled(true), hovered(false), longPress(false), moved(false), stealMouse(false), doubleClick(false), preventStealing(false), - propagateComposedEvents(false), overThreshold(false), pressed(0), + propagateComposedEvents(false), overThreshold(false), pressed(nullptr), pressAndHoldInterval(-1) #if QT_CONFIG(draganddrop) - , drag(0) + , drag(nullptr) #endif #if QT_CONFIG(cursor) - , cursor(0) + , cursor(nullptr) #endif { } @@ -910,7 +910,7 @@ void QQuickMouseArea::ungrabMouse() if (d->pressed) { // if our mouse grab has been removed (probably by Flickable), fix our // state - d->pressed = 0; + d->pressed = nullptr; d->stealMouse = false; d->doubleClick = false; d->overThreshold = false; @@ -944,7 +944,7 @@ bool QQuickMouseArea::sendMouseEvent(QMouseEvent *event) QPointF localPos = mapFromScene(event->windowPos()); QQuickWindow *c = window(); - QQuickItem *grabber = c ? c->mouseGrabberItem() : 0; + QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr; bool stealThisEvent = d->stealMouse; if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) { QMouseEvent mouseEvent(event->type(), localPos, event->windowPos(), event->screenPos(), @@ -965,7 +965,7 @@ bool QQuickMouseArea::sendMouseEvent(QMouseEvent *event) default: break; } - grabber = c ? c->mouseGrabberItem() : 0; + grabber = c ? c->mouseGrabberItem() : nullptr; if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) grabMouse(); @@ -1420,7 +1420,7 @@ QSGNode *QQuickMouseArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData Q_D(QQuickMouseArea); if (!qmlVisualTouchDebugging()) - return 0; + return nullptr; QSGInternalRectangleNode *rectangle = static_cast<QSGInternalRectangleNode *>(oldNode); if (!rectangle) rectangle = d->sceneGraphContext()->createInternalRectangleNode(); diff --git a/src/quick/items/qquickmousearea_p.h b/src/quick/items/qquickmousearea_p.h index ae6c56726e..0a8449957f 100644 --- a/src/quick/items/qquickmousearea_p.h +++ b/src/quick/items/qquickmousearea_p.h @@ -87,7 +87,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickMouseArea : public QQuickItem Q_PROPERTY(int pressAndHoldInterval READ pressAndHoldInterval WRITE setPressAndHoldInterval NOTIFY pressAndHoldIntervalChanged RESET resetPressAndHoldInterval REVISION 9) public: - QQuickMouseArea(QQuickItem *parent=0); + QQuickMouseArea(QQuickItem *parent=nullptr); ~QQuickMouseArea(); qreal mouseX() const; diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index 514d0f5d37..dc168073e4 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -541,7 +541,7 @@ void QQuickMultiPointTouchArea::touchEvent(QTouchEvent *event) case QEvent::TouchEnd: { //if e.g. a parent Flickable has the mouse grab, don't process the touch events QQuickWindow *c = window(); - QQuickItem *grabber = c ? c->mouseGrabberItem() : 0; + QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr; if (grabber && grabber != this && grabber->keepMouseGrab() && grabber->isEnabled()) { QQuickItem *item = this; while ((item = item->parentItem())) { @@ -719,7 +719,7 @@ void QQuickMultiPointTouchArea::clearTouchLists() void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) { - QQuickTouchPoint *dtp = 0; + QQuickTouchPoint *dtp = nullptr; for (QQuickTouchPoint* tp : qAsConst(_touchPrototypes)) { if (!tp->inUse()) { tp->setInUse(true); @@ -728,7 +728,7 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) } } - if (dtp == 0) + if (dtp == nullptr) dtp = new QQuickTouchPoint(false); dtp->setPointId(p->id()); updateTouchPoint(dtp,p); @@ -739,7 +739,7 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e) { - QQuickTouchPoint *dtp = 0; + QQuickTouchPoint *dtp = nullptr; for (QQuickTouchPoint *tp : qAsConst(_touchPrototypes)) if (!tp->inUse()) { tp->setInUse(true); @@ -747,7 +747,7 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QMouseEvent *e) break; } - if (dtp == 0) + if (dtp == nullptr) dtp = new QQuickTouchPoint(false); updateTouchPoint(dtp, e); dtp->setPressed(true); @@ -920,7 +920,7 @@ bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event) QPointF localPos = mapFromScene(event->windowPos()); QQuickWindow *c = window(); - QQuickItem *grabber = c ? c->mouseGrabberItem() : 0; + QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr; bool stealThisEvent = _stealMouse; if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab())) { QMouseEvent mouseEvent(event->type(), localPos, event->windowPos(), event->screenPos(), @@ -944,7 +944,7 @@ bool QQuickMultiPointTouchArea::sendMouseEvent(QMouseEvent *event) default: break; } - grabber = c ? c->mouseGrabberItem() : 0; + grabber = c ? c->mouseGrabberItem() : nullptr; if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) grabMouse(); @@ -991,7 +991,7 @@ bool QQuickMultiPointTouchArea::childMouseEventFilter(QQuickItem *receiver, QEve bool QQuickMultiPointTouchArea::shouldFilter(QEvent *event) { QQuickWindow *c = window(); - QQuickItem *grabber = c ? c->mouseGrabberItem() : 0; + QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr; bool disabledItem = grabber && !grabber->isEnabled(); bool stealThisEvent = _stealMouse; bool containsPoint = false; @@ -1032,7 +1032,7 @@ QSGNode *QQuickMultiPointTouchArea::updatePaintNode(QSGNode *oldNode, UpdatePain Q_UNUSED(data); if (!qmlVisualTouchDebugging()) - return 0; + return nullptr; QSGInternalRectangleNode *rectangle = static_cast<QSGInternalRectangleNode *>(oldNode); if (!rectangle) rectangle = QQuickItemPrivate::get(this)->sceneGraphContext()->createInternalRectangleNode(); diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index 64fe81563d..f1550b4ac6 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -86,16 +86,7 @@ class Q_AUTOTEST_EXPORT QQuickTouchPoint : public QObject public: QQuickTouchPoint(bool qmlDefined = true) - : _id(0), - _x(0.0), _y(0.0), - _pressure(0.0), - _rotation(0), - _qmlDefined(qmlDefined), - _inUse(false), - _pressed(false), - _startX(0.0), _startY(0.0), - _previousX(0.0), _previousY(0.0), - _sceneX(0.0), _sceneY(0.0) + : _qmlDefined(qmlDefined) {} int pointId() const { return _id; } @@ -171,23 +162,23 @@ Q_SIGNALS: private: friend class QQuickMultiPointTouchArea; - int _id; - qreal _x; - qreal _y; - qreal _pressure; - qreal _rotation; + int _id = 0; + qreal _x = 0.0; + qreal _y = 0.0; + qreal _pressure = 0.0; + qreal _rotation = 0; QSizeF _ellipseDiameters; QVector2D _velocity; QRectF _area; bool _qmlDefined; - bool _inUse; //whether the point is currently in use (only valid when _qmlDefined == true) - bool _pressed; - qreal _startX; - qreal _startY; - qreal _previousX; - qreal _previousY; - qreal _sceneX; - qreal _sceneY; + bool _inUse = false; //whether the point is currently in use (only valid when _qmlDefined == true) + bool _pressed = false; + qreal _startX = 0.0; + qreal _startY = 0.0; + qreal _previousX = 0.0; + qreal _previousY = 0.0; + qreal _sceneX = 0.0; + qreal _sceneY = 0.0; QPointingDeviceUniqueId _uniqueId; }; @@ -197,7 +188,7 @@ class QQuickGrabGestureEvent : public QObject Q_PROPERTY(QQmlListProperty<QObject> touchPoints READ touchPoints) Q_PROPERTY(qreal dragThreshold READ dragThreshold) public: - QQuickGrabGestureEvent() : _grab(false), _dragThreshold(QGuiApplication::styleHints()->startDragDistance()) {} + QQuickGrabGestureEvent() : _dragThreshold(QGuiApplication::styleHints()->startDragDistance()) {} Q_INVOKABLE void grab() { _grab = true; } bool wantsGrab() const { return _grab; } @@ -209,7 +200,7 @@ public: private: friend class QQuickMultiPointTouchArea; - bool _grab; + bool _grab = false; qreal _dragThreshold; QList<QObject*> _touchPoints; }; @@ -224,7 +215,7 @@ class Q_AUTOTEST_EXPORT QQuickMultiPointTouchArea : public QQuickItem Q_PROPERTY(bool mouseEnabled READ mouseEnabled WRITE setMouseEnabled NOTIFY mouseEnabledChanged) public: - QQuickMultiPointTouchArea(QQuickItem *parent=0); + QQuickMultiPointTouchArea(QQuickItem *parent=nullptr); ~QQuickMultiPointTouchArea(); int minimumTouchPoints() const; @@ -235,7 +226,7 @@ public: void setMouseEnabled(bool arg); QQmlListProperty<QQuickTouchPoint> touchPoints() { - return QQmlListProperty<QQuickTouchPoint>(this, 0, QQuickMultiPointTouchArea::touchPoint_append, QQuickMultiPointTouchArea::touchPoint_count, QQuickMultiPointTouchArea::touchPoint_at, 0); + return QQmlListProperty<QQuickTouchPoint>(this, nullptr, QQuickMultiPointTouchArea::touchPoint_append, QQuickMultiPointTouchArea::touchPoint_count, QQuickMultiPointTouchArea::touchPoint_at, nullptr); } static void touchPoint_append(QQmlListProperty<QQuickTouchPoint> *list, QQuickTouchPoint* touch) { diff --git a/src/quick/items/qquickopenglinfo.cpp b/src/quick/items/qquickopenglinfo.cpp index 7f5364031a..73f9c85e94 100644 --- a/src/quick/items/qquickopenglinfo.cpp +++ b/src/quick/items/qquickopenglinfo.cpp @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE */ QQuickOpenGLInfo::QQuickOpenGLInfo(QQuickItem *item) : QObject(item) - , m_window(0) + , m_window(nullptr) , m_majorVersion(2) , m_minorVersion(0) , m_profile(NoProfile) @@ -150,12 +150,12 @@ QQuickOpenGLInfo *QQuickOpenGLInfo::qmlAttachedProperties(QObject *object) { if (QQuickItem *item = qobject_cast<QQuickItem *>(object)) return new QQuickOpenGLInfo(item); - return 0; + return nullptr; } void QQuickOpenGLInfo::updateFormat() { - QOpenGLContext *context = 0; + QOpenGLContext *context = nullptr; if (m_window) context = m_window->openglContext(); QSurfaceFormat format = context ? context->format() : QSurfaceFormat::defaultFormat(); diff --git a/src/quick/items/qquickopenglshadereffect.cpp b/src/quick/items/qquickopenglshadereffect.cpp index 3194aa3cd0..cad598d2c0 100644 --- a/src/quick/items/qquickopenglshadereffect.cpp +++ b/src/quick/items/qquickopenglshadereffect.cpp @@ -484,7 +484,7 @@ void QQuickOpenGLShaderEffectCommon::updateMaterial(QQuickOpenGLShaderEffectNode if (d.specialType != UniformData::Sampler && d.specialType != UniformData::SamplerExternal) continue; QSGTextureProvider *oldProvider = material->textureProviders.at(index); - QSGTextureProvider *newProvider = 0; + QSGTextureProvider *newProvider = nullptr; QQuickItem *source = qobject_cast<QQuickItem *>(qvariant_cast<QObject *>(d.value)); if (source && source->isTextureProvider()) newProvider = source->textureProvider(); @@ -624,7 +624,7 @@ QQuickOpenGLShaderEffect::QQuickOpenGLShaderEffect(QQuickShaderEffect *item, QOb , m_item(item) , m_itemMetaObject(nullptr) , m_meshResolution(1, 1) - , m_mesh(0) + , m_mesh(nullptr) , m_cullMode(QQuickShaderEffect::NoCulling) , m_status(QQuickShaderEffect::Uncompiled) , m_common(this, [this](int mappedId){this->propertyChanged(mappedId);}) @@ -713,7 +713,7 @@ void QQuickOpenGLShaderEffect::setMesh(const QVariant &mesh) if (newMesh && newMesh == m_mesh) return; if (m_mesh) - disconnect(m_mesh, SIGNAL(geometryChanged()), this, 0); + disconnect(m_mesh, SIGNAL(geometryChanged()), this, nullptr); m_mesh = newMesh; if (m_mesh) { connect(m_mesh, SIGNAL(geometryChanged()), this, SLOT(updateGeometry())); @@ -766,7 +766,7 @@ QString QQuickOpenGLShaderEffect::parseLog() maybeUpdateShaders(true); if (m_dirtyParseLog) { - m_common.updateParseLog(m_mesh != 0); + m_common.updateParseLog(m_mesh != nullptr); m_dirtyParseLog = false; } return m_common.parseLog; @@ -838,7 +838,7 @@ QSGNode *QQuickOpenGLShaderEffect::handleUpdatePaintNode(QSGNode *oldNode, QQuic if (m_common.attributes.isEmpty() || m_item->width() <= 0 || m_item->height() <= 0) { if (node) delete node; - return 0; + return nullptr; } if (!node) { @@ -914,7 +914,7 @@ QSGNode *QQuickOpenGLShaderEffect::handleUpdatePaintNode(QSGNode *oldNode, QQuic } if (m_dirtyMesh) { - node->setGeometry(0); + node->setGeometry(nullptr); m_dirtyMesh = false; m_dirtyGeometry = true; } @@ -935,7 +935,7 @@ QSGNode *QQuickOpenGLShaderEffect::handleUpdatePaintNode(QSGNode *oldNode, QQuic emit m_item->statusChanged(); } delete node; - return 0; + return nullptr; } geometry = mesh->updateGeometry(geometry, m_common.attributes.count(), posIndex, srcRect, rect); diff --git a/src/quick/items/qquickopenglshadereffect_p.h b/src/quick/items/qquickopenglshadereffect_p.h index bc2e2975ee..3d1d8c426c 100644 --- a/src/quick/items/qquickopenglshadereffect_p.h +++ b/src/quick/items/qquickopenglshadereffect_p.h @@ -120,7 +120,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickOpenGLShaderEffect : public QObject Q_OBJECT public: - QQuickOpenGLShaderEffect(QQuickShaderEffect *item, QObject *parent = 0); + QQuickOpenGLShaderEffect(QQuickShaderEffect *item, QObject *parent = nullptr); ~QQuickOpenGLShaderEffect(); QByteArray fragmentShader() const { return m_common.source.sourceCode[Key::FragmentShader]; } diff --git a/src/quick/items/qquickopenglshadereffectnode.cpp b/src/quick/items/qquickopenglshadereffectnode.cpp index a6431135eb..d51419a275 100644 --- a/src/quick/items/qquickopenglshadereffectnode.cpp +++ b/src/quick/items/qquickopenglshadereffectnode.cpp @@ -111,7 +111,7 @@ void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMateri { typedef QQuickOpenGLShaderEffectMaterial::UniformData UniformData; - Q_ASSERT(newEffect != 0); + Q_ASSERT(newEffect != nullptr); QQuickOpenGLShaderEffectMaterial *material = static_cast<QQuickOpenGLShaderEffectMaterial *>(newEffect); if (!material->m_emittedLogChanged && material->m_node) { @@ -239,7 +239,7 @@ void QQuickCustomMaterialShader::updateState(const RenderState &state, QSGMateri functions->glActiveTexture(GL_TEXTURE0); const QQuickOpenGLShaderEffectMaterial *oldMaterial = static_cast<const QQuickOpenGLShaderEffectMaterial *>(oldEffect); - if (oldEffect == 0 || material->cullMode != oldMaterial->cullMode) { + if (oldEffect == nullptr || material->cullMode != oldMaterial->cullMode) { switch (material->cullMode) { case QQuickShaderEffect::FrontFaceCulling: functions->glEnable(GL_CULL_FACE); diff --git a/src/quick/items/qquickopenglshadereffectnode_p.h b/src/quick/items/qquickopenglshadereffectnode_p.h index 68eece7660..029533ac9d 100644 --- a/src/quick/items/qquickopenglshadereffectnode_p.h +++ b/src/quick/items/qquickopenglshadereffectnode_p.h @@ -109,7 +109,7 @@ public: } }; - explicit QQuickOpenGLShaderEffectMaterial(QQuickOpenGLShaderEffectNode *node = 0); + explicit QQuickOpenGLShaderEffectMaterial(QQuickOpenGLShaderEffectNode *node = nullptr); QSGMaterialType *type() const override; QSGMaterialShader *createShader() const override; int compare(const QSGMaterial *other) const override; diff --git a/src/quick/items/qquickpainteditem.cpp b/src/quick/items/qquickpainteditem.cpp index 34d71f00e8..197c4c6348 100644 --- a/src/quick/items/qquickpainteditem.cpp +++ b/src/quick/items/qquickpainteditem.cpp @@ -53,7 +53,7 @@ class QQuickPaintedItemTextureProvider : public QSGTextureProvider { public: QSGPainterNode *node; - QSGTexture *texture() const override { return node ? node->texture() : 0; } + QSGTexture *texture() const override { return node ? node->texture() : nullptr; } void fireTextureChanged() { emit textureChanged(); } }; @@ -133,12 +133,12 @@ QQuickPaintedItemPrivate::QQuickPaintedItemPrivate() , contentsScale(1.0) , fillColor(Qt::transparent) , renderTarget(QQuickPaintedItem::Image) - , performanceHints(0) + , performanceHints(nullptr) , opaquePainting(false) , antialiasing(false) , mipmap(false) - , textureProvider(0) - , node(0) + , textureProvider(nullptr) + , node(nullptr) { } @@ -566,10 +566,10 @@ QSGNode *QQuickPaintedItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat if (width() <= 0 || height() <= 0) { delete oldNode; if (d->textureProvider) { - d->textureProvider->node = 0; + d->textureProvider->node = nullptr; d->textureProvider->fireTextureChanged(); } - return 0; + return nullptr; } QSGPainterNode *node = static_cast<QSGPainterNode *>(oldNode); @@ -628,17 +628,17 @@ void QQuickPaintedItem::releaseResources() Q_D(QQuickPaintedItem); if (d->textureProvider) { QQuickWindowQObjectCleanupJob::schedule(window(), d->textureProvider); - d->textureProvider = 0; + d->textureProvider = nullptr; } - d->node = 0; // Managed by the scene graph, just clear the pointer. + d->node = nullptr; // Managed by the scene graph, just clear the pointer. } void QQuickPaintedItem::invalidateSceneGraph() { Q_D(QQuickPaintedItem); delete d->textureProvider; - d->textureProvider = 0; - d->node = 0; // Managed by the scene graph, just clear the pointer + d->textureProvider = nullptr; + d->node = nullptr; // Managed by the scene graph, just clear the pointer } /*! @@ -666,7 +666,7 @@ QSGTextureProvider *QQuickPaintedItem::textureProvider() const QQuickWindow *w = window(); if (!w || !w->openglContext() || QThread::currentThread() != w->openglContext()->thread()) { qWarning("QQuickPaintedItem::textureProvider: can only be queried on the rendering thread of an exposed window"); - return 0; + return nullptr; } #endif if (!d->textureProvider) diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index b9fea974ce..be94cdef42 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -66,7 +66,7 @@ const qreal MinimumFlickVelocity = 75.0; static QQmlOpenMetaObjectType *qPathViewAttachedType = nullptr; QQuickPathViewAttached::QQuickPathViewAttached(QObject *parent) -: QObject(parent), m_percent(-1), m_view(0), m_onPath(false), m_isCurrent(false) +: QObject(parent), m_percent(-1), m_view(nullptr), m_onPath(false), m_isCurrent(false) { if (qPathViewAttachedType) { m_metaobject = new QQmlOpenMetaObject(this, qPathViewAttachedType); diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 9f10705449..7ae0f9b7e3 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -151,7 +151,7 @@ QT_BEGIN_NAMESPACE */ QQuickPinch::QQuickPinch() - : m_target(0), m_minScale(1.0), m_maxScale(1.0) + : m_target(nullptr), m_minScale(1.0), m_maxScale(1.0) , m_minRotation(0.0), m_maxRotation(0.0) , m_axis(NoDrag), m_xmin(-FLT_MAX), m_xmax(FLT_MAX) , m_ymin(-FLT_MAX), m_ymax(FLT_MAX), m_active(false) diff --git a/src/quick/items/qquickpincharea_p.h b/src/quick/items/qquickpincharea_p.h index 2363f1e2d4..8eff53e6dc 100644 --- a/src/quick/items/qquickpincharea_p.h +++ b/src/quick/items/qquickpincharea_p.h @@ -84,7 +84,7 @@ public: void resetTarget() { if (!m_target) return; - m_target = 0; + m_target = nullptr; Q_EMIT targetChanged(); } @@ -270,7 +270,7 @@ class Q_AUTOTEST_EXPORT QQuickPinchArea : public QQuickItem Q_PROPERTY(QQuickPinch *pinch READ pinch CONSTANT) public: - QQuickPinchArea(QQuickItem *parent=0); + QQuickPinchArea(QQuickItem *parent=nullptr); ~QQuickPinchArea(); bool isEnabled() const; diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index e752e2538f..493db51666 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -69,7 +69,7 @@ void QQuickBasePositionerPrivate::unwatchChanges(QQuickItem* other) QQuickBasePositioner::PositionedItem::PositionedItem(QQuickItem *i) : item(i) - , transitionableItem(0) + , transitionableItem(nullptr) , index(-1) , isNew(false) , isVisible(true) @@ -203,7 +203,7 @@ void QQuickBasePositioner::setSpacing(qreal s) QQuickTransition *QQuickBasePositioner::populate() const { Q_D(const QQuickBasePositioner); - return d->transitioner ? d->transitioner->populateTransition : 0; + return d->transitioner ? d->transitioner->populateTransition : nullptr; } void QQuickBasePositioner::setPopulate(QQuickTransition *transition) @@ -220,7 +220,7 @@ void QQuickBasePositioner::setPopulate(QQuickTransition *transition) QQuickTransition *QQuickBasePositioner::move() const { Q_D(const QQuickBasePositioner); - return d->transitioner ? d->transitioner->displacedTransition : 0; + return d->transitioner ? d->transitioner->displacedTransition : nullptr; } void QQuickBasePositioner::setMove(QQuickTransition *mt) @@ -238,7 +238,7 @@ void QQuickBasePositioner::setMove(QQuickTransition *mt) QQuickTransition *QQuickBasePositioner::add() const { Q_D(const QQuickBasePositioner); - return d->transitioner ? d->transitioner->addTransition : 0; + return d->transitioner ? d->transitioner->addTransition : nullptr; } void QQuickBasePositioner::setAdd(QQuickTransition *add) @@ -460,15 +460,15 @@ void QQuickBasePositioner::updateAttachedProperties(QQuickPositionerAttached *sp // be changed to run only when there are attached properties present. This // could be a flag in the positioner that is set by the attached property // constructor. - QQuickPositionerAttached *prevLastProperty = 0; - QQuickPositionerAttached *lastProperty = 0; + QQuickPositionerAttached *prevLastProperty = nullptr; + QQuickPositionerAttached *lastProperty = nullptr; for (int ii = 0; ii < positionedItems.count(); ++ii) { const PositionedItem &child = positionedItems.at(ii); if (!child.item) continue; - QQuickPositionerAttached *property = 0; + QQuickPositionerAttached *property = nullptr; if (specificProperty) { if (specificPropertyOwner == child.item) { @@ -503,7 +503,7 @@ void QQuickBasePositioner::updateAttachedProperties(QQuickPositionerAttached *sp if (!child.item) continue; - QQuickPositionerAttached *property = 0; + QQuickPositionerAttached *property = nullptr; if (specificProperty) { if (specificPropertyOwner == child.item) { diff --git a/src/quick/items/qquickpositioners_p.h b/src/quick/items/qquickpositioners_p.h index ce583aefe8..94a737e1f1 100644 --- a/src/quick/items/qquickpositioners_p.h +++ b/src/quick/items/qquickpositioners_p.h @@ -132,7 +132,7 @@ public: static QQuickPositionerAttached *qmlAttachedProperties(QObject *obj); - void updateAttachedProperties(QQuickPositionerAttached *specificProperty = 0, QQuickItem *specificPropertyOwner = 0) const; + void updateAttachedProperties(QQuickPositionerAttached *specificProperty = nullptr, QQuickItem *specificPropertyOwner = nullptr) const; qreal padding() const; void setPadding(qreal padding); @@ -231,7 +231,7 @@ class Q_AUTOTEST_EXPORT QQuickColumn : public QQuickBasePositioner { Q_OBJECT public: - QQuickColumn(QQuickItem *parent=0); + QQuickColumn(QQuickItem *parent=nullptr); protected: void doPositioning(QSizeF *contentSize) override; @@ -247,7 +247,7 @@ class Q_AUTOTEST_EXPORT QQuickRow: public QQuickBasePositioner Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged) public: - QQuickRow(QQuickItem *parent=0); + QQuickRow(QQuickItem *parent=nullptr); Qt::LayoutDirection layoutDirection() const; void setLayoutDirection (Qt::LayoutDirection); @@ -281,7 +281,7 @@ class Q_AUTOTEST_EXPORT QQuickGrid : public QQuickBasePositioner Q_PROPERTY(VAlignment verticalItemAlignment READ vItemAlign WRITE setVItemAlign NOTIFY verticalAlignmentChanged REVISION 1) public: - QQuickGrid(QQuickItem *parent=0); + QQuickGrid(QQuickItem *parent=nullptr); int rows() const { return m_rows; } void setRows(const int rows); @@ -360,7 +360,7 @@ class Q_AUTOTEST_EXPORT QQuickFlow: public QQuickBasePositioner Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged) Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged) public: - QQuickFlow(QQuickItem *parent=0); + QQuickFlow(QQuickItem *parent=nullptr); enum Flow { LeftToRight, TopToBottom }; Q_ENUM(Flow) diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp index 9308553a79..3895f59ae1 100644 --- a/src/quick/items/qquickrectangle.cpp +++ b/src/quick/items/qquickrectangle.cpp @@ -414,7 +414,7 @@ void QQuickRectangle::setGradient(QQuickGradient *gradient) void QQuickRectangle::resetGradient() { - setGradient(0); + setGradient(nullptr); } /*! @@ -489,7 +489,7 @@ QSGNode *QQuickRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData if (width() <= 0 || height() <= 0 || (d->color.alpha() == 0 && (!d->pen || d->pen->width() == 0 || d->pen->color().alpha() == 0))) { delete oldNode; - return 0; + return nullptr; } QSGInternalRectangleNode *rectangle = static_cast<QSGInternalRectangleNode *>(oldNode); diff --git a/src/quick/items/qquickrectangle_p.h b/src/quick/items/qquickrectangle_p.h index 52f0bc975b..636f8c5db6 100644 --- a/src/quick/items/qquickrectangle_p.h +++ b/src/quick/items/qquickrectangle_p.h @@ -67,7 +67,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPen : public QObject Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY penChanged) Q_PROPERTY(bool pixelAligned READ pixelAligned WRITE setPixelAligned NOTIFY penChanged) public: - QQuickPen(QObject *parent=0); + QQuickPen(QObject *parent=nullptr); qreal width() const; void setWidth(qreal w); @@ -98,7 +98,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGradientStop : public QObject Q_PROPERTY(QColor color READ color WRITE setColor) public: - QQuickGradientStop(QObject *parent=0); + QQuickGradientStop(QObject *parent=nullptr); qreal position() const; void setPosition(qreal position); @@ -122,7 +122,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickGradient : public QObject Q_CLASSINFO("DefaultProperty", "stops") public: - QQuickGradient(QObject *parent=0); + QQuickGradient(QObject *parent=nullptr); ~QQuickGradient(); QQmlListProperty<QQuickGradientStop> stops(); @@ -151,7 +151,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRectangle : public QQuickItem Q_PROPERTY(QQuickPen * border READ border CONSTANT) Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged) public: - QQuickRectangle(QQuickItem *parent=0); + QQuickRectangle(QQuickItem *parent=nullptr); QColor color() const; void setColor(const QColor &); diff --git a/src/quick/items/qquickrendercontrol.cpp b/src/quick/items/qquickrendercontrol.cpp index 58b76fa862..49568db552 100644 --- a/src/quick/items/qquickrendercontrol.cpp +++ b/src/quick/items/qquickrendercontrol.cpp @@ -133,11 +133,11 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_ \inmodule QtQuick */ -QSGContext *QQuickRenderControlPrivate::sg = 0; +QSGContext *QQuickRenderControlPrivate::sg = nullptr; QQuickRenderControlPrivate::QQuickRenderControlPrivate() : initialized(0), - window(0) + window(nullptr) { if (!sg) { qAddPostRoutine(cleanup); @@ -149,7 +149,7 @@ QQuickRenderControlPrivate::QQuickRenderControlPrivate() void QQuickRenderControlPrivate::cleanup() { delete sg; - sg = 0; + sg = nullptr; } /*! @@ -173,7 +173,7 @@ QQuickRenderControl::~QQuickRenderControl() invalidate(); if (d->window) - QQuickWindowPrivate::get(d->window)->renderControl = 0; + QQuickWindowPrivate::get(d->window)->renderControl = nullptr; // It is likely that the cleanup in windowDestroyed() is not called since // the standard pattern is to destroy the rendercontrol before the QQuickWindow. @@ -187,16 +187,16 @@ void QQuickRenderControlPrivate::windowDestroyed() { if (window) { rc->invalidate(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); delete QQuickWindowPrivate::get(window)->animationController; - QQuickWindowPrivate::get(window)->animationController = 0; + QQuickWindowPrivate::get(window)->animationController = nullptr; #if QT_CONFIG(quick_shadereffect) && QT_CONFIG(opengl) QQuickOpenGLShaderEffectMaterial::cleanupMaterialCache(); #endif - window = 0; + window = nullptr; } } @@ -452,11 +452,11 @@ void QQuickRenderControlPrivate::maybeUpdate() QWindow *QQuickRenderControl::renderWindowFor(QQuickWindow *win, QPoint *offset) { if (!win) - return 0; + return nullptr; QQuickRenderControl *rc = QQuickWindowPrivate::get(win)->renderControl; if (rc) return rc->renderWindow(offset); - return 0; + return nullptr; } QT_END_NAMESPACE diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp index ba9460bf76..b95fa3c410 100644 --- a/src/quick/items/qquickrepeater.cpp +++ b/src/quick/items/qquickrepeater.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE QQuickRepeaterPrivate::QQuickRepeaterPrivate() - : model(0) + : model(nullptr) , ownModel(false) , dataSourceIsObject(false) , delegateValidated(false) @@ -216,8 +216,8 @@ void QQuickRepeater::setModel(const QVariant &m) d->dataSource = model; QObject *object = qvariant_cast<QObject*>(model); d->dataSourceAsObject = object; - d->dataSourceIsObject = object != 0; - QQmlInstanceModel *vim = 0; + d->dataSourceIsObject = object != nullptr; + QQmlInstanceModel *vim = nullptr; if (object && (vim = qobject_cast<QQmlInstanceModel *>(object))) { if (d->ownModel) { delete d->model; @@ -288,7 +288,7 @@ QQmlComponent *QQuickRepeater::delegate() const return dataModel->delegate(); } - return 0; + return nullptr; } void QQuickRepeater::setDelegate(QQmlComponent *delegate) @@ -339,7 +339,7 @@ QQuickItem *QQuickRepeater::itemAt(int index) const Q_D(const QQuickRepeater); if (index >= 0 && index < d->deletables.count()) return d->deletables[index]; - return 0; + return nullptr; } void QQuickRepeater::componentComplete() @@ -378,7 +378,7 @@ void QQuickRepeater::clear() } for (QQuickItem *item : qAsConst(d->deletables)) { if (item) - item->setParentItem(0); + item->setParentItem(nullptr); } } d->deletables.clear(); @@ -482,7 +482,7 @@ void QQuickRepeater::modelUpdated(const QQmlChangeSet &changeSet, bool reset) emit itemRemoved(index, item); if (item) { d->model->release(item); - item->setParentItem(0); + item->setParentItem(nullptr); } --d->itemCount; } @@ -510,7 +510,7 @@ void QQuickRepeater::modelUpdated(const QQmlChangeSet &changeSet, bool reset) } else for (int i = 0; i < insert.count; ++i) { int modelIndex = index + i; ++d->itemCount; - d->deletables.insert(modelIndex, 0); + d->deletables.insert(modelIndex, nullptr); QObject *object = d->model->object(modelIndex, QQmlIncubator::AsynchronousIfNested); if (object) d->model->release(object); diff --git a/src/quick/items/qquickrepeater_p.h b/src/quick/items/qquickrepeater_p.h index 39e29937f9..dbe3cd0c55 100644 --- a/src/quick/items/qquickrepeater_p.h +++ b/src/quick/items/qquickrepeater_p.h @@ -72,7 +72,7 @@ class Q_AUTOTEST_EXPORT QQuickRepeater : public QQuickItem Q_CLASSINFO("DefaultProperty", "delegate") public: - QQuickRepeater(QQuickItem *parent=0); + QQuickRepeater(QQuickItem *parent=nullptr); virtual ~QQuickRepeater(); QVariant model() const; diff --git a/src/quick/items/qquickscalegrid_p_p.h b/src/quick/items/qquickscalegrid_p_p.h index 7f6a31a7bd..5752f61e3f 100644 --- a/src/quick/items/qquickscalegrid_p_p.h +++ b/src/quick/items/qquickscalegrid_p_p.h @@ -71,7 +71,7 @@ class Q_AUTOTEST_EXPORT QQuickScaleGrid : public QObject Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY borderChanged) public: - QQuickScaleGrid(QObject *parent=0); + QQuickScaleGrid(QObject *parent=nullptr); ~QQuickScaleGrid(); bool isNull() const; diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp index 6a3eab957e..aea7e44a65 100644 --- a/src/quick/items/qquickscreen.cpp +++ b/src/quick/items/qquickscreen.cpp @@ -423,8 +423,8 @@ QScreen *QQuickScreenInfo::wrappedScreen() const QQuickScreenAttached::QQuickScreenAttached(QObject* attachee) : QQuickScreenInfo(attachee) - , m_window(NULL) - , m_updateMask(0) + , m_window(nullptr) + , m_updateMask(nullptr) , m_updateMaskSet(false) { m_attachee = qobject_cast<QQuickItem*>(attachee); @@ -475,7 +475,7 @@ void QQuickScreenAttached::windowChanged(QQuickWindow* c) if (m_window) disconnect(m_window, SIGNAL(screenChanged(QScreen*)), this, SLOT(screenChanged(QScreen*))); m_window = c; - screenChanged(c ? c->screen() : NULL); + screenChanged(c ? c->screen() : nullptr); if (c) connect(c, SIGNAL(screenChanged(QScreen*)), this, SLOT(screenChanged(QScreen*))); } diff --git a/src/quick/items/qquickshadereffect_p.h b/src/quick/items/qquickshadereffect_p.h index 30bd018098..cabad930fc 100644 --- a/src/quick/items/qquickshadereffect_p.h +++ b/src/quick/items/qquickshadereffect_p.h @@ -91,7 +91,7 @@ public: }; Q_ENUM(Status) - QQuickShaderEffect(QQuickItem *parent = 0); + QQuickShaderEffect(QQuickItem *parent = nullptr); QByteArray fragmentShader() const; void setFragmentShader(const QByteArray &code); diff --git a/src/quick/items/qquickshadereffectmesh_p.h b/src/quick/items/qquickshadereffectmesh_p.h index f3ac956f60..5d6641429a 100644 --- a/src/quick/items/qquickshadereffectmesh_p.h +++ b/src/quick/items/qquickshadereffectmesh_p.h @@ -76,7 +76,7 @@ class QQuickShaderEffectMesh : public QObject { Q_OBJECT public: - QQuickShaderEffectMesh(QObject *parent = 0); + QQuickShaderEffectMesh(QObject *parent = nullptr); virtual bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) = 0; // If 'geometry' != 0, 'attrCount' is the same as last time the function was called. virtual QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex, @@ -94,7 +94,7 @@ class QQuickGridMesh : public QQuickShaderEffectMesh Q_OBJECT Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged) public: - QQuickGridMesh(QObject *parent = 0); + QQuickGridMesh(QObject *parent = nullptr); bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) override; QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex, const QRectF &srcRect, const QRectF &rect) override; @@ -121,7 +121,7 @@ class QQuickBorderImageMesh : public QQuickShaderEffectMesh Q_PROPERTY(TileMode horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode NOTIFY horizontalTileModeChanged) Q_PROPERTY(TileMode verticalTileMode READ verticalTileMode WRITE setVerticalTileMode NOTIFY verticalTileModeChanged) public: - QQuickBorderImageMesh(QObject *parent = 0); + QQuickBorderImageMesh(QObject *parent = nullptr); bool validateAttributes(const QVector<QByteArray> &attributes, int *posIndex) override; QSGGeometry *updateGeometry(QSGGeometry *geometry, int attrCount, int posIndex, diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp index b4a45431c5..4782672858 100644 --- a/src/quick/items/qquickshadereffectsource.cpp +++ b/src/quick/items/qquickshadereffectsource.cpp @@ -56,7 +56,7 @@ class QQuickShaderEffectSourceTextureProvider : public QSGTextureProvider Q_OBJECT public: QQuickShaderEffectSourceTextureProvider() - : sourceTexture(0) + : sourceTexture(nullptr) , mipmapFiltering(QSGTexture::None) , filtering(QSGTexture::Nearest) , horizontalWrap(QSGTexture::ClampToEdge) @@ -183,10 +183,10 @@ public: QQuickShaderEffectSource::QQuickShaderEffectSource(QQuickItem *parent) : QQuickItem(parent) - , m_provider(0) - , m_texture(0) + , m_provider(nullptr) + , m_texture(nullptr) , m_wrapMode(ClampToEdge) - , m_sourceItem(0) + , m_sourceItem(nullptr) , m_textureSize(0, 0) , m_format(RGBA) , m_samples(0) @@ -246,7 +246,7 @@ QSGTextureProvider *QQuickShaderEffectSource::textureProvider() const const QQuickItemPrivate *d = QQuickItemPrivate::get(this); if (!d->window || !d->sceneGraphRenderContext() || QThread::currentThread() != d->sceneGraphRenderContext()->thread()) { qWarning("QQuickShaderEffectSource::textureProvider: can only be queried on the rendering thread of an exposed window"); - return 0; + return nullptr; } if (!m_provider) { @@ -334,8 +334,8 @@ void QQuickShaderEffectSource::setSourceItem(QQuickItem *item) if (m_sourceItem) { if (window() == m_sourceItem->window() - || (window() == 0 && m_sourceItem->window()) - || (m_sourceItem->window() == 0 && window())) { + || (window() == nullptr && m_sourceItem->window()) + || (m_sourceItem->window() == nullptr && window())) { QQuickItemPrivate *d = QQuickItemPrivate::get(item); // 'item' needs a window to get a scene graph node. It usually gets one through its // parent, but if the source item is "inline" rather than a reference -- i.e. @@ -350,7 +350,7 @@ void QQuickShaderEffectSource::setSourceItem(QQuickItem *item) connect(m_sourceItem, SIGNAL(destroyed(QObject*)), this, SLOT(sourceItemDestroyed(QObject*))); } else { qWarning("ShaderEffectSource: sourceItem and ShaderEffectSource must both be children of the same window."); - m_sourceItem = 0; + m_sourceItem = nullptr; } } update(); @@ -361,7 +361,7 @@ void QQuickShaderEffectSource::sourceItemDestroyed(QObject *item) { Q_ASSERT(item == m_sourceItem); Q_UNUSED(item); - m_sourceItem = 0; + m_sourceItem = nullptr; update(); emit sourceItemChanged(); } @@ -662,8 +662,8 @@ void QQuickShaderEffectSource::releaseResources() if (m_texture || m_provider) { window()->scheduleRenderJob(new QQuickShaderEffectSourceCleanup(m_texture, m_provider), QQuickWindow::AfterSynchronizingStage); - m_texture = 0; - m_provider = 0; + m_texture = nullptr; + m_provider = nullptr; } } @@ -684,9 +684,9 @@ QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaint { if (!m_sourceItem || m_sourceItem->width() <= 0 || m_sourceItem->height() <= 0) { if (m_texture) - m_texture->setItem(0); + m_texture->setItem(nullptr); delete oldNode; - return 0; + return nullptr; } ensureTexture(); @@ -745,7 +745,7 @@ QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaint // Don't create the paint node if we're not spanning any area if (width() <= 0 || height() <= 0) { delete oldNode; - return 0; + return nullptr; } QSGInternalImageNode *node = static_cast<QSGInternalImageNode *>(oldNode); @@ -779,8 +779,8 @@ void QQuickShaderEffectSource::invalidateSceneGraph() delete m_texture; if (m_provider) delete m_provider; - m_texture = 0; - m_provider = 0; + m_texture = nullptr; + m_provider = nullptr; } void QQuickShaderEffectSource::itemChange(ItemChange change, const ItemChangeData &value) diff --git a/src/quick/items/qquickshadereffectsource_p.h b/src/quick/items/qquickshadereffectsource_p.h index 185c5179b6..f70550f284 100644 --- a/src/quick/items/qquickshadereffectsource_p.h +++ b/src/quick/items/qquickshadereffectsource_p.h @@ -113,7 +113,7 @@ public: }; Q_ENUM(TextureMirroring) - QQuickShaderEffectSource(QQuickItem *parent = 0); + QQuickShaderEffectSource(QQuickItem *parent = nullptr); ~QQuickShaderEffectSource(); WrapMode wrapMode() const; diff --git a/src/quick/items/qquicksprite.cpp b/src/quick/items/qquicksprite.cpp index 42b8fb8174..99b1b1f430 100644 --- a/src/quick/items/qquicksprite.cpp +++ b/src/quick/items/qquicksprite.cpp @@ -100,7 +100,7 @@ QT_BEGIN_NAMESPACE /*! \qmlproperty int QtQuick::Sprite::frameDuration - Duration of each frame of the animation. Values below 0 are invalid. + Duration of each frame of the animation in milliseconds. Values below 0 are invalid. If frameRate is valid then it will be used to calculate the duration of the frames. If not, and frameDuration is valid, then frameDuration will be used. Otherwise duration is used. diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h index 2f7f6da5c0..19cbc416ca 100644 --- a/src/quick/items/qquicksprite_p.h +++ b/src/quick/items/qquicksprite_p.h @@ -88,7 +88,7 @@ class Q_QUICK_EXPORT QQuickSprite : public QQuickStochasticState Q_PROPERTY(int frameDurationVariation READ frameDurationVariation WRITE setFrameDurationVariation NOTIFY frameDurationVariationChanged) public: - explicit QQuickSprite(QObject *parent = 0); + explicit QQuickSprite(QObject *parent = nullptr); ~QQuickSprite(); QUrl source() const diff --git a/src/quick/items/qquickspriteengine_p.h b/src/quick/items/qquickspriteengine_p.h index ff02135799..d6d22b05d8 100644 --- a/src/quick/items/qquickspriteengine_p.h +++ b/src/quick/items/qquickspriteengine_p.h @@ -81,11 +81,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickStochasticState : public QObject //Currently Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) public: - QQuickStochasticState(QObject* parent = 0) + QQuickStochasticState(QObject* parent = nullptr) : QObject(parent) - , m_duration(-1) - , m_durationVariation(0) - , m_randomStart(false) { } @@ -179,11 +176,11 @@ public Q_SLOTS: private: QString m_name; QVariantMap m_to; - int m_duration; - int m_durationVariation; + int m_duration = -1; + int m_durationVariation = 0; friend class QQuickStochasticEngine; - bool m_randomStart; + bool m_randomStart = false; }; class Q_QUICK_PRIVATE_EXPORT QQuickStochasticEngine : public QObject @@ -193,8 +190,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickStochasticEngine : public QObject Q_PROPERTY(QString globalGoal READ globalGoal WRITE setGlobalGoal NOTIFY globalGoalChanged) Q_PROPERTY(QQmlListProperty<QQuickStochasticState> states READ states) public: - explicit QQuickStochasticEngine(QObject *parent = 0); - QQuickStochasticEngine(const QList<QQuickStochasticState*> &states, QObject *parent = 0); + explicit QQuickStochasticEngine(QObject *parent = nullptr); + QQuickStochasticEngine(const QList<QQuickStochasticState*> &states, QObject *parent = nullptr); ~QQuickStochasticEngine(); QQmlListProperty<QQuickStochasticState> states() @@ -270,8 +267,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickSpriteEngine : public QQuickStochasticEngine Q_OBJECT Q_PROPERTY(QQmlListProperty<QQuickSprite> sprites READ sprites) public: - explicit QQuickSpriteEngine(QObject *parent = 0); - QQuickSpriteEngine(const QList<QQuickSprite*> &sprites, QObject *parent = 0); + explicit QQuickSpriteEngine(QObject *parent = nullptr); + QQuickSpriteEngine(const QList<QQuickSprite*> &sprites, QObject *parent = nullptr); ~QQuickSpriteEngine(); QQmlListProperty<QQuickSprite> sprites() { @@ -303,7 +300,7 @@ public: QImage assembledImage(int maxSize = 2048); private: - int pseudospriteProgress(int, int, int *rd = 0) const; + int pseudospriteProgress(int, int, int *rd = nullptr) const; QList<QQuickSprite*> m_sprites; bool m_startedImageAssembly; bool m_loaded; diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp index ae466aa482..0a39c09ebc 100644 --- a/src/quick/items/qquickspritesequence.cpp +++ b/src/quick/items/qquickspritesequence.cpp @@ -199,7 +199,7 @@ void QQuickSpriteSequence::createEngine() if (!d->m_goalState.isEmpty()) d->m_spriteEngine->setGoal(d->m_spriteEngine->stateIndex(d->m_goalState)); } else { - d->m_spriteEngine = 0; + d->m_spriteEngine = nullptr; } reset(); } diff --git a/src/quick/items/qquickspritesequence_p.h b/src/quick/items/qquickspritesequence_p.h index ffcefecaec..899ce79e0e 100644 --- a/src/quick/items/qquickspritesequence_p.h +++ b/src/quick/items/qquickspritesequence_p.h @@ -77,7 +77,7 @@ class Q_AUTOTEST_EXPORT QQuickSpriteSequence : public QQuickItem Q_CLASSINFO("DefaultProperty", "sprites") public: - explicit QQuickSpriteSequence(QQuickItem *parent = 0); + explicit QQuickSpriteSequence(QQuickItem *parent = nullptr); QQmlListProperty<QQuickSprite> sprites(); diff --git a/src/quick/items/qquickstateoperations.cpp b/src/quick/items/qquickstateoperations.cpp index 386bb058b5..a85b9663d3 100644 --- a/src/quick/items/qquickstateoperations.cpp +++ b/src/quick/items/qquickstateoperations.cpp @@ -51,8 +51,8 @@ class QQuickParentChangePrivate : public QQuickStateOperationPrivate { Q_DECLARE_PUBLIC(QQuickParentChange) public: - QQuickParentChangePrivate() : target(0), parent(0), origParent(0), origStackBefore(0), - rewindParent(0), rewindStackBefore(0) {} + QQuickParentChangePrivate() : target(nullptr), parent(nullptr), origParent(nullptr), origStackBefore(nullptr), + rewindParent(nullptr), rewindStackBefore(nullptr) {} QQuickItem *target; QPointer<QQuickItem> parent; @@ -68,7 +68,7 @@ public: QQmlNullableValue<QQmlScriptString> scaleString; QQmlNullableValue<QQmlScriptString> rotationString; - void doChange(QQuickItem *targetParent, QQuickItem *stackBefore = 0); + void doChange(QQuickItem *targetParent, QQuickItem *stackBefore = nullptr); }; void QQuickParentChangePrivate::doChange(QQuickItem *targetParent, QQuickItem *stackBefore) @@ -524,13 +524,13 @@ void QQuickParentChange::saveCurrentValues() { Q_D(QQuickParentChange); if (!d->target) { - d->rewindParent = 0; - d->rewindStackBefore = 0; + d->rewindParent = nullptr; + d->rewindStackBefore = nullptr; return; } d->rewindParent = d->target->parentItem(); - d->rewindStackBefore = 0; + d->rewindStackBefore = nullptr; if (!d->rewindParent) return; @@ -588,7 +588,7 @@ class QQuickAnchorSetPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickAnchorSet) public: QQuickAnchorSetPrivate() - : usedAnchors(0), resetAnchors(0) + : usedAnchors(nullptr), resetAnchors(nullptr) { } @@ -771,7 +771,7 @@ class QQuickAnchorChangesPrivate : public QQuickStateOperationPrivate { public: QQuickAnchorChangesPrivate() - : target(0), anchorSet(new QQuickAnchorSet) + : target(nullptr), anchorSet(new QQuickAnchorSet) { } @@ -855,7 +855,7 @@ QQuickAnchorChanges::ActionList QQuickAnchorChanges::actions() Q_D(QQuickAnchorChanges); //### ASSERT these are all 0? d->leftBinding = d->rightBinding = d->hCenterBinding = d->topBinding - = d->bottomBinding = d->vCenterBinding = d->baselineBinding = 0; + = d->bottomBinding = d->vCenterBinding = d->baselineBinding = nullptr; d->leftProp = QQmlProperty(d->target, QLatin1String("anchors.left")); d->rightProp = QQmlProperty(d->target, QLatin1String("anchors.right")); @@ -1236,20 +1236,20 @@ void QQuickAnchorChanges::copyOriginals(QQuickStateActionEvent *other) //clear old values from other //### could this be generalized for all QQuickStateActionEvents, and called after copyOriginals? - acp->leftBinding = 0; - acp->rightBinding = 0; - acp->hCenterBinding = 0; - acp->topBinding = 0; - acp->bottomBinding = 0; - acp->vCenterBinding = 0; - acp->baselineBinding = 0; - acp->origLeftBinding = 0; - acp->origRightBinding = 0; - acp->origHCenterBinding = 0; - acp->origTopBinding = 0; - acp->origBottomBinding = 0; - acp->origVCenterBinding = 0; - acp->origBaselineBinding = 0; + acp->leftBinding = nullptr; + acp->rightBinding = nullptr; + acp->hCenterBinding = nullptr; + acp->topBinding = nullptr; + acp->bottomBinding = nullptr; + acp->vCenterBinding = nullptr; + acp->baselineBinding = nullptr; + acp->origLeftBinding = nullptr; + acp->origRightBinding = nullptr; + acp->origHCenterBinding = nullptr; + acp->origTopBinding = nullptr; + acp->origBottomBinding = nullptr; + acp->origVCenterBinding = nullptr; + acp->origBaselineBinding = nullptr; saveCurrentValues(); } diff --git a/src/quick/items/qquickstateoperations_p.h b/src/quick/items/qquickstateoperations_p.h index d61ed294cb..e947b2213f 100644 --- a/src/quick/items/qquickstateoperations_p.h +++ b/src/quick/items/qquickstateoperations_p.h @@ -75,7 +75,7 @@ class Q_AUTOTEST_EXPORT QQuickParentChange : public QQuickStateOperation, public Q_PROPERTY(QQmlScriptString scale READ scale WRITE setScale) Q_PROPERTY(QQmlScriptString rotation READ rotation WRITE setRotation) public: - QQuickParentChange(QObject *parent=0); + QQuickParentChange(QObject *parent=nullptr); ~QQuickParentChange(); QQuickItem *object() const; @@ -138,7 +138,7 @@ class Q_AUTOTEST_EXPORT QQuickAnchorSet : public QObject Q_PROPERTY(QQmlScriptString baseline READ baseline WRITE setBaseline RESET resetBaseline) public: - QQuickAnchorSet(QObject *parent=0); + QQuickAnchorSet(QObject *parent=nullptr); virtual ~QQuickAnchorSet(); QQmlScriptString left() const; @@ -187,7 +187,7 @@ class Q_AUTOTEST_EXPORT QQuickAnchorChanges : public QQuickStateOperation, publi Q_PROPERTY(QQuickAnchorSet *anchors READ anchors CONSTANT) public: - QQuickAnchorChanges(QObject *parent=0); + QQuickAnchorChanges(QObject *parent=nullptr); ~QQuickAnchorChanges(); ActionList actions() override; diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index d601087296..383aa2b821 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -74,7 +74,7 @@ Q_DECLARE_LOGGING_CATEGORY(DBG_HOVER_TRACE) const QChar QQuickTextPrivate::elideChar = QChar(0x2026); QQuickTextPrivate::QQuickTextPrivate() - : fontInfo(font), elideLayout(0), textLine(0), lineWidth(0) + : fontInfo(font), elideLayout(nullptr), textLine(nullptr), lineWidth(0) , color(0xFF000000), linkColor(0xFF0000FF), styleColor(0xFF000000) , lineCount(1), multilengthEos(-1) , elideMode(QQuickText::ElideNone), hAlign(QQuickText::AlignLeft), vAlign(QQuickText::AlignTop) @@ -103,7 +103,7 @@ QQuickTextPrivate::ExtraData::ExtraData() , explicitRightPadding(false) , explicitBottomPadding(false) , lineHeight(1.0) - , doc(0) + , doc(nullptr) , minimumPixelSize(12) , minimumPointSize(12) , nbActiveDownloads(0) @@ -124,7 +124,7 @@ void QQuickTextPrivate::init() QQuickTextPrivate::~QQuickTextPrivate() { delete elideLayout; - delete textLine; textLine = 0; + delete textLine; textLine = nullptr; if (extra.isAllocated()) { qDeleteAll(extra->imgTags); @@ -478,7 +478,7 @@ void QQuickTextPrivate::updateSize() } QQuickTextLine::QQuickTextLine() - : QObject(), m_line(0), m_height(0), m_lineOffset(0) + : QObject(), m_line(nullptr), m_height(0), m_lineOffset(0) { } @@ -1110,7 +1110,7 @@ QRectF QQuickTextPrivate::setupTextLayout(qreal *const baseline) layout.clearLayout(); } else { delete elideLayout; - elideLayout = 0; + elideLayout = nullptr; } QTextLine firstLine = visibleCount == 1 && elideLayout @@ -2363,10 +2363,10 @@ QSGNode *QQuickText::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data if (d->text.isEmpty()) { delete oldNode; - return 0; + return nullptr; } - if (d->updateType != QQuickTextPrivate::UpdatePaintNode && oldNode != 0) { + if (d->updateType != QQuickTextPrivate::UpdatePaintNode && oldNode != nullptr) { // Update done in preprocess() in the nodes d->updateType = QQuickTextPrivate::UpdateNone; return oldNode; @@ -2376,7 +2376,7 @@ QSGNode *QQuickText::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data const qreal dy = QQuickTextUtil::alignedY(d->layedOutTextRect.height() + d->lineHeightOffset(), d->availableHeight(), d->vAlign) + topPadding(); - QQuickTextNode *node = 0; + QQuickTextNode *node = nullptr; if (!oldNode) node = new QQuickTextNode(this); else @@ -2918,14 +2918,14 @@ void QQuickText::invalidateFontCaches() { Q_D(QQuickText); - if (d->richText && d->extra.isAllocated() && d->extra->doc != 0) { + if (d->richText && d->extra.isAllocated() && d->extra->doc != nullptr) { QTextBlock block; for (block = d->extra->doc->firstBlock(); block.isValid(); block = block.next()) { - if (block.layout() != 0 && block.layout()->engine() != 0) + if (block.layout() != nullptr && block.layout()->engine() != nullptr) block.layout()->engine()->resetFontEngineCache(); } } else { - if (d->layout.engine() != 0) + if (d->layout.engine() != nullptr) d->layout.engine()->resetFontEngineCache(); } } diff --git a/src/quick/items/qquicktext_p.h b/src/quick/items/qquicktext_p.h index 6c48dd86a9..039ede2bad 100644 --- a/src/quick/items/qquicktext_p.h +++ b/src/quick/items/qquicktext_p.h @@ -102,7 +102,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickText : public QQuickImplicitSizeItem Q_PROPERTY(QSizeF advance READ advance NOTIFY contentSizeChanged REVISION 10) public: - QQuickText(QQuickItem *parent=0); + QQuickText(QQuickItem *parent=nullptr); ~QQuickText(); enum HAlignment { AlignLeft = Qt::AlignLeft, @@ -289,7 +289,7 @@ Q_SIGNALS: Q_REVISION(9) void fontInfoChanged(); protected: - QQuickText(QQuickTextPrivate &dd, QQuickItem *parent = 0); + QQuickText(QQuickTextPrivate &dd, QQuickItem *parent = nullptr); void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; diff --git a/src/quick/items/qquicktext_p_p.h b/src/quick/items/qquicktext_p_p.h index 6fd0876a5f..b0b1492d57 100644 --- a/src/quick/items/qquicktext_p_p.h +++ b/src/quick/items/qquicktext_p_p.h @@ -83,7 +83,7 @@ public: void setLineGeometry(QTextLine &line, qreal lineWidth, qreal &height); int lineHeightOffset() const; - QString elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine = 0) const; + QString elidedText(qreal lineWidth, const QTextLine &line, QTextLine *nextLine = nullptr) const; void elideFormats(int start, int length, int offset, QVector<QTextLayout::FormatRange> *elidedFormats); void clearFormats(); diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index 874c02fc99..e3080dfe48 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -95,7 +95,7 @@ static QTextLine currentTextLine(const QTextCursor &cursor) } QQuickTextControlPrivate::QQuickTextControlPrivate() - : doc(0), + : doc(nullptr), #if QT_CONFIG(im) preeditCursor(0), #endif diff --git a/src/quick/items/qquicktextcontrol_p.h b/src/quick/items/qquicktextcontrol_p.h index 862a81af28..c99736a874 100644 --- a/src/quick/items/qquicktextcontrol_p.h +++ b/src/quick/items/qquicktextcontrol_p.h @@ -77,7 +77,7 @@ class Q_AUTOTEST_EXPORT QQuickTextControl : public QInputControl Q_OBJECT Q_DECLARE_PRIVATE(QQuickTextControl) public: - explicit QQuickTextControl(QTextDocument *doc, QObject *parent = 0); + explicit QQuickTextControl(QTextDocument *doc, QObject *parent = nullptr); virtual ~QQuickTextControl(); QTextDocument *document() const; diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 10abc1176a..352fc48970 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -139,7 +139,7 @@ namespace { class RootNode : public QSGTransformNode { public: - RootNode() : cursorNode(0), frameDecorationsNode(0) + RootNode() : cursorNode(nullptr), frameDecorationsNode(nullptr) { } void resetFrameDecorations(QQuickTextNode* newNode) @@ -1991,12 +1991,12 @@ static inline void updateNodeTransform(QQuickTextNode* node, const QPointF &topL void QQuickTextEdit::invalidateFontCaches() { Q_D(QQuickTextEdit); - if (d->document == 0) + if (d->document == nullptr) return; QTextBlock block; for (block = d->document->firstBlock(); block.isValid(); block = block.next()) { - if (block.layout() != 0 && block.layout()->engine() != 0) + if (block.layout() != nullptr && block.layout()->engine() != nullptr) block.layout()->engine()->resetFontEngineCache(); } } @@ -2014,7 +2014,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * Q_UNUSED(updatePaintNodeData); Q_D(QQuickTextEdit); - if (d->updateType != QQuickTextEditPrivate::UpdatePaintNode && oldNode != 0) { + if (d->updateType != QQuickTextEditPrivate::UpdatePaintNode && oldNode != nullptr) { // Update done in preprocess() in the nodes d->updateType = QQuickTextEditPrivate::UpdateNone; return oldNode; @@ -2055,7 +2055,7 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * rootNode->resetFrameDecorations(d->createTextNode()); resetEngine(&frameDecorationsEngine, d->color, d->selectedTextColor, d->selectionColor); - QQuickTextNode *node = 0; + QQuickTextNode *node = nullptr; int currentNodeSize = 0; int nodeStart = firstDirtyPos; @@ -2159,8 +2159,8 @@ QSGNode *QQuickTextEdit::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData * std::sort(d->textNodeMap.begin(), d->textNodeMap.end()); } - if (d->cursorComponent == 0) { - QSGInternalRectangleNode* cursor = 0; + if (d->cursorComponent == nullptr) { + QSGInternalRectangleNode* cursor = nullptr; if (!isReadOnly() && d->cursorVisible && d->control->cursorOn()) cursor = d->sceneGraphContext()->createInternalRectangleNode(d->control->cursorRect(), d->color); rootNode->resetCursorNode(cursor); diff --git a/src/quick/items/qquicktextedit_p.h b/src/quick/items/qquicktextedit_p.h index c883e39168..7a847ffeae 100644 --- a/src/quick/items/qquicktextedit_p.h +++ b/src/quick/items/qquicktextedit_p.h @@ -114,7 +114,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextEdit : public QQuickImplicitSizeItem Q_PROPERTY(qreal tabStopDistance READ tabStopDistance WRITE setTabStopDistance NOTIFY tabStopDistanceChanged REVISION 10) public: - QQuickTextEdit(QQuickItem *parent=0); + QQuickTextEdit(QQuickItem *parent=nullptr); enum HAlignment { AlignLeft = Qt::AlignLeft, @@ -384,7 +384,7 @@ private: void invalidateFontCaches(); protected: - QQuickTextEdit(QQuickTextEditPrivate &dd, QQuickItem *parent = 0); + QQuickTextEdit(QQuickTextEditPrivate &dd, QQuickItem *parent = nullptr); void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; diff --git a/src/quick/items/qquicktextedit_p_p.h b/src/quick/items/qquicktextedit_p_p.h index ef2bdfd0ea..46d3d5ff6b 100644 --- a/src/quick/items/qquicktextedit_p_p.h +++ b/src/quick/items/qquicktextedit_p_p.h @@ -112,8 +112,8 @@ public: QQuickTextEditPrivate() : color(QRgb(0xFF000000)), selectionColor(QRgb(0xFF000080)), selectedTextColor(QRgb(0xFFFFFFFF)) , textMargin(0.0), xoff(0), yoff(0) - , font(sourceFont), cursorComponent(0), cursorItem(0), document(0), control(0) - , quickDocument(0), lastSelectionStart(0), lastSelectionEnd(0), lineCount(0) + , font(sourceFont), cursorComponent(nullptr), cursorItem(nullptr), document(nullptr), control(nullptr) + , quickDocument(nullptr), lastSelectionStart(0), lastSelectionEnd(0), lineCount(0) , hAlign(QQuickTextEdit::AlignLeft), vAlign(QQuickTextEdit::AlignTop) , format(QQuickTextEdit::PlainText), wrapMode(QQuickTextEdit::NoWrap) , renderType(QQuickTextUtil::textRenderType<QQuickTextEdit>()) diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 557ff393b4..b19c13c5ee 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -1863,7 +1863,7 @@ void QQuickTextInput::invalidateFontCaches() { Q_D(QQuickTextInput); - if (d->m_textLayout.engine() != 0) + if (d->m_textLayout.engine() != nullptr) d->m_textLayout.engine()->resetFontEngineCache(); } @@ -1886,7 +1886,7 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData Q_UNUSED(data); Q_D(QQuickTextInput); - if (d->updateType != QQuickTextInputPrivate::UpdatePaintNode && oldNode != 0) { + if (d->updateType != QQuickTextInputPrivate::UpdatePaintNode && oldNode != nullptr) { // Update done in preprocess() in the nodes d->updateType = QQuickTextInputPrivate::UpdateNone; return oldNode; @@ -1895,13 +1895,13 @@ QSGNode *QQuickTextInput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData d->updateType = QQuickTextInputPrivate::UpdateNone; QQuickTextNode *node = static_cast<QQuickTextNode *>(oldNode); - if (node == 0) + if (node == nullptr) node = new QQuickTextNode(this); d->textNode = node; - const bool showCursor = !isReadOnly() && d->cursorItem == 0 && d->cursorVisible && d->m_blinkStatus; + const bool showCursor = !isReadOnly() && d->cursorItem == nullptr && d->cursorVisible && d->m_blinkStatus; - if (!d->textLayoutDirty && oldNode != 0) { + if (!d->textLayoutDirty && oldNode != nullptr) { if (showCursor) node->setCursor(cursorRectangle(), d->color); else @@ -3828,7 +3828,7 @@ void QQuickTextInputPrivate::parseInputMask(const QString &maskFields) if (maskFields.isEmpty() || delimiter == 0) { if (m_maskData) { delete [] m_maskData; - m_maskData = 0; + m_maskData = nullptr; m_maxLength = 32767; internalSetText(QString()); } diff --git a/src/quick/items/qquicktextinput_p.h b/src/quick/items/qquicktextinput_p.h index b7d3fb00fa..c46a2f8128 100644 --- a/src/quick/items/qquicktextinput_p.h +++ b/src/quick/items/qquicktextinput_p.h @@ -115,7 +115,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTextInput : public QQuickImplicitSizeItem Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged REVISION 6) public: - QQuickTextInput(QQuickItem * parent=0); + QQuickTextInput(QQuickItem * parent=nullptr); ~QQuickTextInput(); void componentComplete() override; @@ -363,7 +363,7 @@ private: void ensureActiveFocus(); protected: - QQuickTextInput(QQuickTextInputPrivate &dd, QQuickItem *parent = 0); + QQuickTextInput(QQuickTextInputPrivate &dd, QQuickItem *parent = nullptr); void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h index c795aebfa9..a2e2f0f66d 100644 --- a/src/quick/items/qquicktextinput_p_p.h +++ b/src/quick/items/qquicktextinput_p_p.h @@ -99,9 +99,9 @@ public: QQuickTextInputPrivate() : hscroll(0) , vscroll(0) - , cursorItem(0) - , textNode(0) - , m_maskData(0) + , cursorItem(nullptr) + , textNode(nullptr) + , m_maskData(nullptr) , color(QRgb(0xFF000000)) , selectionColor(QRgb(0xFF000080)) , selectedTextColor(QRgb(0xFFFFFFFF)) diff --git a/src/quick/items/qquicktextnode.cpp b/src/quick/items/qquicktextnode.cpp index cf4e71adf5..13a8219cbd 100644 --- a/src/quick/items/qquicktextnode.cpp +++ b/src/quick/items/qquicktextnode.cpp @@ -78,7 +78,7 @@ namespace { Creates an empty QQuickTextNode */ QQuickTextNode::QQuickTextNode(QQuickItem *ownerElement) - : m_cursorNode(0), m_ownerElement(ownerElement), m_useNativeRenderer(false) + : m_cursorNode(nullptr), m_ownerElement(ownerElement), m_useNativeRenderer(false) { #ifdef QSG_RUNTIME_DESCRIPTION qsgnode_set_description(this, QLatin1String("text")); @@ -125,7 +125,7 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun node->geometry()->setIndexDataPattern(QSGGeometry::StaticPattern); node->geometry()->setVertexDataPattern(QSGGeometry::StaticPattern); - if (parentNode == 0) + if (parentNode == nullptr) parentNode = this; parentNode->appendChildNode(node); @@ -134,7 +134,7 @@ QSGGlyphNode *QQuickTextNode::addGlyphs(const QPointF &position, const QGlyphRun void QQuickTextNode::setCursor(const QRectF &rect, const QColor &color) { - if (m_cursorNode != 0) + if (m_cursorNode != nullptr) delete m_cursorNode; QSGRenderContext *sg = QQuickItemPrivate::get(m_ownerElement)->sceneGraphRenderContext(); @@ -147,7 +147,7 @@ void QQuickTextNode::clearCursor() if (m_cursorNode) removeChildNode(m_cursorNode); delete m_cursorNode; - m_cursorNode = 0; + m_cursorNode = nullptr; } void QQuickTextNode::addRectangleNode(const QRectF &rect, const QColor &color) @@ -273,9 +273,9 @@ void QQuickTextNode::addTextLayout(const QPointF &position, QTextLayout *textLay void QQuickTextNode::deleteContent() { - while (firstChild() != 0) + while (firstChild() != nullptr) delete firstChild(); - m_cursorNode = 0; + m_cursorNode = nullptr; qDeleteAll(m_textures); m_textures.clear(); } diff --git a/src/quick/items/qquicktextnodeengine.cpp b/src/quick/items/qquicktextnodeengine.cpp index c179ab7163..a53ca2a2a4 100644 --- a/src/quick/items/qquicktextnodeengine.cpp +++ b/src/quick/items/qquicktextnodeengine.cpp @@ -75,7 +75,7 @@ QQuickTextNodeEngine::BinaryTreeNode::BinaryTreeNode(const QGlyphRun &g, : glyphRun(g) , boundingRect(brect) , selectionState(selState) - , clipNode(0) + , clipNode(nullptr) , decorations(decs) , color(c) , backgroundColor(bc) @@ -256,10 +256,10 @@ void QQuickTextNodeEngine::processCurrentLine() QVarLengthArray<TextDecoration> pendingOverlines; QVarLengthArray<TextDecoration> pendingStrikeOuts; if (!sortedIndexes.isEmpty()) { - QQuickDefaultClipNode *currentClipNode = m_hasSelection ? new QQuickDefaultClipNode(QRectF()) : 0; + QQuickDefaultClipNode *currentClipNode = m_hasSelection ? new QQuickDefaultClipNode(QRectF()) : nullptr; bool currentClipNodeUsed = false; for (int i=0; i<=sortedIndexes.size(); ++i) { - BinaryTreeNode *node = 0; + BinaryTreeNode *node = nullptr; if (i < sortedIndexes.size()) { int sortedIndex = sortedIndexes.at(i); Q_ASSERT(sortedIndex < m_currentLineTree.size()); @@ -275,7 +275,7 @@ void QQuickTextNodeEngine::processCurrentLine() decorationRect.setY(m_position.y() + m_currentLine.y()); decorationRect.setHeight(m_currentLine.height()); - if (node != 0) + if (node != nullptr) decorationRect.setRight(node->boundingRect.left()); TextDecoration textDecoration(currentSelectionState, decorationRect, lastColor); @@ -295,14 +295,14 @@ void QQuickTextNodeEngine::processCurrentLine() // If we've reached an unselected node from a selected node, we add the // selection rect to the graph, and we add decoration every time the // selection state changes, because that means the text color changes - if (node == 0 || node->selectionState != currentSelectionState) { + if (node == nullptr || node->selectionState != currentSelectionState) { currentRect.setY(m_position.y() + m_currentLine.y()); currentRect.setHeight(m_currentLine.height()); if (currentSelectionState == Selected) m_selectionRects.append(currentRect); - if (currentClipNode != 0) { + if (currentClipNode != nullptr) { if (!currentClipNodeUsed) { delete currentClipNode; } else { @@ -312,13 +312,13 @@ void QQuickTextNodeEngine::processCurrentLine() } } - if (node != 0 && m_hasSelection) + if (node != nullptr && m_hasSelection) currentClipNode = new QQuickDefaultClipNode(QRectF()); else - currentClipNode = 0; + currentClipNode = nullptr; currentClipNodeUsed = false; - if (node != 0) { + if (node != nullptr) { currentSelectionState = node->selectionState; currentRect = node->boundingRect; @@ -333,7 +333,7 @@ void QQuickTextNodeEngine::processCurrentLine() currentRect = currentRect.united(node->boundingRect); } - if (node != 0) { + if (node != nullptr) { if (node->selectionState == Selected) { node->clipNode = currentClipNode; currentClipNodeUsed = true; @@ -449,7 +449,7 @@ void QQuickTextNodeEngine::addTextObject(const QPointF &position, const QTextCha QTextFrameFormat::Position layoutPosition) { QTextObjectInterface *handler = textDocument->documentLayout()->handlerForObject(format.objectType()); - if (handler != 0) { + if (handler != nullptr) { QImage image; QSizeF size = handler->intrinsicSize(textDocument, pos, format); @@ -651,7 +651,7 @@ void QQuickTextNodeEngine::addFrameDecorations(QTextDocument *document, QTextFra QTextFrameFormat frameFormat = frame->format().toFrameFormat(); QTextTable *table = qobject_cast<QTextTable *>(frame); - QRectF boundingRect = table == 0 + QRectF boundingRect = table == nullptr ? documentLayout->frameBoundingRect(frame) : documentLayout->tableBoundingRect(table); @@ -674,7 +674,7 @@ void QQuickTextNodeEngine::addFrameDecorations(QTextDocument *document, QTextFra addBorder(boundingRect.adjusted(frameFormat.leftMargin(), frameFormat.topMargin(), -frameFormat.rightMargin(), -frameFormat.bottomMargin()), borderWidth, borderStyle, borderBrush); - if (table != 0) { + if (table != nullptr) { int rows = table->rows(); int columns = table->columns(); @@ -781,7 +781,7 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode, // Add all text with unselected color first for (int i = 0; i < nodes.size(); ++i) { const BinaryTreeNode *node = nodes.at(i); - parentNode->addGlyphs(node->position, node->glyphRun, node->color, style, styleColor, 0); + parentNode->addGlyphs(node->position, node->glyphRun, node->color, style, styleColor, nullptr); } for (int i = 0; i < imageNodes.size(); ++i) { @@ -812,7 +812,7 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode, for (int i = 0; i < nodes.size(); ++i) { const BinaryTreeNode *node = nodes.at(i); QQuickDefaultClipNode *clipNode = node->clipNode; - if (clipNode != 0 && clipNode->parent() == 0) + if (clipNode != nullptr && clipNode->parent() == nullptr) parentNode->appendChildNode(clipNode); if (node->selectionState == Selected) { @@ -820,26 +820,26 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode, int previousNodeIndex = i - 1; int nextNodeIndex = i + 1; const BinaryTreeNode *previousNode = previousNodeIndex < 0 ? 0 : nodes.at(previousNodeIndex); - while (previousNode != 0 && qFuzzyCompare(previousNode->boundingRect.left(), node->boundingRect.left())) + while (previousNode != nullptr && qFuzzyCompare(previousNode->boundingRect.left(), node->boundingRect.left())) previousNode = --previousNodeIndex < 0 ? 0 : nodes.at(previousNodeIndex); const BinaryTreeNode *nextNode = nextNodeIndex == nodes.size() ? 0 : nodes.at(nextNodeIndex); - if (previousNode != 0 && previousNode->selectionState == Unselected) + if (previousNode != nullptr && previousNode->selectionState == Unselected) parentNode->addGlyphs(previousNode->position, previousNode->glyphRun, color, style, styleColor, clipNode); - if (nextNode != 0 && nextNode->selectionState == Unselected) + if (nextNode != nullptr && nextNode->selectionState == Unselected) parentNode->addGlyphs(nextNode->position, nextNode->glyphRun, color, style, styleColor, clipNode); // If the previous or next node completely overlaps this one, then we have already drawn the glyphs of // this node bool drawCurrent = false; - if (previousNode != 0 || nextNode != 0) { + if (previousNode != nullptr || nextNode != nullptr) { for (int i = 0; i < node->ranges.size(); ++i) { const QPair<int, int> &range = node->ranges.at(i); int rangeLength = range.second - range.first + 1; - if (previousNode != 0) { + if (previousNode != nullptr) { for (int j = 0; j < previousNode->ranges.size(); ++j) { const QPair<int, int> &otherRange = previousNode->ranges.at(j); @@ -853,7 +853,7 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode, } } - if (nextNode != 0 && rangeLength > 0) { + if (nextNode != nullptr && rangeLength > 0) { for (int j = 0; j < nextNode->ranges.size(); ++j) { const QPair<int, int> &otherRange = nextNode->ranges.at(j); @@ -896,8 +896,8 @@ void QQuickTextNodeEngine::addToSceneGraph(QQuickTextNode *parentNode, void QQuickTextNodeEngine::mergeFormats(QTextLayout *textLayout, QVarLengthArray<QTextLayout::FormatRange> *mergedFormats) { - Q_ASSERT(mergedFormats != 0); - if (textLayout == 0) + Q_ASSERT(mergedFormats != nullptr); + if (textLayout == nullptr) return; QVector<QTextLayout::FormatRange> additionalFormats = textLayout->formats(); @@ -911,7 +911,7 @@ void QQuickTextNodeEngine::mergeFormats(QTextLayout *textLayout, QVarLengthArray QTextLayout::FormatRange *lastFormat = mergedFormats->data() + mergedFormats->size() - 1; if (additionalFormat.start < lastFormat->start + lastFormat->length) { - QTextLayout::FormatRange *mergedRange = 0; + QTextLayout::FormatRange *mergedRange = nullptr; int length = additionalFormat.length; if (additionalFormat.start > lastFormat->start) { diff --git a/src/quick/items/qquicktextutil.cpp b/src/quick/items/qquicktextutil.cpp index 6aa6c5cb4b..eb356a9c48 100644 --- a/src/quick/items/qquicktextutil.cpp +++ b/src/quick/items/qquicktextutil.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QQuickItem *QQuickTextUtil::createCursor( QQmlComponent *component, QQuickItem *parent, const QRectF &rectangle, const char *className) { - QQuickItem *item = 0; + QQuickItem *item = nullptr; if (component->isReady()) { QQmlContext *creationContext = component->creationContext(); diff --git a/src/quick/items/qquicktranslate_p.h b/src/quick/items/qquicktranslate_p.h index b0199cef40..b6ea43342c 100644 --- a/src/quick/items/qquicktranslate_p.h +++ b/src/quick/items/qquicktranslate_p.h @@ -66,7 +66,7 @@ class Q_AUTOTEST_EXPORT QQuickTranslate : public QQuickTransform Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) public: - QQuickTranslate(QObject *parent = 0); + QQuickTranslate(QObject *parent = nullptr); ~QQuickTranslate(); qreal x() const; @@ -96,7 +96,7 @@ class Q_AUTOTEST_EXPORT QQuickScale : public QQuickTransform Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY yScaleChanged) Q_PROPERTY(qreal zScale READ zScale WRITE setZScale NOTIFY zScaleChanged) public: - QQuickScale(QObject *parent = 0); + QQuickScale(QObject *parent = nullptr); ~QQuickScale(); QVector3D origin() const; @@ -133,7 +133,7 @@ class Q_AUTOTEST_EXPORT QQuickRotation : public QQuickTransform Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged) Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged) public: - QQuickRotation(QObject *parent = 0); + QQuickRotation(QObject *parent = nullptr); ~QQuickRotation(); QVector3D origin() const; @@ -164,7 +164,7 @@ class Q_AUTOTEST_EXPORT QQuickMatrix4x4 : public QQuickTransform Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY matrixChanged) public: - QQuickMatrix4x4(QObject *parent = 0); + QQuickMatrix4x4(QObject *parent = nullptr); ~QQuickMatrix4x4(); QMatrix4x4 matrix() const; diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp index ff9789ad57..1ac6c768e8 100644 --- a/src/quick/items/qquickview.cpp +++ b/src/quick/items/qquickview.cpp @@ -76,7 +76,7 @@ void QQuickViewPrivate::init(QQmlEngine* e) } QQuickViewPrivate::QQuickViewPrivate() - : root(0), component(0), resizeMode(QQuickView::SizeViewToRootObject), initialSize(0,0) + : root(nullptr), component(nullptr), resizeMode(QQuickView::SizeViewToRootObject), initialSize(0,0) { } @@ -94,11 +94,11 @@ void QQuickViewPrivate::execute() if (root) { delete root; - root = 0; + root = nullptr; } if (component) { delete component; - component = 0; + component = nullptr; } if (!source.isEmpty()) { QML_MEMORY_SCOPE_URL(engine.data()->baseUrl().resolved(source)); @@ -216,7 +216,7 @@ QQuickView::~QQuickView() // be a child of the QQuickViewPrivate, and will be destroyed by its dtor Q_D(QQuickView); delete d->root; - d->root = 0; + d->root = nullptr; } /*! @@ -260,7 +260,7 @@ void QQuickView::setContent(const QUrl& url, QQmlComponent *component, QObject* if (d->component && d->component->isError()) { const QList<QQmlError> errorList = d->component->errors(); for (const QQmlError &error : errorList) { - QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning() << error; } emit statusChanged(status()); @@ -289,7 +289,7 @@ QUrl QQuickView::source() const QQmlEngine* QQuickView::engine() const { Q_D(const QQuickView); - return d->engine ? const_cast<QQmlEngine *>(d->engine.data()) : 0; + return d->engine ? const_cast<QQmlEngine *>(d->engine.data()) : nullptr; } /*! @@ -302,7 +302,7 @@ QQmlEngine* QQuickView::engine() const QQmlContext* QQuickView::rootContext() const { Q_D(const QQuickView); - return d->engine ? d->engine.data()->rootContext() : 0; + return d->engine ? d->engine.data()->rootContext() : nullptr; } /*! @@ -471,7 +471,7 @@ void QQuickView::continueExecute() if (d->component->isError()) { const QList<QQmlError> errorList = d->component->errors(); for (const QQmlError &error : errorList) { - QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning() << error; } emit statusChanged(status()); @@ -483,7 +483,7 @@ void QQuickView::continueExecute() if (d->component->isError()) { const QList<QQmlError> errorList = d->component->errors(); for (const QQmlError &error : errorList) { - QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning() << error; } emit statusChanged(status()); @@ -517,7 +517,7 @@ void QQuickViewPrivate::setRootObject(QObject *obj) << "Ensure your QML code is written for QtQuick 2, and uses a root that is or" << endl << "inherits from QtQuick's Item (not a Timer, QtObject, etc)." << endl; delete obj; - root = 0; + root = nullptr; } if (root) { initialSize = rootObjectSize(); diff --git a/src/quick/items/qquickview_p.h b/src/quick/items/qquickview_p.h index f92d4b95d6..3f284c0519 100644 --- a/src/quick/items/qquickview_p.h +++ b/src/quick/items/qquickview_p.h @@ -93,7 +93,7 @@ public: void updateSize(); void setRootObject(QObject *); - void init(QQmlEngine* e = 0); + void init(QQmlEngine* e = nullptr); QSize rootObjectSize() const; diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index c1148c00d1..aefdaea2b7 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -485,25 +485,25 @@ void QQuickWindowPrivate::renderSceneGraph(const QSize &size) } QQuickWindowPrivate::QQuickWindowPrivate() - : contentItem(0) - , activeFocusItem(0) + : contentItem(nullptr) + , activeFocusItem(nullptr) #if QT_CONFIG(cursor) - , cursorItem(0) + , cursorItem(nullptr) #endif #if QT_CONFIG(draganddrop) - , dragGrabber(0) + , dragGrabber(nullptr) #endif , touchMouseId(-1) , touchMouseDevice(nullptr) , touchMousePressTimestamp(0) - , dirtyItemList(0) + , dirtyItemList(nullptr) , devicePixelRatio(0) - , context(0) - , renderer(0) - , windowManager(0) - , renderControl(0) + , context(nullptr) + , renderer(nullptr) + , windowManager(nullptr) + , renderControl(nullptr) , pointerEventRecursionGuard(0) - , customRenderStage(0) + , customRenderStage(nullptr) , clearColor(Qt::white) , clearBeforeRendering(true) , persistentGLContext(true) @@ -513,10 +513,10 @@ QQuickWindowPrivate::QQuickWindowPrivate() , allowChildEventFiltering(true) , allowDoubleClick(true) , lastFocusReason(Qt::OtherFocusReason) - , renderTarget(0) + , renderTarget(nullptr) , renderTargetId(0) - , vaoHelper(0) - , incubationController(0) + , vaoHelper(nullptr) + , incubationController(nullptr) { #if QT_CONFIG(draganddrop) dragGrabber = new QQuickDragGrabber; @@ -602,7 +602,7 @@ void QQuickWindow::handleApplicationStateChanged(Qt::ApplicationState state) QQmlListProperty<QObject> QQuickWindowPrivate::data() { - return QQmlListProperty<QObject>(q_func(), 0, QQuickWindowPrivate::data_append, + return QQmlListProperty<QObject>(q_func(), nullptr, QQuickWindowPrivate::data_append, QQuickWindowPrivate::data_count, QQuickWindowPrivate::data_at, QQuickWindowPrivate::data_clear); @@ -889,12 +889,12 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q qCDebug(DBG_FOCUS) << " item:" << (QObject *)item; qCDebug(DBG_FOCUS) << " activeFocusItem:" << (QObject *)activeFocusItem; - QQuickItemPrivate *scopePrivate = scope ? QQuickItemPrivate::get(scope) : 0; + QQuickItemPrivate *scopePrivate = scope ? QQuickItemPrivate::get(scope) : nullptr; QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); - QQuickItem *oldActiveFocusItem = 0; + QQuickItem *oldActiveFocusItem = nullptr; QQuickItem *currentActiveFocusItem = activeFocusItem; - QQuickItem *newActiveFocusItem = 0; + QQuickItem *newActiveFocusItem = nullptr; bool sendFocusIn = false; lastFocusReason = reason; @@ -920,7 +920,7 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q QGuiApplication::inputMethod()->commit(); #endif - activeFocusItem = 0; + activeFocusItem = nullptr; QQuickItem *afi = oldActiveFocusItem; while (afi && afi != scope) { @@ -1000,7 +1000,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, qCDebug(DBG_FOCUS) << " item:" << (QObject *)item; qCDebug(DBG_FOCUS) << " activeFocusItem:" << (QObject *)activeFocusItem; - QQuickItemPrivate *scopePrivate = 0; + QQuickItemPrivate *scopePrivate = nullptr; if (scope) { scopePrivate = QQuickItemPrivate::get(scope); if ( !scopePrivate->subFocusItem ) @@ -1008,8 +1008,8 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, } QQuickItem *currentActiveFocusItem = activeFocusItem; - QQuickItem *oldActiveFocusItem = 0; - QQuickItem *newActiveFocusItem = 0; + QQuickItem *oldActiveFocusItem = nullptr; + QQuickItem *newActiveFocusItem = nullptr; lastFocusReason = reason; @@ -1026,7 +1026,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, QGuiApplication::inputMethod()->commit(); #endif - activeFocusItem = 0; + activeFocusItem = nullptr; if (oldActiveFocusItem) { QQuickItem *afi = oldActiveFocusItem; @@ -1275,7 +1275,7 @@ QQuickWindow::QQuickWindow(QQuickWindowPrivate &dd, QWindow *parent) \internal */ QQuickWindow::QQuickWindow(QQuickRenderControl *control) - : QWindow(*(new QQuickWindowPrivate), 0) + : QWindow(*(new QQuickWindowPrivate), nullptr) { Q_D(QQuickWindow); d->init(this, control); @@ -1285,7 +1285,7 @@ QQuickWindow::QQuickWindow(QQuickRenderControl *control) \internal */ QQuickWindow::QQuickWindow(QQuickWindowPrivate &dd, QQuickRenderControl *control) - : QWindow(dd, 0) + : QWindow(dd, nullptr) { Q_D(QQuickWindow); d->init(this, control); @@ -1305,11 +1305,11 @@ QQuickWindow::~QQuickWindow() d->windowManager->windowDestroyed(this); } - delete d->incubationController; d->incubationController = 0; + delete d->incubationController; d->incubationController = nullptr; #if QT_CONFIG(draganddrop) - delete d->dragGrabber; d->dragGrabber = 0; + delete d->dragGrabber; d->dragGrabber = nullptr; #endif - delete d->contentItem; d->contentItem = 0; + delete d->contentItem; d->contentItem = nullptr; qDeleteAll(d->pointerEventInstances); d->pointerEventInstances.clear(); @@ -2762,7 +2762,7 @@ QQuickItem *QQuickWindowPrivate::findCursorItem(QQuickItem *item, const QPointF if (itemPrivate->flags & QQuickItem::ItemClipsChildrenToShape) { QPointF p = item->mapFromScene(scenePos); if (!item->contains(p)) - return 0; + return nullptr; } if (itemPrivate->subtreeCursorEnabled) { @@ -2781,7 +2781,7 @@ QQuickItem *QQuickWindowPrivate::findCursorItem(QQuickItem *item, const QPointF if (item->contains(p)) return item; } - return 0; + return nullptr; } #endif @@ -3107,15 +3107,15 @@ void QQuickWindowPrivate::cleanupNodesOnShutdown(QQuickItem *item) QQuickItemPrivate *p = QQuickItemPrivate::get(item); if (p->itemNodeInstance) { delete p->itemNodeInstance; - p->itemNodeInstance = 0; + p->itemNodeInstance = nullptr; if (p->extra.isAllocated()) { - p->extra->opacityNode = 0; - p->extra->clipNode = 0; - p->extra->rootNode = 0; + p->extra->opacityNode = nullptr; + p->extra->clipNode = nullptr; + p->extra->rootNode = nullptr; } - p->paintNode = 0; + p->paintNode = nullptr; p->dirty(QQuickItemPrivate::Window); } @@ -3127,7 +3127,7 @@ void QQuickWindowPrivate::cleanupNodesOnShutdown(QQuickItem *item) if (index >= 0) { const QMetaMethod &method = mo->method(index); // Skip functions named invalidateSceneGraph() in QML items. - if (strstr(method.enclosingMetaObject()->className(), "_QML_") == 0) + if (strstr(method.enclosingMetaObject()->className(), "_QML_") == nullptr) method.invoke(item, Qt::DirectConnection); } } @@ -3155,7 +3155,7 @@ void QQuickWindowPrivate::updateDirtyNodes() cleanupNodes(); QQuickItem *updateList = dirtyItemList; - dirtyItemList = 0; + dirtyItemList = nullptr; if (updateList) QQuickItemPrivate::get(updateList)->prevDirtyItem = &updateList; while (updateList) { @@ -3171,7 +3171,7 @@ void QQuickWindowPrivate::updateDirtyNodes() static inline QSGNode *qquickitem_before_paintNode(QQuickItemPrivate *d) { const QList<QQuickItem *> childItems = d->paintOrderChildItems(); - QQuickItem *before = 0; + QQuickItem *before = nullptr; for (int i=0; i<childItems.size(); ++i) { QQuickItemPrivate *dd = QQuickItemPrivate::get(childItems.at(i)); // Perform the same check as the in fetchNextNode below. @@ -3180,7 +3180,7 @@ static inline QSGNode *qquickitem_before_paintNode(QQuickItemPrivate *d) else break; } - return Q_UNLIKELY(before) ? QQuickItemPrivate::get(before)->itemNode() : 0; + return Q_UNLIKELY(before) ? QQuickItemPrivate::get(before)->itemNode() : nullptr; } static QSGNode *fetchNextNode(QQuickItemPrivate *itemPriv, int &ii, bool &returnedPaintNode) @@ -3212,7 +3212,7 @@ static QSGNode *fetchNextNode(QQuickItemPrivate *itemPriv, int &ii, bool &return return childPrivate->itemNode(); } - return 0; + return nullptr; } void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) @@ -3247,10 +3247,10 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) } bool clipEffectivelyChanged = (dirty & (QQuickItemPrivate::Clip | QQuickItemPrivate::Window)) && - ((item->clip() == false) != (itemPriv->clipNode() == 0)); + ((item->clip() == false) != (itemPriv->clipNode() == nullptr)); int effectRefCount = itemPriv->extra.isAllocated()?itemPriv->extra->effectRefCount:0; bool effectRefEffectivelyChanged = (dirty & (QQuickItemPrivate::EffectReference | QQuickItemPrivate::Window)) && - ((effectRefCount == 0) != (itemPriv->rootNode() == 0)); + ((effectRefCount == 0) != (itemPriv->rootNode() == nullptr)); if (clipEffectivelyChanged) { QSGNode *parent = itemPriv->opacityNode() ? (QSGNode *) itemPriv->opacityNode() : @@ -3258,7 +3258,7 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) QSGNode *child = itemPriv->rootNode(); if (item->clip()) { - Q_ASSERT(itemPriv->clipNode() == 0); + Q_ASSERT(itemPriv->clipNode() == nullptr); QQuickDefaultClipNode *clip = new QQuickDefaultClipNode(item->clipRect()); itemPriv->extra.value().clipNode = clip; clip->update(); @@ -3284,7 +3284,7 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) } delete itemPriv->clipNode(); - itemPriv->extra->clipNode = 0; + itemPriv->extra->clipNode = nullptr; } } @@ -3299,18 +3299,18 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) parent = itemPriv->itemNode(); if (itemPriv->extra.isAllocated() && itemPriv->extra->effectRefCount) { - Q_ASSERT(itemPriv->rootNode() == 0); + Q_ASSERT(itemPriv->rootNode() == nullptr); QSGRootNode *root = new QSGRootNode(); itemPriv->extra->rootNode = root; parent->reparentChildNodesTo(root); parent->appendChildNode(root); } else { - Q_ASSERT(itemPriv->rootNode() != 0); + Q_ASSERT(itemPriv->rootNode() != nullptr); QSGRootNode *root = itemPriv->rootNode(); parent->removeChildNode(root); root->reparentChildNodesTo(parent); delete itemPriv->rootNode(); - itemPriv->extra->rootNode = 0; + itemPriv->extra->rootNode = nullptr; } } @@ -3336,7 +3336,7 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) int added = 0; int removed = 0; int replaced = 0; - QSGNode *desiredNode = 0; + QSGNode *desiredNode = nullptr; while (currentNode && (desiredNode = fetchNextNode(itemPriv, ii, fetchedPaintNode))) { // uh oh... reality and our utopic paradise are diverging! @@ -3421,11 +3421,11 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) updatePaintNodeData.transformNode = itemPriv->itemNode(); itemPriv->paintNode = item->updatePaintNode(itemPriv->paintNode, &updatePaintNodeData); - Q_ASSERT(itemPriv->paintNode == 0 || - itemPriv->paintNode->parent() == 0 || + Q_ASSERT(itemPriv->paintNode == nullptr || + itemPriv->paintNode->parent() == nullptr || itemPriv->paintNode->parent() == itemPriv->childContainerNode()); - if (itemPriv->paintNode && itemPriv->paintNode->parent() == 0) { + if (itemPriv->paintNode && itemPriv->paintNode->parent() == nullptr) { QSGNode *before = qquickitem_before_paintNode(itemPriv); if (before && before->parent()) { Q_ASSERT(before->parent() == itemPriv->childContainerNode()); @@ -3436,7 +3436,7 @@ void QQuickWindowPrivate::updateDirtyNode(QQuickItem *item) } } else if (itemPriv->paintNode) { delete itemPriv->paintNode; - itemPriv->paintNode = 0; + itemPriv->paintNode = nullptr; } } @@ -3488,14 +3488,14 @@ void QQuickWindow::cleanupSceneGraph() Q_D(QQuickWindow); #if QT_CONFIG(opengl) delete d->vaoHelper; - d->vaoHelper = 0; + d->vaoHelper = nullptr; #endif if (!d->renderer) return; delete d->renderer->rootNode(); delete d->renderer; - d->renderer = 0; + d->renderer = nullptr; d->runAndClearJobs(&d->beforeSynchronizingJobs); d->runAndClearJobs(&d->afterSynchronizingJobs); @@ -3545,7 +3545,7 @@ QOpenGLContext *QQuickWindow::openglContext() const bool QQuickWindow::isSceneGraphInitialized() const { Q_D(const QQuickWindow); - return d->context != 0 && d->context->isValid(); + return d->context != nullptr && d->context->isValid(); } /*! @@ -3723,7 +3723,7 @@ void QQuickWindow::setRenderTarget(uint fboId, const QSize &size) d->renderTargetSize = size; // Unset any previously set instance... - d->renderTarget = 0; + d->renderTarget = nullptr; } @@ -3837,7 +3837,7 @@ QQmlIncubationController *QQuickWindow::incubationController() const Q_D(const QQuickWindow); if (!d->windowManager) - return 0; // TODO: make sure that this is safe + return nullptr; // TODO: make sure that this is safe if (!d->incubationController) d->incubationController = new QQuickWindowIncubationController(d->windowManager); @@ -4081,7 +4081,7 @@ bool QQuickWindow::clearBeforeRendering() const QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image) const { - return createTextureFromImage(image, 0); + return createTextureFromImage(image, nullptr); } @@ -4130,7 +4130,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateText { Q_D(const QQuickWindow); if (!isSceneGraphInitialized()) // check both for d->context and d->context->isValid() - return 0; + return nullptr; uint flags = 0; if (options & TextureCanUseAtlas) flags |= QSGRenderContext::CreateTexture_Atlas; if (options & TextureHasMipmaps) flags |= QSGRenderContext::CreateTexture_Mipmap; @@ -4176,7 +4176,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create Q_UNUSED(size) Q_UNUSED(options) #endif - return 0; + return nullptr; } /*! @@ -4290,7 +4290,7 @@ void QQuickWindow::resetOpenGLState() int maxAttribs; gl->glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxAttribs); for (int i=0; i<maxAttribs; ++i) { - gl->glVertexAttribPointer(i, 4, GL_FLOAT, GL_FALSE, 0, 0); + gl->glVertexAttribPointer(i, 4, GL_FLOAT, GL_FALSE, 0, nullptr); gl->glDisableVertexAttribArray(i); } } diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index ce9b98504c..cd5ff31994 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -116,7 +116,7 @@ public: QQuickWindowPrivate(); virtual ~QQuickWindowPrivate(); - void init(QQuickWindow *, QQuickRenderControl *control = 0); + void init(QQuickWindow *, QQuickRenderControl *control = nullptr); QQuickRootItem *contentItem; QSet<QQuickItem *> parentlessItems; @@ -146,7 +146,7 @@ public: void grabTouchPoints(QObject *grabber, const QVector<int> &ids); void removeGrabber(QQuickItem *grabber, bool mouse = true, bool touch = true); void sendUngrabEvent(QQuickItem *grabber, bool touch); - static QMouseEvent *cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos = 0); + static QMouseEvent *cloneMouseEvent(QMouseEvent *event, QPointF *transformedLocalPos = nullptr); void deliverToPassiveGrabbers(const QVector<QPointer <QQuickPointerHandler> > &passiveGrabbers, QQuickPointerEvent *pointerEvent); void deliverMouseEvent(QQuickPointerMouseEvent *pointerEvent); bool sendFilteredMouseEvent(QEvent *event, QQuickItem *receiver, QQuickItem *filteringParent); @@ -205,8 +205,8 @@ public: }; Q_DECLARE_FLAGS(FocusOptions, FocusOption) - void setFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = 0); - void clearFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = 0); + void setFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = nullptr); + void clearFocusInScope(QQuickItem *scope, QQuickItem *item, Qt::FocusReason reason, FocusOptions = nullptr); static void notifyFocusChangesRecur(QQuickItem **item, int remaining); void clearFocusObject() override; diff --git a/src/quick/items/qquickwindowattached.cpp b/src/quick/items/qquickwindowattached.cpp index ae62a7a496..481366222d 100644 --- a/src/quick/items/qquickwindowattached.cpp +++ b/src/quick/items/qquickwindowattached.cpp @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE QQuickWindowAttached::QQuickWindowAttached(QObject* attachee) : QObject(attachee) - , m_window(NULL) + , m_window(nullptr) { m_attachee = qobject_cast<QQuickItem*>(attachee); if (m_attachee && m_attachee->window()) // It might not be in a window yet diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index 00fc23645b..24467a3701 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -140,7 +140,7 @@ void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context, if (state->isStateActive() && state->containsPropertyInRevertList(object, propertyName)) { *inBaseState = false; - QQmlBinding *newBinding = 0; + QQmlBinding *newBinding = nullptr; if (!isLiteralValue) { newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core, expression.toString(), object, diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp index 92c02b4966..a8b5944974 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation.cpp @@ -87,6 +87,6 @@ QSGRenderLoop *QSGSoftwareAdaptation::createWindowManager() return new QSGSoftwareRenderLoop(); } -QSGSoftwareContext *QSGSoftwareAdaptation::instance = 0; +QSGSoftwareContext *QSGSoftwareAdaptation::instance = nullptr; QT_END_NAMESPACE diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation_p.h b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation_p.h index ffe54b5d4b..8b2a545033 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation_p.h +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareadaptation_p.h @@ -62,7 +62,7 @@ class QSGSoftwareContext; class QSGSoftwareAdaptation : public QSGContextPlugin { public: - QSGSoftwareAdaptation(QObject *parent = 0); + QSGSoftwareAdaptation(QObject *parent = nullptr); QStringList keys() const override; QSGContext *create(const QString &key) const override; diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp index aa850a80db..5b5bf005d8 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarecontext.cpp @@ -205,12 +205,12 @@ QSGRendererInterface::ShaderType QSGSoftwareContext::shaderType() const QSGRendererInterface::ShaderCompilationTypes QSGSoftwareContext::shaderCompilationType() const { - return 0; + return nullptr; } QSGRendererInterface::ShaderSourceTypes QSGSoftwareContext::shaderSourceType() const { - return 0; + return nullptr; } void *QSGSoftwareContext::getResource(QQuickWindow *window, Resource resource) const diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp index 8843b6450a..3b0f3c48ff 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwareinternalimagenode.cpp @@ -318,7 +318,7 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin QSGSoftwareInternalImageNode::QSGSoftwareInternalImageNode() : m_innerSourceRect(0, 0, 1, 1) , m_subSourceRect(0, 0, 1, 1) - , m_texture(0) + , m_texture(nullptr) , m_mirror(false) , m_smooth(true) , m_tileHorizontal(false) @@ -462,7 +462,7 @@ void QSGSoftwareInternalImageNode::paint(QPainter *painter) m_targetRect.right() - m_innerTargetRect.right(), m_targetRect.bottom() - m_innerTargetRect.bottom()); QSGSoftwareHelpers::QTileRules tilerules(getTileRule(m_subSourceRect.width()), getTileRule(m_subSourceRect.height())); QSGSoftwareHelpers::qDrawBorderPixmap(painter, m_targetRect.toRect(), margins, pm, QRect(0, 0, pm.width(), pm.height()), - margins, tilerules, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(0)); + margins, tilerules, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(nullptr)); return; } @@ -494,7 +494,7 @@ const QPixmap &QSGSoftwareInternalImageNode::pixmap() const return pt->pixmap(); if (QSGSoftwareLayer *layer = qobject_cast<QSGSoftwareLayer*>(m_texture)) return layer->pixmap(); - Q_ASSERT(m_texture == 0); + Q_ASSERT(m_texture == nullptr); static const QPixmap nullPixmap; return nullPixmap; } diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp index 9d30c43f87..b4301451d8 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarelayer.cpp @@ -45,9 +45,9 @@ QT_BEGIN_NAMESPACE QSGSoftwareLayer::QSGSoftwareLayer(QSGRenderContext *renderContext) - : m_item(0) + : m_item(nullptr) , m_context(renderContext) - , m_renderer(0) + , m_renderer(nullptr) , m_device_pixel_ratio(1) , m_mirrorHorizontal(false) , m_mirrorVertical(true) @@ -203,7 +203,7 @@ void QSGSoftwareLayer::markDirtyTexture() void QSGSoftwareLayer::invalidated() { delete m_renderer; - m_renderer = 0; + m_renderer = nullptr; } void QSGSoftwareLayer::grab() diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode.cpp index 34b0cd5b72..60ae06dd94 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepainternode.cpp @@ -47,7 +47,7 @@ QSGSoftwarePainterNode::QSGSoftwarePainterNode(QQuickPaintedItem *item) : QSGPainterNode() , m_preferredRenderTarget(QQuickPaintedItem::Image) , m_item(item) - , m_texture(0) + , m_texture(nullptr) , m_dirtyContents(false) , m_opaquePainting(false) , m_linear_filtering(false) diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp index 77d21ec042..1463681fa3 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp @@ -188,7 +188,7 @@ void QSGSoftwareNinePatchNode::paint(QPainter *painter) painter->drawPixmap(m_bounds, m_pixmap, QRectF(0, 0, m_pixmap.width(), m_pixmap.height())); else QSGSoftwareHelpers::qDrawBorderPixmap(painter, m_bounds.toRect(), m_margins, m_pixmap, QRect(0, 0, m_pixmap.width(), m_pixmap.height()), - m_margins, Qt::StretchTile, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(0)); + m_margins, Qt::StretchTile, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(nullptr)); } QRectF QSGSoftwareNinePatchNode::bounds() const diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp index a7485a90eb..f8973af2fb 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarethreadedrenderloop.cpp @@ -294,7 +294,7 @@ bool QSGSoftwareRenderThread::event(QEvent *e) } rc->invalidate(); QCoreApplication::processEvents(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); if (wme->destroying) delete wd->animationController; } @@ -456,7 +456,7 @@ void QSGSoftwareRenderThread::sync(bool inExpose) // Process deferred deletes now, directly after the sync as deleteLater // on the GUI must now also have resulted in SG changes and the delete // is a safe operation. - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); } if (!inExpose) { diff --git a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp index 301f2826dc..e868a4380e 100644 --- a/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp +++ b/src/quick/scenegraph/compressedtexture/qsgcompressedatlastexture.cpp @@ -84,7 +84,7 @@ Texture *Atlas::create(const QByteArray &data, int dataLength, int dataOffset, c m_pending_uploads << t; return t; } - return 0; + return nullptr; } void Atlas::generateTexture() @@ -93,7 +93,7 @@ void Atlas::generateTexture() funcs->glCompressedTexImage2D(GL_TEXTURE_2D, 0, m_format, m_size.width(), m_size.height(), 0, (m_size.width() * m_size.height()) / 2, - 0); + nullptr); } void Atlas::uploadPendingTexture(int i) @@ -119,7 +119,7 @@ void Atlas::uploadPendingTexture(int i) Texture::Texture(Atlas *atlas, const QRect &textureRect, const QByteArray &data, int dataLength, int dataOffset, const QSize &size) : QSGAtlasTexture::TextureBase(atlas, textureRect) - , m_nonatlas_texture(0) + , m_nonatlas_texture(nullptr) , m_data(data) , m_size(size) , m_dataLength(dataLength) diff --git a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp index 3d4ce24716..fddac7ed71 100644 --- a/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgabstractrenderer.cpp @@ -97,7 +97,7 @@ QT_BEGIN_NAMESPACE \internal */ QSGAbstractRendererPrivate::QSGAbstractRendererPrivate() - : m_root_node(0) + : m_root_node(nullptr) , m_clear_color(Qt::transparent) , m_clear_mode(QSGAbstractRenderer::ClearColorBuffer | QSGAbstractRenderer::ClearDepthBuffer) { diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 27b374e47f..ba71551302 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -155,10 +155,10 @@ ShaderManager::Shader *ShaderManager::prepareMaterial(QSGMaterial *material) p->bindAttributeLocation(attr[i], i); } p->bindAttributeLocation("_qt_order", i); - context->compileShader(s, material, qsgShaderRewriter_insertZAttributes(s->vertexShader(), profile), 0); + context->compileShader(s, material, qsgShaderRewriter_insertZAttributes(s->vertexShader(), profile), nullptr); context->initializeShader(s); if (!p->isLinked()) - return 0; + return nullptr; shader = new Shader; shader->program = s; @@ -215,7 +215,7 @@ void ShaderManager::invalidated() qDeleteAll(rewrittenShaders); rewrittenShaders.clear(); delete blitProgram; - blitProgram = 0; + blitProgram = nullptr; } void qsg_dumpShadowRoots(BatchRootInfo *i, int indent) @@ -280,7 +280,7 @@ Updater::Updater(Renderer *r) void Updater::updateStates(QSGNode *n) { - m_current_clip = 0; + m_current_clip = nullptr; m_added = 0; m_transformChange = 0; @@ -347,7 +347,7 @@ void Updater::visitNode(Node *n) m_added = count; m_force_update = force; - n->dirtyState = 0; + n->dirtyState = nullptr; } void Updater::visitClipNode(Node *n) @@ -473,7 +473,7 @@ void Updater::visitGeometryNode(Node *n) if (e->root) { BatchRootInfo *info = renderer->batchRootInfo(e->root); - while (info != 0) { + while (info != nullptr) { info->availableOrders--; if (info->availableOrders < 0) { renderer->m_rebuild |= Renderer::BuildRenderLists; @@ -481,10 +481,10 @@ void Updater::visitGeometryNode(Node *n) renderer->m_rebuild |= Renderer::BuildRenderListsForTaggedRoots; renderer->m_taggedRoots << e->root; } - if (info->parentRoot != 0) + if (info->parentRoot != nullptr) info = renderer->batchRootInfo(info->parentRoot); else - info = 0; + info = nullptr; } } else { renderer->m_rebuild |= Renderer::FullRebuild; @@ -680,12 +680,12 @@ void Batch::invalidate() // the batch to do an early out.. cleanupRemovedElements(); Element *e = first; - first = 0; - root = 0; + first = nullptr; + root = nullptr; while (e) { - e->batch = 0; + e->batch = nullptr; Element *n = e->nextInBatch; - e->nextInBatch = 0; + e->nextInBatch = nullptr; e = n; } } @@ -756,7 +756,7 @@ Renderer::Renderer(QSGDefaultRenderContext *ctx) , m_alphaRenderList(64) , m_nextRenderOrder(0) , m_partialRebuild(false) - , m_partialRebuildRoot(0) + , m_partialRebuildRoot(nullptr) , m_useDepthBuffer(true) , m_opaqueBatches(16) , m_alphaBatches(16) @@ -768,17 +768,17 @@ Renderer::Renderer(QSGDefaultRenderContext *ctx) , m_zRange(0) , m_renderOrderRebuildLower(-1) , m_renderOrderRebuildUpper(-1) - , m_currentMaterial(0) - , m_currentShader(0) + , m_currentMaterial(nullptr) + , m_currentShader(nullptr) , m_currentStencilValue(0) , m_clipMatrixId(0) - , m_currentClip(0) + , m_currentClip(nullptr) , m_currentClipType(NoClip) , m_vertexUploadPool(256) #ifdef QSG_SEPARATE_INDEX_BUFFER , m_indexUploadPool(64) #endif - , m_vao(0) + , m_vao(nullptr) , m_visualizeMode(VisualizeNothing) { initializeOpenGLFunctions(); @@ -916,7 +916,7 @@ void Renderer::unmap(Buffer *buffer, bool isIndexBuf) glBufferData(target, buffer->size, buffer->data, m_bufferStrategy); if (!m_context->hasBrokenIndexBufferObjects() && m_visualizeMode == VisualizeNothing) { - buffer->data = 0; + buffer->data = nullptr; } } @@ -944,7 +944,7 @@ void Renderer::removeBatchRootFromParent(Node *childRoot) Q_ASSERT(parentInfo->subRoots.contains(childRoot)); parentInfo->subRoots.remove(childRoot); - childInfo->parentRoot = 0; + childInfo->parentRoot = nullptr; } void Renderer::registerBatchRoot(Node *subRoot, Node *parentRoot) @@ -1072,7 +1072,7 @@ void Renderer::nodeWasRemoved(Node *node) if (e) { e->removed = true; m_elementsToDelete.add(e); - e->node = 0; + e->node = nullptr; if (e->root) { BatchRootInfo *info = batchRootInfo(e->root); info->availableOrders++; @@ -1185,7 +1185,7 @@ void Renderer::nodeChanged(QSGNode *node, QSGNode::DirtyState state) return; } if (node == rootNode()) - nodeWasAdded(node, 0); + nodeWasAdded(node, nullptr); else nodeWasAdded(node, m_nodes.value(node->parent())); } @@ -1438,7 +1438,7 @@ void Renderer::buildRenderListsForTaggedRoots() } } m_partialRebuild = false; - m_partialRebuildRoot = 0; + m_partialRebuildRoot = nullptr; m_taggedRoots.clear(); m_nextRenderOrder = qMax(m_nextRenderOrder, maxRenderOrder); @@ -2144,7 +2144,7 @@ Renderer::ClipType Renderer::updateStencilClip(const QSGClipNode *clip) glBufferSubData(GL_ARRAY_BUFFER, 0, vertexByteSize, g->vertexData()); } - pointer = 0; + pointer = nullptr; } glVertexAttribPointer(0, a->tupleSize, a->type, GL_FALSE, g->sizeOfVertex(), pointer); @@ -2186,7 +2186,7 @@ void Renderer::updateClip(const QSGClipNode *clipList, const Batch *batch) m_currentClip = clipList; // updateClip sets another program, so force-reactivate our own if (m_currentShader) - setActiveShader(0, 0); + setActiveShader(nullptr, nullptr); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); if (batch->isOpaque) @@ -2207,8 +2207,8 @@ void Renderer::updateClip(const QSGClipNode *clipList, const Batch *batch) */ void Renderer::setActiveShader(QSGMaterialShader *program, ShaderManager::Shader *shader) { - const char * const *c = m_currentProgram ? m_currentProgram->attributeNames() : 0; - const char * const *n = program ? program->attributeNames() : 0; + const char * const *c = m_currentProgram ? m_currentProgram->attributeNames() : nullptr; + const char * const *n = program ? program->attributeNames() : nullptr; int cza = m_currentShader ? m_currentShader->pos_order : -1; int nza = shader ? shader->pos_order : -1; @@ -2219,18 +2219,18 @@ void Renderer::setActiveShader(QSGMaterialShader *program, ShaderManager::Shader bool was = c; if (cza == i) { was = true; - c = 0; + c = nullptr; } else if (c && !c[i]) { // end of the attribute array names - c = 0; + c = nullptr; was = false; } bool is = n; if (nza == i) { is = true; - n = 0; + n = nullptr; } else if (n && !n[i]) { - n = 0; + n = nullptr; is = false; } @@ -2246,7 +2246,7 @@ void Renderer::setActiveShader(QSGMaterialShader *program, ShaderManager::Shader m_currentProgram->deactivate(); m_currentProgram = program; m_currentShader = shader; - m_currentMaterial = 0; + m_currentMaterial = nullptr; if (m_currentProgram) { m_currentProgram->program()->bind(); m_currentProgram->activate(); @@ -2298,7 +2298,7 @@ void Renderer::renderMergedBatch(const Batch *batch) glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id); - char *indexBase = 0; + char *indexBase = nullptr; #ifdef QSG_SEPARATE_INDEX_BUFFER const Buffer *indexBuf = &batch->ibo; #else @@ -2394,7 +2394,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch) updateClip(gn->clipList(), batch); glBindBuffer(GL_ARRAY_BUFFER, batch->vbo.id); - char *indexBase = 0; + char *indexBase = nullptr; #ifdef QSG_SEPARATE_INDEX_BUFFER const Buffer *indexBuf = &batch->ibo; #else @@ -2500,8 +2500,8 @@ void Renderer::updateLineWidth(QSGGeometry *g) else { QOpenGLContext *ctx = m_context->openglContext(); if (!ctx->isOpenGLES() && g->drawingMode() == GL_POINTS) { - QOpenGLFunctions_1_0 *gl1funcs = 0; - QOpenGLFunctions_3_2_Core *gl3funcs = 0; + QOpenGLFunctions_1_0 *gl1funcs = nullptr; + QOpenGLFunctions_3_2_Core *gl3funcs = nullptr; if (ctx->format().profile() == QSurfaceFormat::CoreProfile) gl3funcs = ctx->versionFunctions<QOpenGLFunctions_3_2_Core>(); else @@ -2546,10 +2546,10 @@ void Renderer::renderBatches() bindable()->clear(clearMode()); m_current_opacity = 1; - m_currentMaterial = 0; - m_currentShader = 0; - m_currentProgram = 0; - m_currentClip = 0; + m_currentMaterial = nullptr; + m_currentShader = nullptr; + m_currentProgram = nullptr; + m_currentClip = nullptr; bool renderOpaque = !debug_noopaque(); bool renderAlpha = !debug_noalpha(); @@ -2582,8 +2582,8 @@ void Renderer::renderBatches() } if (m_currentShader) - setActiveShader(0, 0); - updateStencilClip(0); + setActiveShader(nullptr, nullptr); + updateStencilClip(nullptr); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glDepthMask(true); @@ -2597,12 +2597,12 @@ void Renderer::deleteRemovedElements() for (int i=0; i<m_opaqueRenderList.size(); ++i) { Element **e = m_opaqueRenderList.data() + i; if (*e && (*e)->removed) - *e = 0; + *e = nullptr; } for (int i=0; i<m_alphaRenderList.size(); ++i) { Element **e = m_alphaRenderList.data() + i; if (*e && (*e)->removed) - *e = 0; + *e = nullptr; } for (int i=0; i<m_elementsToDelete.size(); ++i) { @@ -2815,11 +2815,11 @@ void Renderer::renderRenderNode(Batch *batch) Q_ASSERT(batch->first->isRenderNode); RenderNodeElement *e = (RenderNodeElement *) batch->first; - setActiveShader(0, 0); + setActiveShader(nullptr, nullptr); QSGNode *clip = e->renderNode->parent(); QSGRenderNodePrivate *rd = QSGRenderNodePrivate::get(e->renderNode); - rd->m_clip_list = 0; + rd->m_clip_list = nullptr; while (clip != rootNode()) { if (clip->type() == QSGNode::ClipNodeType) { rd->m_clip_list = static_cast<QSGClipNode *>(clip); @@ -2883,8 +2883,8 @@ void Renderer::renderRenderNode(Batch *batch) e->renderNode->render(&state); - rd->m_matrix = 0; - rd->m_clip_list = 0; + rd->m_matrix = nullptr; + rd->m_clip_list = nullptr; if (changes & QSGRenderNode::ViewportState) { QRect r = viewportRect(); @@ -2899,7 +2899,7 @@ void Renderer::renderRenderNode(Batch *batch) if (changes & (QSGRenderNode::StencilState | QSGRenderNode::ScissorState)) { glDisable(GL_SCISSOR_TEST); - m_currentClip = 0; + m_currentClip = nullptr; m_currentClipType = NoClip; } @@ -3069,7 +3069,7 @@ void Renderer::visualizeChanges(Node *n) // This is because many changes don't propegate their dirty state to the // parent so the node updater will not unset these states. They are // not used for anything so, unsetting it should have no side effects. - n->dirtyState = 0; + n->dirtyState = nullptr; } SHADOWNODE_TRAVERSE(n) { diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index e99af2f4ef..918f3ce82c 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -125,7 +125,6 @@ template <typename Type, int PageSize> class Allocator { public: Allocator() - : m_freePage(0) { pages.push_back(new AllocatorPage<Type, PageSize>()); } @@ -209,7 +208,7 @@ public: } QVector<AllocatorPage<Type, PageSize> *> pages; - int m_freePage; + int m_freePage = 0; }; @@ -306,12 +305,7 @@ struct Buffer { struct Element { Element() - : node(0) - , batch(0) - , nextInBatch(0) - , root(0) - , order(0) - , boundsComputed(false) + : boundsComputed(false) , boundsOutsideFloatRange(false) , translateOnlyToRoot(false) , removed(false) @@ -332,14 +326,14 @@ struct Element { } void computeBounds(); - QSGGeometryNode *node; - Batch *batch; - Element *nextInBatch; - Node *root; + QSGGeometryNode *node = nullptr; + Batch *batch = nullptr; + Element *nextInBatch = nullptr; + Node *root = nullptr; Rect bounds; // in device coordinates - int order; + int order = 0; uint boundsComputed : 1; uint boundsOutsideFloatRange : 1; @@ -362,12 +356,12 @@ struct RenderNodeElement : public Element { }; struct BatchRootInfo { - BatchRootInfo() : parentRoot(0), lastOrder(-1), firstOrder(-1), availableOrders(0) { } + BatchRootInfo() {} QSet<Node *> subRoots; - Node *parentRoot; - int lastOrder; - int firstOrder; - int availableOrders; + Node *parentRoot = nullptr; + int lastOrder = -1; + int firstOrder = -1; + int availableOrders = 0; }; struct ClipBatchRootInfo : public BatchRootInfo @@ -381,14 +375,13 @@ struct DrawSet : vertices(v) , zorders(z) , indices(i) - , indexCount(0) { } - DrawSet() : vertices(0), zorders(0), indices(0), indexCount(0) {} - int vertices; - int zorders; - int indices; - int indexCount; + DrawSet() {} + int vertices = 0; + int zorders = 0; + int indices = 0; + int indexCount = 0; }; enum BatchCompatibility @@ -410,8 +403,8 @@ struct Batch // pseudo-constructor... void init() { - first = 0; - root = 0; + first = nullptr; + root = nullptr; vertexCount = 0; indexCount = 0; isOpaque = false; @@ -463,9 +456,9 @@ struct Node void append(Node *child) { Q_ASSERT(child); Q_ASSERT(!hasChild(child)); - Q_ASSERT(child->m_parent == 0); - Q_ASSERT(child->m_next == 0); - Q_ASSERT(child->m_prev == 0); + Q_ASSERT(child->m_parent == nullptr); + Q_ASSERT(child->m_next == nullptr); + Q_ASSERT(child->m_prev == nullptr); if (!m_child) { child->m_next = child; @@ -486,27 +479,27 @@ struct Node // only child.. if (child->m_next == child) { - m_child = 0; + m_child = nullptr; } else { if (m_child == child) m_child = child->m_next; child->m_next->m_prev = child->m_prev; child->m_prev->m_next = child->m_next; } - child->m_next = 0; - child->m_prev = 0; - child->setParent(0); + child->m_next = nullptr; + child->m_prev = nullptr; + child->setParent(nullptr); } Node *firstChild() const { return m_child; } Node *sibling() const { Q_ASSERT(m_parent); - return m_next == m_parent->m_child ? 0 : m_next; + return m_next == m_parent->m_child ? nullptr : m_next; } void setParent(Node *p) { - Q_ASSERT(m_parent == 0 || p == 0); + Q_ASSERT(m_parent == nullptr || p == nullptr); m_parent = p; } @@ -591,7 +584,7 @@ public: float lastOpacity; }; - ShaderManager(QSGDefaultRenderContext *ctx) : visualizeProgram(0), blitProgram(0), context(ctx) { } + ShaderManager(QSGDefaultRenderContext *ctx) : visualizeProgram(nullptr), blitProgram(nullptr), context(ctx) { } ~ShaderManager() { qDeleteAll(rewrittenShaders); qDeleteAll(stockShaders); diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 52366bfc35..226709094d 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -430,9 +430,9 @@ QSGGeometry::QSGGeometry(const QSGGeometry::AttributeSet &attributes, , m_index_count(0) , m_index_type(indexType) , m_attributes(attributes) - , m_data(0) + , m_data(nullptr) , m_index_data_offset(-1) - , m_server_data(0) + , m_server_data(nullptr) , m_owns_data(false) , m_index_usage_pattern(AlwaysUploadPattern) , m_vertex_usage_pattern(AlwaysUploadPattern) @@ -529,7 +529,7 @@ QSGGeometry::~QSGGeometry() void *QSGGeometry::indexData() { return m_index_data_offset < 0 - ? 0 + ? nullptr : ((char *) m_data + m_index_data_offset); } @@ -541,7 +541,7 @@ void *QSGGeometry::indexData() const void *QSGGeometry::indexData() const { return m_index_data_offset < 0 - ? 0 + ? nullptr : ((char *) m_data + m_index_data_offset); } diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.cpp b/src/quick/scenegraph/coreapi/qsgmaterial.cpp index 5c28f4c82f..8557de1b1f 100644 --- a/src/quick/scenegraph/coreapi/qsgmaterial.cpp +++ b/src/quick/scenegraph/coreapi/qsgmaterial.cpp @@ -641,7 +641,7 @@ static void qt_print_material_count() */ QSGMaterial::QSGMaterial() - : m_flags(0) + : m_flags(nullptr) { Q_UNUSED(m_reserved); #ifndef QT_NO_DEBUG diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 550a2182f8..9717862baa 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -244,15 +244,8 @@ static void qt_print_node_count() * Constructs a new node */ QSGNode::QSGNode() - : m_parent(0) - , m_type(BasicNodeType) - , m_firstChild(0) - , m_lastChild(0) - , m_nextSibling(0) - , m_previousSibling(0) - , m_subtreeRenderableCount(0) - , m_nodeFlags(OwnedByParent) - , m_dirtyState(0) + : m_nodeFlags(OwnedByParent) + , m_dirtyState(nullptr) { init(); } @@ -263,15 +256,15 @@ QSGNode::QSGNode() * \internal */ QSGNode::QSGNode(NodeType type) - : m_parent(0) + : m_parent(nullptr) , m_type(type) - , m_firstChild(0) - , m_lastChild(0) - , m_nextSibling(0) - , m_previousSibling(0) + , m_firstChild(nullptr) + , m_lastChild(nullptr) + , m_nextSibling(nullptr) + , m_previousSibling(nullptr) , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0) , m_nodeFlags(OwnedByParent) - , m_dirtyState(0) + , m_dirtyState(nullptr) { init(); } @@ -282,15 +275,15 @@ QSGNode::QSGNode(NodeType type) * \internal */ QSGNode::QSGNode(QSGNodePrivate &dd, NodeType type) - : m_parent(0) + : m_parent(nullptr) , m_type(type) - , m_firstChild(0) - , m_lastChild(0) - , m_nextSibling(0) - , m_previousSibling(0) + , m_firstChild(nullptr) + , m_lastChild(nullptr) + , m_nextSibling(nullptr) + , m_previousSibling(nullptr) , m_subtreeRenderableCount(type == GeometryNodeType || type == RenderNodeType ? 1 : 0) , m_nodeFlags(OwnedByParent) - , m_dirtyState(0) + , m_dirtyState(nullptr) , d_ptr(&dd) { init(); @@ -388,17 +381,17 @@ void QSGNode::destroy() { if (m_parent) { m_parent->removeChildNode(this); - Q_ASSERT(m_parent == 0); + Q_ASSERT(m_parent == nullptr); } while (m_firstChild) { QSGNode *child = m_firstChild; removeChildNode(child); - Q_ASSERT(child->m_parent == 0); + Q_ASSERT(child->m_parent == nullptr); if (child->flags() & OwnedByParent) delete child; } - Q_ASSERT(m_firstChild == 0 && m_lastChild == 0); + Q_ASSERT(m_firstChild == nullptr && m_lastChild == nullptr); } @@ -557,11 +550,11 @@ void QSGNode::removeChildNode(QSGNode *node) next->m_previousSibling = previous; else m_lastChild = previous; - node->m_previousSibling = 0; - node->m_nextSibling = 0; + node->m_previousSibling = nullptr; + node->m_nextSibling = nullptr; node->markDirty(DirtyNodeRemoved); - node->m_parent = 0; + node->m_parent = nullptr; } @@ -574,13 +567,13 @@ void QSGNode::removeAllChildNodes() while (m_firstChild) { QSGNode *node = m_firstChild; m_firstChild = node->m_nextSibling; - node->m_nextSibling = 0; + node->m_nextSibling = nullptr; if (m_firstChild) - m_firstChild->m_previousSibling = 0; + m_firstChild->m_previousSibling = nullptr; else - m_lastChild = 0; + m_lastChild = nullptr; node->markDirty(DirtyNodeRemoved); - node->m_parent = 0; + node->m_parent = nullptr; } } @@ -714,9 +707,9 @@ void qsgnode_set_description(QSGNode *node, const QString &description) */ QSGBasicGeometryNode::QSGBasicGeometryNode(NodeType type) : QSGNode(type) - , m_geometry(0) - , m_matrix(0) - , m_clip_list(0) + , m_geometry(nullptr) + , m_matrix(nullptr) + , m_clip_list(nullptr) { } @@ -726,9 +719,9 @@ QSGBasicGeometryNode::QSGBasicGeometryNode(NodeType type) */ QSGBasicGeometryNode::QSGBasicGeometryNode(QSGBasicGeometryNodePrivate &dd, NodeType type) : QSGNode(dd, type) - , m_geometry(0) - , m_matrix(0) - , m_clip_list(0) + , m_geometry(nullptr) + , m_matrix(nullptr) + , m_clip_list(nullptr) { } @@ -870,10 +863,6 @@ void QSGBasicGeometryNode::setGeometry(QSGGeometry *geometry) QSGGeometryNode::QSGGeometryNode() : QSGBasicGeometryNode(GeometryNodeType) - , m_render_order(0) - , m_material(0) - , m_opaque_material(0) - , m_opacity(1) { } @@ -884,8 +873,8 @@ QSGGeometryNode::QSGGeometryNode() QSGGeometryNode::QSGGeometryNode(QSGGeometryNodePrivate &dd) : QSGBasicGeometryNode(dd, GeometryNodeType) , m_render_order(0) - , m_material(0) - , m_opaque_material(0) + , m_material(nullptr) + , m_opaque_material(nullptr) , m_opacity(1) { } @@ -979,7 +968,7 @@ void QSGGeometryNode::setMaterial(QSGMaterial *material) delete m_material; m_material = material; #ifndef QT_NO_DEBUG - if (m_material != 0 && m_opaque_material == m_material) + if (m_material != nullptr && m_opaque_material == m_material) qWarning("QSGGeometryNode: using same material for both opaque and translucent"); #endif markDirty(DirtyMaterial); @@ -1010,7 +999,7 @@ void QSGGeometryNode::setOpaqueMaterial(QSGMaterial *material) delete m_opaque_material; m_opaque_material = material; #ifndef QT_NO_DEBUG - if (m_opaque_material != 0 && m_opaque_material == m_material) + if (m_opaque_material != nullptr && m_opaque_material == m_material) qWarning("QSGGeometryNode: using same material for both opaque and translucent"); #endif @@ -1274,7 +1263,7 @@ QSGRootNode::QSGRootNode() QSGRootNode::~QSGRootNode() { while (!m_renderers.isEmpty()) - m_renderers.constLast()->setRootNode(0); + m_renderers.constLast()->setRootNode(nullptr); destroy(); // Must call destroy() here because markDirty() casts this to QSGRootNode. } @@ -1326,8 +1315,6 @@ void QSGRootNode::notifyNodeChange(QSGNode *node, DirtyState state) */ QSGOpacityNode::QSGOpacityNode() : QSGNode(OpacityNodeType) - , m_opacity(1) - , m_combined_opacity(1) { } diff --git a/src/quick/scenegraph/coreapi/qsgnode.h b/src/quick/scenegraph/coreapi/qsgnode.h index cd9d689dc1..528f100f8e 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.h +++ b/src/quick/scenegraph/coreapi/qsgnode.h @@ -168,13 +168,13 @@ private: void init(); void destroy(); - QSGNode *m_parent; - NodeType m_type; - QSGNode *m_firstChild; - QSGNode *m_lastChild; - QSGNode *m_nextSibling; - QSGNode *m_previousSibling; - int m_subtreeRenderableCount; + QSGNode *m_parent = nullptr; + NodeType m_type = BasicNodeType; + QSGNode *m_firstChild = nullptr; + QSGNode *m_lastChild = nullptr; + QSGNode *m_nextSibling = nullptr; + QSGNode *m_previousSibling = nullptr; + int m_subtreeRenderableCount = 0; Flags m_nodeFlags; DirtyState m_dirtyState; // Obsolete, remove in Qt 6 @@ -246,11 +246,11 @@ protected: private: friend class QSGNodeUpdater; - int m_render_order; - QSGMaterial *m_material; - QSGMaterial *m_opaque_material; + int m_render_order = 0; + QSGMaterial *m_material = nullptr; + QSGMaterial *m_opaque_material = nullptr; - qreal m_opacity; + qreal m_opacity = 1; }; class Q_QUICK_EXPORT QSGClipNode : public QSGBasicGeometryNode @@ -323,8 +323,8 @@ public: bool isSubtreeBlocked() const override; private: - qreal m_opacity; - qreal m_combined_opacity; + qreal m_opacity = 1; + qreal m_combined_opacity = 1; }; class Q_QUICK_EXPORT QSGNodeVisitor { diff --git a/src/quick/scenegraph/coreapi/qsgnode_p.h b/src/quick/scenegraph/coreapi/qsgnode_p.h index 84d5477085..f81128f51a 100644 --- a/src/quick/scenegraph/coreapi/qsgnode_p.h +++ b/src/quick/scenegraph/coreapi/qsgnode_p.h @@ -78,18 +78,14 @@ public: class QSGBasicGeometryNodePrivate : public QSGNodePrivate { public: - QSGBasicGeometryNodePrivate() - : QSGNodePrivate() - {} + QSGBasicGeometryNodePrivate() {} }; class QSGGeometryNodePrivate: public QSGBasicGeometryNodePrivate { public: - QSGGeometryNodePrivate() - : QSGBasicGeometryNodePrivate() - {} + QSGGeometryNodePrivate() {} }; QT_END_NAMESPACE diff --git a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp index d6d533307e..8bc9ded594 100644 --- a/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp +++ b/src/quick/scenegraph/coreapi/qsgnodeupdater.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE QSGNodeUpdater::QSGNodeUpdater() : m_combined_matrix_stack(64) , m_opacity_stack(64) - , m_current_clip(0) + , m_current_clip(nullptr) , m_force_update(0) { m_opacity_stack.add(1); @@ -60,7 +60,7 @@ QSGNodeUpdater::~QSGNodeUpdater() void QSGNodeUpdater::updateStates(QSGNode *n) { - m_current_clip = 0; + m_current_clip = nullptr; m_force_update = 0; Q_ASSERT(m_opacity_stack.size() == 1); // The one we added in the constructr... @@ -82,7 +82,7 @@ void QSGNodeUpdater::updateStates(QSGNode *n) bool QSGNodeUpdater::isNodeBlocked(QSGNode *node, QSGNode *root) const { - while (node != root && node != 0) { + while (node != root && node != nullptr) { if (node->isSubtreeBlocked()) return true; node = node->parent(); diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index 3ae79a933f..e1ba001d2d 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -132,8 +132,8 @@ QSGRenderer::QSGRenderer(QSGRenderContext *context) , m_current_determinant(1) , m_device_pixel_ratio(1) , m_context(context) - , m_node_updater(0) - , m_bindable(0) + , m_node_updater(nullptr) + , m_bindable(nullptr) , m_changed_emitted(false) , m_is_rendering(false) , m_is_preprocessing(false) @@ -143,7 +143,7 @@ QSGRenderer::QSGRenderer(QSGRenderContext *context) QSGRenderer::~QSGRenderer() { - setRootNode(0); + setRootNode(nullptr); delete m_node_updater; } @@ -249,7 +249,7 @@ void QSGRenderer::renderScene(const QSGBindable &bindable) m_is_rendering = false; m_changed_emitted = false; - m_bindable = 0; + m_bindable = nullptr; qCDebug(QSG_LOG_TIME_RENDERER, "time in renderer: total=%dms, preprocess=%d, updates=%d, binding=%d, rendering=%d", diff --git a/src/quick/scenegraph/coreapi/qsgrenderer_p.h b/src/quick/scenegraph/coreapi/qsgrenderer_p.h index b890728fd8..d4ff6ea9fe 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgrenderer_p.h @@ -162,12 +162,12 @@ class Q_QUICK_PRIVATE_EXPORT QSGNodeDumper : public QSGNodeVisitor { public: static void dump(QSGNode *n); - QSGNodeDumper() : m_indent(0) {} + QSGNodeDumper() {} void visitNode(QSGNode *n) override; void visitChildren(QSGNode *n) override; private: - int m_indent; + int m_indent = 0; }; diff --git a/src/quick/scenegraph/coreapi/qsgrendernode.cpp b/src/quick/scenegraph/coreapi/qsgrendernode.cpp index 5e259f2083..df3fa16a32 100644 --- a/src/quick/scenegraph/coreapi/qsgrendernode.cpp +++ b/src/quick/scenegraph/coreapi/qsgrendernode.cpp @@ -74,8 +74,8 @@ QSGRenderNode::~QSGRenderNode() } QSGRenderNodePrivate::QSGRenderNodePrivate() - : m_matrix(0) - , m_clip_list(0) + : m_matrix(nullptr) + , m_clip_list(nullptr) , m_opacity(1) { } @@ -119,7 +119,7 @@ QSGRenderNodePrivate::QSGRenderNodePrivate() */ QSGRenderNode::StateFlags QSGRenderNode::changedStates() const { - return 0; + return nullptr; } /*! @@ -267,7 +267,7 @@ void QSGRenderNode::releaseResources() */ QSGRenderNode::RenderingFlags QSGRenderNode::flags() const { - return 0; + return nullptr; } /*! diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h index ba146b884f..9c88b8272c 100644 --- a/src/quick/scenegraph/qsgadaptationlayer_p.h +++ b/src/quick/scenegraph/qsgadaptationlayer_p.h @@ -266,19 +266,19 @@ public: Texture // for APIs with separate texture and sampler objects }; struct InputParameter { - InputParameter() : semanticIndex(0) { } + InputParameter() {} // Semantics use the D3D keys (POSITION, TEXCOORD). // Attribute name based APIs can map based on pre-defined names. QByteArray semanticName; - int semanticIndex; + int semanticIndex = 0; }; struct Variable { - Variable() : type(Constant), offset(0), size(0), bindPoint(0) { } - VariableType type; + Variable() {} + VariableType type = Constant; QByteArray name; - uint offset; // for cbuffer members - uint size; // for cbuffer members - int bindPoint; // for textures and samplers; for register-based APIs + uint offset = 0; // for cbuffer members + uint size = 0; // for cbuffer members + int bindPoint = 0; // for textures and samplers; for register-based APIs }; QByteArray blob; // source or bytecode @@ -329,8 +329,8 @@ public: }; struct ShaderData { - ShaderData() : hasShaderCode(false) { } - bool hasShaderCode; + ShaderData() {} + bool hasShaderCode = false; QSGGuiThreadShaderEffectManager::ShaderInfo shaderInfo; QVector<VariableData> varData; }; @@ -373,7 +373,7 @@ public: HighQualitySubPixelAntialiasing }; - QSGGlyphNode() : m_ownerElement(0) {} + QSGGlyphNode() {} virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) = 0; virtual void setColor(const QColor &color) = 0; @@ -394,7 +394,7 @@ public: void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); } protected: QRectF m_bounding_rect; - QQuickItem *m_ownerElement; + QQuickItem *m_ownerElement = nullptr; }; class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldGlyphConsumer @@ -421,24 +421,24 @@ public: }; struct TexCoord { - qreal x; - qreal y; - qreal width; - qreal height; - qreal xMargin; - qreal yMargin; + qreal x = 0; + qreal y = 0; + qreal width = -1; + qreal height = -1; + qreal xMargin = 0; + qreal yMargin = 0; - TexCoord() : x(0), y(0), width(-1), height(-1), xMargin(0), yMargin(0) { } + TexCoord() {} bool isNull() const { return width <= 0 || height <= 0; } bool isValid() const { return width >= 0 && height >= 0; } }; struct Texture { - uint textureId; + uint textureId = 0; QSize size; - Texture() : textureId(0), size(QSize()) { } + Texture() : size(QSize()) { } bool operator == (const Texture &other) const { return textureId == other.textureId; } }; @@ -478,13 +478,13 @@ protected: }; struct GlyphData { - Texture *texture; + Texture *texture = nullptr; TexCoord texCoord; QRectF boundingRect; QPainterPath path; - quint32 ref; + quint32 ref = 0; - GlyphData() : texture(0), ref(0) { } + GlyphData() {} }; virtual void requestGlyphs(const QSet<glyph_t> &glyphs) = 0; diff --git a/src/quick/scenegraph/qsgbasicglyphnode.cpp b/src/quick/scenegraph/qsgbasicglyphnode.cpp index 38f650a82c..4559b7951c 100644 --- a/src/quick/scenegraph/qsgbasicglyphnode.cpp +++ b/src/quick/scenegraph/qsgbasicglyphnode.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE QSGBasicGlyphNode::QSGBasicGlyphNode() : m_style(QQuickText::Normal) - , m_material(0) + , m_material(nullptr) , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0) { m_geometry.setDrawingMode(QSGGeometry::DrawTriangles); @@ -59,7 +59,7 @@ QSGBasicGlyphNode::~QSGBasicGlyphNode() void QSGBasicGlyphNode::setColor(const QColor &color) { m_color = color; - if (m_material != 0) { + if (m_material != nullptr) { setMaterialColor(color); markDirty(DirtyMaterial); } @@ -67,7 +67,7 @@ void QSGBasicGlyphNode::setColor(const QColor &color) void QSGBasicGlyphNode::setGlyphs(const QPointF &position, const QGlyphRun &glyphs) { - if (m_material != 0) + if (m_material != nullptr) delete m_material; m_position = position; diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index a6819b338d..d9ed25c099 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -372,7 +372,7 @@ void QSGRenderContext::registerFontengineForCleanup(QFontEngine *engine) QSGTexture *QSGRenderContext::textureForFactory(QQuickTextureFactory *factory, QQuickWindow *window) { if (!factory) - return 0; + return nullptr; m_mutex.lock(); QSGTexture *texture = m_textures.value(factory); diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index da0adcd5d7..00c23be60c 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -110,7 +110,7 @@ public: MsaaAntialiasing }; - explicit QSGContext(QObject *parent = 0); + explicit QSGContext(QObject *parent = nullptr); virtual ~QSGContext(); virtual void renderContextInitialized(QSGRenderContext *renderContext); diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp index 634a492aa3..628619fa46 100644 --- a/src/quick/scenegraph/qsgcontextplugin.cpp +++ b/src/quick/scenegraph/qsgcontextplugin.cpp @@ -74,8 +74,8 @@ struct QSGAdaptationBackendData { QSGAdaptationBackendData(); - bool tried; - QSGContextFactoryInterface *factory; + bool tried = false; + QSGContextFactoryInterface *factory = nullptr; QString name; QSGContextFactoryInterface::Flags flags; @@ -85,9 +85,7 @@ struct QSGAdaptationBackendData }; QSGAdaptationBackendData::QSGAdaptationBackendData() - : tried(false) - , factory(nullptr) - , flags(0) + : flags(nullptr) { // Fill in the table with the built-in adaptations. builtIns.append(new QSGSoftwareAdaptation); @@ -209,7 +207,7 @@ QQuickTextureFactory *QSGContext::createTextureFactoryFromImage(const QImage &im QSGAdaptationBackendData *backendData = contextFactory(); if (backendData->factory) return backendData->factory->createTextureFactoryFromImage(image); - return 0; + return nullptr; } @@ -223,7 +221,7 @@ QSGRenderLoop *QSGContext::createWindowManager() QSGAdaptationBackendData *backendData = contextFactory(); if (backendData->factory) return backendData->factory->createWindowManager(); - return 0; + return nullptr; } void QSGContext::setBackend(const QString &backend) diff --git a/src/quick/scenegraph/qsgcontextplugin_p.h b/src/quick/scenegraph/qsgcontextplugin_p.h index 02d4b79b76..d37d4df270 100644 --- a/src/quick/scenegraph/qsgcontextplugin_p.h +++ b/src/quick/scenegraph/qsgcontextplugin_p.h @@ -87,13 +87,13 @@ class Q_QUICK_PRIVATE_EXPORT QSGContextPlugin : public QObject, public QSGContex Q_OBJECT Q_INTERFACES(QSGContextFactoryInterface:QFactoryInterface) public: - explicit QSGContextPlugin(QObject *parent = 0); + explicit QSGContextPlugin(QObject *parent = nullptr); virtual ~QSGContextPlugin(); QStringList keys() const override = 0; - QQuickTextureFactory *createTextureFactoryFromImage(const QImage &) override { return 0; } - QSGRenderLoop *createWindowManager() override { return 0; } + QQuickTextureFactory *createTextureFactoryFromImage(const QImage &) override { return nullptr; } + QSGRenderLoop *createWindowManager() override { return nullptr; } }; QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgdefaultcontext_p.h b/src/quick/scenegraph/qsgdefaultcontext_p.h index b2964bf403..6dfd197cf6 100644 --- a/src/quick/scenegraph/qsgdefaultcontext_p.h +++ b/src/quick/scenegraph/qsgdefaultcontext_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE class Q_QUICK_PRIVATE_EXPORT QSGDefaultContext : public QSGContext, public QSGRendererInterface { public: - QSGDefaultContext(QObject *parent = 0); + QSGDefaultContext(QObject *parent = nullptr); ~QSGDefaultContext(); void renderContextInitialized(QSGRenderContext *renderContext) override; diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp index 7789ef8fb1..ef189ba461 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp @@ -63,12 +63,12 @@ QSGDefaultDistanceFieldGlyphCache::QSGDefaultDistanceFieldGlyphCache(QOpenGLCont : QSGDistanceFieldGlyphCache(c, font) , m_maxTextureSize(0) , m_maxTextureCount(3) - , m_blitProgram(0) + , m_blitProgram(nullptr) , m_blitBuffer(QOpenGLBuffer::VertexBuffer) - , m_fboGuard(0) + , m_fboGuard(nullptr) , m_funcs(c->functions()) #if !defined(QT_OPENGL_ES_2) - , m_coreFuncs(0) + , m_coreFuncs(nullptr) #endif { if (Q_LIKELY(m_blitBuffer.create())) { @@ -89,7 +89,7 @@ QSGDefaultDistanceFieldGlyphCache::~QSGDefaultDistanceFieldGlyphCache() for (int i = 0; i < m_textures.count(); ++i) m_funcs->glDeleteTextures(1, &m_textures[i].texture); - if (m_fboGuard != 0) + if (m_fboGuard != nullptr) m_fboGuard->free(); delete m_blitProgram; @@ -400,7 +400,7 @@ void QSGDefaultDistanceFieldGlyphCache::resizeTexture(TextureInfo *texInfo, int m_funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); #endif m_funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + GL_RGBA, GL_UNSIGNED_BYTE, nullptr); m_funcs->glBindTexture(GL_TEXTURE_2D, 0); m_funcs->glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tmp_texture, 0); diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h index fe365495c2..76c0d20647 100644 --- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h +++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h @@ -91,10 +91,9 @@ private: QSize size; QRect allocatedArea; QDistanceField image; - int padding; + int padding = -1; - TextureInfo(const QRect &preallocRect = QRect()) : texture(0), allocatedArea(preallocRect), padding(-1) - { } + TextureInfo(const QRect &preallocRect = QRect()) : texture(0), allocatedArea(preallocRect) { } }; void createTexture(TextureInfo * texInfo, int width, int height); diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index 0169f097bc..dc473a6640 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -107,7 +107,7 @@ protected: char const *const *QSGTextMaskShader::attributeNames() const { - static char const *const attr[] = { "vCoord", "tCoord", 0 }; + static char const *const attr[] = { "vCoord", "tCoord", nullptr }; return attr; } @@ -141,13 +141,13 @@ void QSGTextMaskShader::updateState(const RenderState &state, QSGMaterial *newEf { QSGTextMaskMaterial *material = static_cast<QSGTextMaskMaterial *>(newEffect); QSGTextMaskMaterial *oldMaterial = static_cast<QSGTextMaskMaterial *>(oldEffect); - Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); + Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type()); bool updated = material->ensureUpToDate(); Q_ASSERT(material->texture()); - Q_ASSERT(oldMaterial == 0 || oldMaterial->texture()); + Q_ASSERT(oldMaterial == nullptr || oldMaterial->texture()); if (updated - || oldMaterial == 0 + || oldMaterial == nullptr || oldMaterial->texture()->textureId() != material->texture()->textureId()) { program()->setUniformValue(m_textureScale_id, QVector2D(1.0 / material->cacheTextureWidth(), 1.0 / material->cacheTextureHeight())); @@ -190,7 +190,7 @@ void QSG8BitTextMaskShader::updateState(const RenderState &state, QSGMaterial *n QSGTextMaskMaterial *material = static_cast<QSGTextMaskMaterial *>(newEffect); QSGTextMaskMaterial *oldMaterial = static_cast<QSGTextMaskMaterial *>(oldEffect); - if (oldMaterial == 0 || material->color() != oldMaterial->color() || state.isOpacityDirty()) { + if (oldMaterial == nullptr || material->color() != oldMaterial->color() || state.isOpacityDirty()) { QVector4D color = qsg_premultiply(material->color(), state.opacity()); program()->setUniformValue(m_color_id, color); } @@ -282,7 +282,7 @@ void QSG24BitTextMaskShader::updateState(const RenderState &state, QSGMaterial * QSGTextMaskMaterial *material = static_cast<QSGTextMaskMaterial *>(newEffect); QSGTextMaskMaterial *oldMaterial = static_cast<QSGTextMaskMaterial *>(oldEffect); - if (oldMaterial == 0 || material->color() != oldMaterial->color() || state.isOpacityDirty()) { + if (oldMaterial == nullptr || material->color() != oldMaterial->color() || state.isOpacityDirty()) { QVector4D color = material->color(); if (useSRGB()) color = qt_sRGB_to_linear_RGB(color); @@ -346,20 +346,20 @@ void QSGStyledTextShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { - Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); + Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type()); QSGStyledTextMaterial *material = static_cast<QSGStyledTextMaterial *>(newEffect); QSGStyledTextMaterial *oldMaterial = static_cast<QSGStyledTextMaterial *>(oldEffect); - if (oldMaterial == 0 || oldMaterial->styleShift() != material->styleShift()) + if (oldMaterial == nullptr || oldMaterial->styleShift() != material->styleShift()) program()->setUniformValue(m_shift_id, material->styleShift()); - if (oldMaterial == 0 || material->color() != oldMaterial->color() || state.isOpacityDirty()) { + if (oldMaterial == nullptr || material->color() != oldMaterial->color() || state.isOpacityDirty()) { QVector4D color = qsg_premultiply(material->color(), state.opacity()); program()->setUniformValue(m_color_id, color); } - if (oldMaterial == 0 || material->styleColor() != oldMaterial->styleColor() || state.isOpacityDirty()) { + if (oldMaterial == nullptr || material->styleColor() != oldMaterial->styleColor() || state.isOpacityDirty()) { QVector4D styleColor = qsg_premultiply(material->styleColor(), state.opacity()); program()->setUniformValue(m_styleColor_id, styleColor); } @@ -367,9 +367,9 @@ void QSGStyledTextShader::updateState(const RenderState &state, bool updated = material->ensureUpToDate(); Q_ASSERT(material->texture()); - Q_ASSERT(oldMaterial == 0 || oldMaterial->texture()); + Q_ASSERT(oldMaterial == nullptr || oldMaterial->texture()); if (updated - || oldMaterial == 0 + || oldMaterial == nullptr || oldMaterial->texture()->textureId() != material->texture()->textureId()) { program()->setUniformValue(m_textureScale_id, QVector2D(1.0 / material->cacheTextureWidth(), 1.0 / material->cacheTextureHeight())); @@ -400,8 +400,8 @@ public: }; QSGTextMaskMaterial::QSGTextMaskMaterial(const QRawFont &font, QFontEngine::GlyphFormat glyphFormat) - : m_texture(0) - , m_glyphCache(0) + : m_texture(nullptr) + , m_glyphCache(nullptr) , m_font(font) { init(glyphFormat); @@ -419,7 +419,7 @@ void QSGTextMaskMaterial::init(QFontEngine::GlyphFormat glyphFormat) setFlag(Blending, true); QOpenGLContext *ctx = const_cast<QOpenGLContext *>(QOpenGLContext::currentContext()); - Q_ASSERT(ctx != 0); + Q_ASSERT(ctx != nullptr); // The following piece of code will read/write to the font engine's caches, // potentially from different threads. However, this is safe because this diff --git a/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp b/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp index a5a6da06a7..5dd6eaa4ca 100644 --- a/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp +++ b/src/quick/scenegraph/qsgdefaultinternalimagenode.cpp @@ -83,7 +83,6 @@ QSGMaterialShader *QSGSmoothTextureMaterial::createShader() const } SmoothTextureMaterialShader::SmoothTextureMaterialShader() - : QSGTextureMaterialShader() { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothtexture.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothtexture.frag")); @@ -91,7 +90,7 @@ SmoothTextureMaterialShader::SmoothTextureMaterialShader() void SmoothTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { - if (oldEffect == 0) { + if (oldEffect == nullptr) { // The viewport is constant, so set the pixel size uniform only once. QRect r = state.viewportRect(); program()->setUniformValue(m_pixelSizeLoc, 2.0f / r.width(), 2.0f / r.height()); @@ -106,7 +105,7 @@ char const *const *SmoothTextureMaterialShader::attributeNames() const "multiTexCoord", "vertexOffset", "texCoordOffset", - 0 + nullptr }; return attributes; } @@ -171,7 +170,7 @@ void QSGDefaultInternalImageNode::updateMaterialAntialiasing() { if (m_antialiasing) { setMaterial(&m_smoothMaterial); - setOpaqueMaterial(0); + setOpaqueMaterial(nullptr); } else { setMaterial(&m_materialO); setOpaqueMaterial(&m_material); diff --git a/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp b/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp index e52dcaad52..fd0dcebd57 100644 --- a/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp +++ b/src/quick/scenegraph/qsgdefaultinternalrectanglenode.cpp @@ -67,7 +67,6 @@ private: }; SmoothColorMaterialShader::SmoothColorMaterialShader() - : QSGMaterialShader() { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothcolor.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/smoothcolor.frag")); @@ -81,7 +80,7 @@ void SmoothColorMaterialShader::updateState(const RenderState &state, QSGMateria if (state.isMatrixDirty()) program()->setUniformValue(m_matrixLoc, state.combinedMatrix()); - if (oldEffect == 0) { + if (oldEffect == nullptr) { // The viewport is constant, so set the pixel size uniform only once. QRect r = state.viewportRect(); program()->setUniformValue(m_pixelSizeLoc, 2.0f / r.width(), 2.0f / r.height()); @@ -94,7 +93,7 @@ char const *const *SmoothColorMaterialShader::attributeNames() const "vertex", "vertexColor", "vertexOffset", - 0 + nullptr }; return attributes; } diff --git a/src/quick/scenegraph/qsgdefaultlayer.cpp b/src/quick/scenegraph/qsgdefaultlayer.cpp index cd9c4a9a90..b2b123912f 100644 --- a/src/quick/scenegraph/qsgdefaultlayer.cpp +++ b/src/quick/scenegraph/qsgdefaultlayer.cpp @@ -90,15 +90,15 @@ namespace QSGDefaultLayer::QSGDefaultLayer(QSGRenderContext *context) : QSGLayer() - , m_item(0) + , m_item(nullptr) , m_device_pixel_ratio(1) , m_format(GL_RGBA) - , m_renderer(0) - , m_fbo(0) - , m_secondaryFbo(0) + , m_renderer(nullptr) + , m_fbo(nullptr) + , m_secondaryFbo(nullptr) , m_transparentTexture(0) #ifdef QSG_DEBUG_FBO_OVERLAY - , m_debugOverlay(0) + , m_debugOverlay(nullptr) #endif , m_samples(0) , m_mipmap(false) @@ -122,13 +122,13 @@ QSGDefaultLayer::~QSGDefaultLayer() void QSGDefaultLayer::invalidated() { delete m_renderer; - m_renderer = 0; + m_renderer = nullptr; delete m_fbo; delete m_secondaryFbo; - m_fbo = m_secondaryFbo = 0; + m_fbo = m_secondaryFbo = nullptr; #ifdef QSG_DEBUG_FBO_OVERLAY delete m_debugOverlay; - m_debugOverlay = 0; + m_debugOverlay = nullptr; #endif if (m_transparentTexture) { QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &m_transparentTexture); @@ -204,7 +204,7 @@ void QSGDefaultLayer::setItem(QSGNode *item) if (m_live && !m_item) { delete m_fbo; delete m_secondaryFbo; - m_fbo = m_secondaryFbo = 0; + m_fbo = m_secondaryFbo = nullptr; m_depthStencilBuffer.clear(); } @@ -228,7 +228,7 @@ void QSGDefaultLayer::setSize(const QSize &size) if (m_live && m_size.isNull()) { delete m_fbo; delete m_secondaryFbo; - m_fbo = m_secondaryFbo = 0; + m_fbo = m_secondaryFbo = nullptr; m_depthStencilBuffer.clear(); } @@ -252,7 +252,7 @@ void QSGDefaultLayer::setLive(bool live) if (m_live && (!m_item || m_size.isNull())) { delete m_fbo; delete m_secondaryFbo; - m_fbo = m_secondaryFbo = 0; + m_fbo = m_secondaryFbo = nullptr; m_depthStencilBuffer.clear(); } @@ -295,7 +295,7 @@ void QSGDefaultLayer::grab() if (!m_item || m_size.isNull()) { delete m_fbo; delete m_secondaryFbo; - m_fbo = m_secondaryFbo = 0; + m_fbo = m_secondaryFbo = nullptr; m_depthStencilBuffer.clear(); m_dirtyTexture = false; return; @@ -362,7 +362,7 @@ void QSGDefaultLayer::grab() delete m_fbo; delete m_secondaryFbo; m_fbo = new QOpenGLFramebufferObject(m_size, format); - m_secondaryFbo = 0; + m_secondaryFbo = nullptr; funcs->glBindTexture(GL_TEXTURE_2D, m_fbo->texture()); updateBindOptions(true); m_depthStencilBuffer = m_context->depthStencilBufferForFbo(m_fbo); diff --git a/src/quick/scenegraph/qsgdefaultrendercontext.cpp b/src/quick/scenegraph/qsgdefaultrendercontext.cpp index 12357f12c7..7882496062 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext.cpp +++ b/src/quick/scenegraph/qsgdefaultrendercontext.cpp @@ -157,14 +157,14 @@ void QSGDefaultRenderContext::invalidate() m_fontEnginesToClean.clear(); delete m_depthStencilManager; - m_depthStencilManager = 0; + m_depthStencilManager = nullptr; qDeleteAll(m_glyphCaches); m_glyphCaches.clear(); if (m_gl->property(QSG_RENDERCONTEXT_PROPERTY) == QVariant::fromValue(this)) m_gl->setProperty(QSG_RENDERCONTEXT_PROPERTY, QVariant()); - m_gl = 0; + m_gl = nullptr; if (m_sg) m_sg->renderContextInvalidated(this); @@ -211,7 +211,7 @@ QSharedPointer<QSGDepthStencilBuffer> QSGDefaultRenderContext::depthStencilBuffe QSGDepthStencilBufferManager *QSGDefaultRenderContext::depthStencilBufferManager() { if (!m_gl) - return 0; + return nullptr; if (!m_depthStencilManager) m_depthStencilManager = new QSGDepthStencilBufferManager(m_gl); return m_depthStencilManager; diff --git a/src/quick/scenegraph/qsgdefaultrendercontext_p.h b/src/quick/scenegraph/qsgdefaultrendercontext_p.h index 68329256f1..eb62586a94 100644 --- a/src/quick/scenegraph/qsgdefaultrendercontext_p.h +++ b/src/quick/scenegraph/qsgdefaultrendercontext_p.h @@ -86,7 +86,7 @@ public: QSGRenderer *createRenderer() override; QSGTexture *compressedTextureForFactory(const QSGCompressedTextureFactory *factory) const override; - virtual void compileShader(QSGMaterialShader *shader, QSGMaterial *material, const char *vertexCode = 0, const char *fragmentCode = 0); + virtual void compileShader(QSGMaterialShader *shader, QSGMaterial *material, const char *vertexCode = nullptr, const char *fragmentCode = nullptr); virtual void initializeShader(QSGMaterialShader *shader); void setAttachToGraphicsContext(bool attach) override; diff --git a/src/quick/scenegraph/qsgdefaultspritenode.cpp b/src/quick/scenegraph/qsgdefaultspritenode.cpp index 7fe6048d59..8761d99c1f 100644 --- a/src/quick/scenegraph/qsgdefaultspritenode.cpp +++ b/src/quick/scenegraph/qsgdefaultspritenode.cpp @@ -70,26 +70,18 @@ public: return this - static_cast<const QQuickSpriteMaterial *>(other); } - QSGTexture *texture; - - float animT; - float animX1; - float animY1; - float animX2; - float animY2; - float animW; - float animH; + QSGTexture *texture = nullptr; + + float animT = 0.0f; + float animX1 = 0.0f; + float animY1 = 0.0f; + float animX2 = 0.0f; + float animY2 = 0.0f; + float animW = 1.0f; + float animH = 1.0f; }; QQuickSpriteMaterial::QQuickSpriteMaterial() - : texture(0) - , animT(0.0f) - , animX1(0.0f) - , animY1(0.0f) - , animX2(0.0f) - , animY2(0.0f) - , animW(1.0f) - , animH(1.0f) { setFlag(Blending, true); } @@ -103,7 +95,6 @@ class SpriteMaterialData : public QSGMaterialShader { public: SpriteMaterialData() - : QSGMaterialShader() { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/sprite.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/sprite.frag")); @@ -133,7 +124,7 @@ public: static const char *attr[] = { "vPos", "vTex", - 0 + nullptr }; return attr; } diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp index 32eda2d142..ae6336718e 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode.cpp @@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE QSGDistanceFieldGlyphNode::QSGDistanceFieldGlyphNode(QSGRenderContext *context) : m_glyphNodeType(RootGlyphNode) , m_context(context) - , m_material(0) - , m_glyph_cache(0) + , m_material(nullptr) + , m_glyph_cache(nullptr) , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0) , m_style(QQuickText::Normal) , m_antialiasingMode(GrayAntialiasing) - , m_texture(0) + , m_texture(nullptr) , m_dirtyGeometry(false) , m_dirtyMaterial(false) { @@ -80,7 +80,7 @@ QSGDistanceFieldGlyphNode::~QSGDistanceFieldGlyphNode() void QSGDistanceFieldGlyphNode::setColor(const QColor &color) { m_color = color; - if (m_material != 0) { + if (m_material != nullptr) { m_material->setColor(color); markDirty(DirtyMaterial); } else { @@ -113,7 +113,7 @@ void QSGDistanceFieldGlyphNode::setGlyphs(const QPointF &position, const QGlyphR return; if (m_glyph_cache != oldCache) { - Q_ASSERT(ownerElement() != 0); + Q_ASSERT(ownerElement() != nullptr); if (oldCache) { oldCache->unregisterGlyphNode(this); oldCache->unregisterOwnerElement(ownerElement()); @@ -181,7 +181,7 @@ void QSGDistanceFieldGlyphNode::updateGeometry() // Remove previously created sub glyph nodes // We assume all the children are sub glyph nodes QSGNode *subnode = firstChild(); - QSGNode *nextNode = 0; + QSGNode *nextNode = nullptr; while (subnode) { nextNode = subnode->nextSibling(); delete subnode; diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp index 03c5738e56..aa58218505 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp @@ -61,37 +61,27 @@ protected: void updateColor(const QVector4D &c); void updateTextureScale(const QVector2D &ts); - float m_fontScale; - float m_matrixScale; + float m_fontScale = 1.0; + float m_matrixScale = 1.0; - int m_matrix_id; - int m_textureScale_id; - int m_alphaMin_id; - int m_alphaMax_id; - int m_color_id; + int m_matrix_id = -1; + int m_textureScale_id = -1; + int m_alphaMin_id = -1; + int m_alphaMax_id = -1; + int m_color_id = -1; QVector2D m_lastTextureScale; QVector4D m_lastColor; - float m_lastAlphaMin; - float m_lastAlphaMax; + float m_lastAlphaMin = -1; + float m_lastAlphaMax = -1; }; char const *const *QSGDistanceFieldTextMaterialShader::attributeNames() const { - static char const *const attr[] = { "vCoord", "tCoord", 0 }; + static char const *const attr[] = { "vCoord", "tCoord", nullptr }; return attr; } QSGDistanceFieldTextMaterialShader::QSGDistanceFieldTextMaterialShader() - : QSGMaterialShader(), - m_fontScale(1.0) - , m_matrixScale(1.0) - , m_matrix_id(-1) - , m_textureScale_id(-1) - , m_alphaMin_id(-1) - , m_alphaMax_id(-1) - , m_color_id(-1) - , m_lastAlphaMin(-1) - , m_lastAlphaMax(-1) { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldtext.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldtext.frag")); @@ -166,13 +156,13 @@ void QSGDistanceFieldTextMaterialShader::initialize() void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { - Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); + Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type()); QSGDistanceFieldTextMaterial *material = static_cast<QSGDistanceFieldTextMaterial *>(newEffect); QSGDistanceFieldTextMaterial *oldMaterial = static_cast<QSGDistanceFieldTextMaterial *>(oldEffect); bool updated = material->updateTextureSize(); - if (oldMaterial == 0 + if (oldMaterial == nullptr || material->color() != oldMaterial->color() || state.isOpacityDirty()) { QVector4D color = material->color(); @@ -181,7 +171,7 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q } bool updateRange = false; - if (oldMaterial == 0 + if (oldMaterial == nullptr || material->fontScale() != oldMaterial->fontScale()) { m_fontScale = material->fontScale(); updateRange = true; @@ -198,7 +188,7 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q Q_ASSERT(material->glyphCache()); if (updated - || oldMaterial == 0 + || oldMaterial == nullptr || oldMaterial->texture()->textureId != material->texture()->textureId) { updateTextureScale(QVector2D(1.0 / material->textureSize().width(), 1.0 / material->textureSize().height())); @@ -218,8 +208,8 @@ void QSGDistanceFieldTextMaterialShader::updateState(const RenderState &state, Q } QSGDistanceFieldTextMaterial::QSGDistanceFieldTextMaterial() - : m_glyph_cache(0) - , m_texture(0) + : m_glyph_cache(nullptr) + , m_texture(nullptr) , m_fontScale(1.0) { setFlag(Blending | RequiresDeterminant, true); @@ -288,12 +278,11 @@ public: protected: void initialize() override; - int m_styleColor_id; + int m_styleColor_id = -1; }; DistanceFieldStyledTextMaterialShader::DistanceFieldStyledTextMaterialShader() : QSGDistanceFieldTextMaterialShader() - , m_styleColor_id(-1) { } @@ -310,7 +299,7 @@ void DistanceFieldStyledTextMaterialShader::updateState(const RenderState &state QSGDistanceFieldStyledTextMaterial *material = static_cast<QSGDistanceFieldStyledTextMaterial *>(newEffect); QSGDistanceFieldStyledTextMaterial *oldMaterial = static_cast<QSGDistanceFieldStyledTextMaterial *>(oldEffect); - if (oldMaterial == 0 + if (oldMaterial == nullptr || material->styleColor() != oldMaterial->styleColor() || (state.isOpacityDirty())) { QVector4D color = material->styleColor(); @@ -358,14 +347,12 @@ protected: void updateOutlineAlphaRange(int dfRadius); - int m_outlineAlphaMax0_id; - int m_outlineAlphaMax1_id; + int m_outlineAlphaMax0_id = -1; + int m_outlineAlphaMax1_id = -1; }; DistanceFieldOutlineTextMaterialShader::DistanceFieldOutlineTextMaterialShader() : DistanceFieldStyledTextMaterialShader() - , m_outlineAlphaMax0_id(-1) - , m_outlineAlphaMax1_id(-1) { setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldoutlinetext.frag")); } @@ -398,7 +385,7 @@ void DistanceFieldOutlineTextMaterialShader::updateState(const RenderState &stat QSGDistanceFieldOutlineTextMaterial *material = static_cast<QSGDistanceFieldOutlineTextMaterial *>(newEffect); QSGDistanceFieldOutlineTextMaterial *oldMaterial = static_cast<QSGDistanceFieldOutlineTextMaterial *>(oldEffect); - if (oldMaterial == 0 + if (oldMaterial == nullptr || material->fontScale() != oldMaterial->fontScale() || state.isMatrixDirty()) updateOutlineAlphaRange(material->glyphCache()->distanceFieldRadius()); @@ -438,12 +425,11 @@ protected: void updateShift(qreal fontScale, const QPointF& shift); - int m_shift_id; + int m_shift_id = -1; }; DistanceFieldShiftedStyleTextMaterialShader::DistanceFieldShiftedStyleTextMaterialShader() : DistanceFieldStyledTextMaterialShader() - , m_shift_id(-1) { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldshiftedtext.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/distancefieldshiftedtext.frag")); @@ -462,7 +448,7 @@ void DistanceFieldShiftedStyleTextMaterialShader::updateState(const RenderState QSGDistanceFieldShiftedStyleTextMaterial *material = static_cast<QSGDistanceFieldShiftedStyleTextMaterial *>(newEffect); QSGDistanceFieldShiftedStyleTextMaterial *oldMaterial = static_cast<QSGDistanceFieldShiftedStyleTextMaterial *>(oldEffect); - if (oldMaterial == 0 + if (oldMaterial == nullptr || oldMaterial->fontScale() != material->fontScale() || oldMaterial->shift() != material->shift() || oldMaterial->textureSize() != material->textureSize()) { @@ -516,14 +502,12 @@ public: void updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) override; private: - int m_fontScale_id; - int m_vecDelta_id; + int m_fontScale_id = -1; + int m_vecDelta_id = -1; }; QSGHiQSubPixelDistanceFieldTextMaterialShader::QSGHiQSubPixelDistanceFieldTextMaterialShader() : QSGDistanceFieldTextMaterialShader() - , m_fontScale_id(-1) - , m_vecDelta_id(-1) { setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/hiqsubpixeldistancefieldtext.vert")); setShaderSourceFile(QOpenGLShader::Fragment, QStringLiteral(":/qt-project.org/scenegraph/shaders/hiqsubpixeldistancefieldtext.frag")); @@ -550,19 +534,19 @@ void QSGHiQSubPixelDistanceFieldTextMaterialShader::deactivate() void QSGHiQSubPixelDistanceFieldTextMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { - Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); + Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type()); QSGDistanceFieldTextMaterial *material = static_cast<QSGDistanceFieldTextMaterial *>(newEffect); QSGDistanceFieldTextMaterial *oldMaterial = static_cast<QSGDistanceFieldTextMaterial *>(oldEffect); - if (oldMaterial == 0 || material->color() != oldMaterial->color()) { + if (oldMaterial == nullptr || material->color() != oldMaterial->color()) { QVector4D c = material->color(); state.context()->functions()->glBlendColor(c.x(), c.y(), c.z(), 1.0f); } - if (oldMaterial == 0 || material->fontScale() != oldMaterial->fontScale()) + if (oldMaterial == nullptr || material->fontScale() != oldMaterial->fontScale()) program()->setUniformValue(m_fontScale_id, GLfloat(material->fontScale())); - if (oldMaterial == 0 || state.isMatrixDirty()) { + if (oldMaterial == nullptr || state.isMatrixDirty()) { int viewportWidth = state.viewportRect().width(); QMatrix4x4 mat = state.combinedMatrix().inverted(); program()->setUniformValue(m_vecDelta_id, mat.column(0) * (qreal(2) / viewportWidth)); diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index e74ba83e7f..60f3538662 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -88,7 +88,7 @@ extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_ DEFINE_BOOL_CONFIG_OPTION(qmlNoThreadedRenderer, QML_BAD_GUI_RENDER_LOOP); DEFINE_BOOL_CONFIG_OPTION(qmlForceThreadedRenderer, QML_FORCE_THREADED_RENDERER); // Might trigger graphics driver threading bugs, use at own risk #endif -QSGRenderLoop *QSGRenderLoop::s_instance = 0; +QSGRenderLoop *QSGRenderLoop::s_instance = nullptr; QSGRenderLoop::~QSGRenderLoop() { @@ -107,11 +107,11 @@ void QSGRenderLoop::cleanup() QQuickWindowPrivate *wd = QQuickWindowPrivate::get(w); if (wd->windowManager == s_instance) { s_instance->windowDestroyed(w); - wd->windowManager = 0; + wd->windowManager = nullptr; } } delete s_instance; - s_instance = 0; + s_instance = nullptr; } /*! @@ -155,7 +155,7 @@ public: void releaseResources(QQuickWindow *) override; - QAnimationDriver *animationDriver() const override { return 0; } + QAnimationDriver *animationDriver() const override { return nullptr; } QSGContext *sceneGraphContext() const override; QSGRenderContext *createRenderContext(QSGContext *) const override { return rc; } @@ -275,7 +275,7 @@ void QSGRenderLoop::handleContextCreationFailure(QQuickWindow *window, } #if QT_CONFIG(opengl) QSGGuiThreadRenderLoop::QSGGuiThreadRenderLoop() - : gl(0) + : gl(nullptr) { if (qsg_useConsistentTiming()) { QUnifiedTimer::instance(true)->setConsistentTiming(true); @@ -337,7 +337,7 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window) if (m_windows.size() == 0) { rc->invalidate(); delete gl; - gl = 0; + gl = nullptr; } else if (gl && window == gl->surface() && current) { gl->doneCurrent(); } @@ -364,7 +364,7 @@ void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) if (!gl->create()) { const bool isEs = gl->isOpenGLES(); delete gl; - gl = 0; + gl = nullptr; handleContextCreationFailure(window, isEs); } else { cd->fireOpenGLContextCreated(gl); diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index c2f0cc4716..8262708320 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -167,7 +167,7 @@ template <typename T> T *windowFor(const QList<T> &list, QQuickWindow *window) if (t.window == window) return const_cast<T *>(&t); } - return 0; + return nullptr; } @@ -270,13 +270,13 @@ class QSGRenderThread : public QThread public: QSGRenderThread(QSGThreadedRenderLoop *w, QSGRenderContext *renderContext) : wm(w) - , gl(0) - , animatorDriver(0) + , gl(nullptr) + , animatorDriver(nullptr) , pendingUpdate(0) , sleeping(false) , syncResultedInChanges(false) , active(false) - , window(0) + , window(nullptr) , stopEventProcessing(false) { sgrc = static_cast<QSGDefaultRenderContext *>(renderContext); @@ -366,7 +366,7 @@ bool QSGRenderThread::event(QEvent *e) if (window) { QQuickWindowPrivate::get(window)->fireAboutToStop(); qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- window removed"); - window = 0; + window = nullptr; } waitCondition.wakeOne(); mutex.unlock(); @@ -456,7 +456,7 @@ bool QSGRenderThread::event(QEvent *e) gl->makeCurrent(window); ce->job->run(); delete ce->job; - ce->job = 0; + ce->job = nullptr; qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- job done"); } return true; @@ -514,7 +514,7 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, sgrc->invalidate(); QCoreApplication::processEvents(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); if (inDestructor) delete dd->animationController; if (current) @@ -523,7 +523,7 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, if (wipeGL) { delete gl; - gl = 0; + gl = nullptr; qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- invalidated OpenGL"); } else { qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- persistent GL, avoiding cleanup"); @@ -554,7 +554,7 @@ void QSGRenderThread::sync(bool inExpose) } if (current) { QQuickWindowPrivate *d = QQuickWindowPrivate::get(window); - bool hadRenderer = d->renderer != 0; + bool hadRenderer = d->renderer != nullptr; // If the scene graph was touched since the last sync() make sure it sends the // changed signal. if (d->renderer) @@ -570,7 +570,7 @@ void QSGRenderThread::sync(bool inExpose) // Process deferred deletes now, directly after the sync as // deleteLater on the GUI must now also have resulted in SG changes // and the delete is a safe operation. - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); } else { qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "- window has bad size, sync aborted"); } @@ -716,7 +716,7 @@ void QSGRenderThread::processEventsAndWaitForMore() void QSGRenderThread::run() { qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "run()"); - animatorDriver = sgrc->sceneGraphContext()->createAnimationDriver(0); + animatorDriver = sgrc->sceneGraphContext()->createAnimationDriver(nullptr); animatorDriver->install(); if (QQmlDebugConnector::service<QQmlProfilerService>()) QQuickProfiler::registerAnimationCallback(); @@ -745,7 +745,7 @@ void QSGRenderThread::run() qCDebug(QSG_LOG_RENDERLOOP, QSG_RT_PAD, "run() completed"); delete animatorDriver; - animatorDriver = 0; + animatorDriver = nullptr; sgrc->moveToThread(wm->thread()); moveToThread(wm->thread()); @@ -826,7 +826,7 @@ void QSGThreadedRenderLoop::animationStopped() void QSGThreadedRenderLoop::startOrStopAnimationTimer() { int exposedWindows = 0; - const Window *theOne = 0; + const Window *theOne = nullptr; for (int i=0; i<m_windows.size(); ++i) { const Window &w = m_windows.at(i); if (w.window->isVisible() && w.window->isExposed()) { @@ -973,7 +973,7 @@ void QSGThreadedRenderLoop::handleExposure(QQuickWindow *window) if (!w->thread->gl->create()) { const bool isEs = w->thread->gl->isOpenGLES(); delete w->thread->gl; - w->thread->gl = 0; + w->thread->gl = nullptr; handleContextCreationFailure(w->window, isEs); return; } @@ -1123,7 +1123,7 @@ void QSGThreadedRenderLoop::releaseResources(Window *w, bool inDestructor) // and the OpenGL resources. // QOffscreenSurface must be created on the GUI thread, so we // create it here and pass it on to QSGRenderThread::invalidateGL() - QOffscreenSurface *fallback = 0; + QOffscreenSurface *fallback = nullptr; if (!window->handle()) { qCDebug(QSG_LOG_RENDERLOOP, "- using fallback surface"); fallback = new QOffscreenSurface(); diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index 8072359e11..3b2737b8e1 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -78,7 +78,7 @@ static QElapsedTimer qsg_render_timer; QSGWindowsRenderLoop::QSGWindowsRenderLoop() - : m_gl(0) + : m_gl(nullptr) , m_sg(QSGContext::createDefaultContext()) , m_updateTimer(0) , m_animationTimer(0) @@ -117,7 +117,7 @@ QSGWindowsRenderLoop::WindowData *QSGWindowsRenderLoop::windowData(QQuickWindow if (wd.window == window) return &wd; } - return 0; + return nullptr; } void QSGWindowsRenderLoop::maybePostUpdateTimer() @@ -158,7 +158,7 @@ void QSGWindowsRenderLoop::stopped() void QSGWindowsRenderLoop::show(QQuickWindow *window) { RLDEBUG("show"); - if (windowData(window) != 0) + if (windowData(window) != nullptr) return; // This happens before the platform window is shown, but after @@ -178,7 +178,7 @@ void QSGWindowsRenderLoop::show(QQuickWindow *window) if (!created) { const bool isEs = m_gl->isOpenGLES(); delete m_gl; - m_gl = 0; + m_gl = nullptr; handleContextCreationFailure(window, isEs); return; } @@ -253,7 +253,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window) if (m_windows.size() == 0) { d->context->invalidate(); delete m_gl; - m_gl = 0; + m_gl = nullptr; } else if (m_gl && current) { m_gl->doneCurrent(); } @@ -272,7 +272,7 @@ bool QSGWindowsRenderLoop::anyoneShowing() const void QSGWindowsRenderLoop::exposureChanged(QQuickWindow *window) { - if (windowData(window) == 0) + if (windowData(window) == nullptr) return; if (window->isExposed() && window->isVisible()) { diff --git a/src/quick/scenegraph/util/qsgareaallocator.cpp b/src/quick/scenegraph/util/qsgareaallocator.cpp index 67a9fa285a..cd270a1d63 100644 --- a/src/quick/scenegraph/util/qsgareaallocator.cpp +++ b/src/quick/scenegraph/util/qsgareaallocator.cpp @@ -72,8 +72,8 @@ struct QSGAreaAllocatorNode QSGAreaAllocatorNode::QSGAreaAllocatorNode(QSGAreaAllocatorNode *parent) : parent(parent) - , left(0) - , right(0) + , left(nullptr) + , right(nullptr) , isOccupied(false) { } @@ -86,14 +86,14 @@ QSGAreaAllocatorNode::~QSGAreaAllocatorNode() bool QSGAreaAllocatorNode::isLeaf() { - Q_ASSERT((left != 0) == (right != 0)); + Q_ASSERT((left != nullptr) == (right != nullptr)); return !left; } QSGAreaAllocator::QSGAreaAllocator(const QSize &size) : m_size(size) { - m_root = new QSGAreaAllocatorNode(0); + m_root = new QSGAreaAllocatorNode(nullptr); } QSGAreaAllocator::~QSGAreaAllocator() @@ -179,13 +179,13 @@ bool QSGAreaAllocator::deallocateInNode(const QPoint &pos, QSGAreaAllocatorNode void QSGAreaAllocator::mergeNodeWithNeighbors(QSGAreaAllocatorNode *node) { bool done = false; - QSGAreaAllocatorNode *parent = 0; - QSGAreaAllocatorNode *current = 0; + QSGAreaAllocatorNode *parent = nullptr; + QSGAreaAllocatorNode *current = nullptr; QSGAreaAllocatorNode *sibling; while (!done) { Q_ASSERT(node->isLeaf()); Q_ASSERT(!node->isOccupied); - if (node->parent == 0) + if (node->parent == nullptr) return; // No neighbours. SplitType splitType = SplitType(node->parent->splitType); @@ -238,7 +238,7 @@ void QSGAreaAllocator::mergeNodeWithNeighbors(QSGAreaAllocatorNode *node) } sibling->parent = parent->parent; *nodeRef = sibling; - parent->left = parent->right = 0; + parent->left = parent->right = nullptr; delete parent; delete neighbor; done = false; @@ -276,7 +276,7 @@ void QSGAreaAllocator::mergeNodeWithNeighbors(QSGAreaAllocatorNode *node) } sibling->parent = parent->parent; *nodeRef = sibling; - parent->left = parent->right = 0; + parent->left = parent->right = nullptr; delete parent; delete neighbor; done = false; diff --git a/src/quick/scenegraph/util/qsgareaallocator_p.h b/src/quick/scenegraph/util/qsgareaallocator_p.h index aa40ff0a6e..8bc05a5a5b 100644 --- a/src/quick/scenegraph/util/qsgareaallocator_p.h +++ b/src/quick/scenegraph/util/qsgareaallocator_p.h @@ -67,7 +67,7 @@ public: QRect allocate(const QSize &size); bool deallocate(const QRect &rect); - bool isEmpty() const { return m_root == 0; } + bool isEmpty() const { return m_root == nullptr; } QSize size() const { return m_size; } private: bool allocateInNode(const QSize &size, QPoint &result, const QRect ¤tRect, QSGAreaAllocatorNode *node); diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp index 4ca5fba7de..7608a81ddc 100644 --- a/src/quick/scenegraph/util/qsgatlastexture.cpp +++ b/src/quick/scenegraph/util/qsgatlastexture.cpp @@ -75,7 +75,7 @@ namespace QSGAtlasTexture { Manager::Manager() - : m_atlas(0) + : m_atlas(nullptr) { QOpenGLContext *gl = QOpenGLContext::currentContext(); Q_ASSERT(gl); @@ -105,7 +105,7 @@ Manager::Manager() Manager::~Manager() { - Q_ASSERT(m_atlas == 0); + Q_ASSERT(m_atlas == nullptr); Q_ASSERT(m_atlases.isEmpty()); } @@ -114,7 +114,7 @@ void Manager::invalidate() if (m_atlas) { m_atlas->invalidate(); m_atlas->deleteLater(); - m_atlas = 0; + m_atlas = nullptr; } QHash<unsigned int, QSGCompressedAtlasTexture::Atlas*>::iterator i = m_atlases.begin(); @@ -128,7 +128,7 @@ void Manager::invalidate() QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel) { - Texture *t = 0; + Texture *t = nullptr; if (image.width() < m_atlas_size_limit && image.height() < m_atlas_size_limit) { if (!m_atlas) m_atlas = new Atlas(m_atlas_size); @@ -142,7 +142,7 @@ QSGTexture *Manager::create(const QImage &image, bool hasAlphaChannel) QSGTexture *Manager::create(const QSGCompressedTextureFactory *factory) { - QSGTexture *t = 0; + QSGTexture *t = nullptr; if (!qsgEnableCompressedAtlas() || !factory->m_textureData || !factory->m_textureData->isValid()) return t; @@ -348,7 +348,7 @@ Texture *Atlas::create(const QImage &image) m_pending_uploads << t; return t; } - return 0; + return nullptr; } static void swizzleBGRAToRGBA(QImage *image) @@ -467,7 +467,7 @@ void Atlas::uploadBgra(Texture *texture) void Atlas::generateTexture() { QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); - funcs->glTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat, m_size.width(), m_size.height(), 0, m_externalFormat, GL_UNSIGNED_BYTE, 0); + funcs->glTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat, m_size.width(), m_size.height(), 0, m_externalFormat, GL_UNSIGNED_BYTE, nullptr); #if 0 QImage pink(m_size.width(), m_size.height(), QImage::Format_ARGB32_Premultiplied); @@ -527,7 +527,7 @@ void TextureBase::bind() Texture::Texture(Atlas *atlas, const QRect &textureRect, const QImage &image) : TextureBase(atlas, textureRect) , m_image(image) - , m_nonatlas_texture(0) + , m_nonatlas_texture(nullptr) , m_has_alpha(image.hasAlphaChannel()) { float w = atlas->size().width(); diff --git a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp index 9ffd1b4b08..981ea089be 100644 --- a/src/quick/scenegraph/util/qsgdefaultpainternode.cpp +++ b/src/quick/scenegraph/util/qsgdefaultpainternode.cpp @@ -78,11 +78,11 @@ QSGDefaultPainterNode::QSGDefaultPainterNode(QQuickPaintedItem *item) , m_preferredRenderTarget(QQuickPaintedItem::Image) , m_actualRenderTarget(QQuickPaintedItem::Image) , m_item(item) - , m_fbo(0) - , m_multisampledFbo(0) + , m_fbo(nullptr) + , m_multisampledFbo(nullptr) , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) - , m_texture(0) - , m_gl_device(0) + , m_texture(nullptr) + , m_gl_device(nullptr) , m_fillColor(Qt::transparent) , m_contentsScale(1.0) , m_dirtyContents(false) @@ -260,8 +260,8 @@ void QSGDefaultPainterNode::updateRenderTarget() delete m_fbo; delete m_multisampledFbo; delete m_gl_device; - m_fbo = m_multisampledFbo = 0; - m_gl_device = 0; + m_fbo = m_multisampledFbo = nullptr; + m_gl_device = nullptr; } if (m_actualRenderTarget == QQuickPaintedItem::FramebufferObject || @@ -275,7 +275,7 @@ void QSGDefaultPainterNode::updateRenderTarget() delete m_fbo; delete m_multisampledFbo; - m_fbo = m_multisampledFbo = 0; + m_fbo = m_multisampledFbo = nullptr; if (m_gl_device) m_gl_device->setSize(m_fboSize); diff --git a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp index ba0207aca8..56508af152 100644 --- a/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp +++ b/src/quick/scenegraph/util/qsgdepthstencilbuffer.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE QSGDepthStencilBuffer::QSGDepthStencilBuffer(QOpenGLContext *context, const Format &format) : m_functions(context) - , m_manager(0) + , m_manager(nullptr) , m_format(format) , m_depthBuffer(0) , m_stencilBuffer(0) @@ -160,7 +160,7 @@ QSGDepthStencilBufferManager::~QSGDepthStencilBufferManager() for (Hash::const_iterator it = m_buffers.constBegin(), cend = m_buffers.constEnd(); it != cend; ++it) { QSGDepthStencilBuffer *buffer = it.value().data(); buffer->free(); - buffer->m_manager = 0; + buffer->m_manager = nullptr; } } @@ -174,7 +174,7 @@ QSharedPointer<QSGDepthStencilBuffer> QSGDepthStencilBufferManager::bufferForFor void QSGDepthStencilBufferManager::insertBuffer(const QSharedPointer<QSGDepthStencilBuffer> &buffer) { - Q_ASSERT(buffer->m_manager == 0); + Q_ASSERT(buffer->m_manager == nullptr); Q_ASSERT(!m_buffers.contains(buffer->m_format)); buffer->m_manager = this; m_buffers.insert(buffer->m_format, buffer.toWeakRef()); diff --git a/src/quick/scenegraph/util/qsgengine.cpp b/src/quick/scenegraph/util/qsgengine.cpp index dffe199224..91fa46033c 100644 --- a/src/quick/scenegraph/util/qsgengine.cpp +++ b/src/quick/scenegraph/util/qsgengine.cpp @@ -157,7 +157,7 @@ QSGAbstractRenderer *QSGEngine::createRenderer() const { Q_D(const QSGEngine); if (!d->sgRenderContext->isValid()) - return 0; + return nullptr; QSGRenderer *renderer = d->sgRenderContext->createRenderer(); renderer->setCustomRenderMode(qgetenv("QSG_VISUALIZE")); @@ -178,7 +178,7 @@ QSGTexture *QSGEngine::createTextureFromImage(const QImage &image, CreateTexture { Q_D(const QSGEngine); if (!d->sgRenderContext->isValid()) - return 0; + return nullptr; uint flags = 0; if (options & TextureCanUseAtlas) flags |= QSGRenderContext::CreateTexture_Atlas; if (!(options & TextureIsOpaque)) flags |= QSGRenderContext::CreateTexture_Alpha; @@ -206,7 +206,7 @@ QSGTexture *QSGEngine::createTextureFromId(uint id, const QSize &size, CreateTex texture->setTextureSize(size); return texture; } - return 0; + return nullptr; } /*! diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp index a0c71b5340..28f6113a60 100644 --- a/src/quick/scenegraph/util/qsgflatcolormaterial.cpp +++ b/src/quick/scenegraph/util/qsgflatcolormaterial.cpp @@ -77,13 +77,13 @@ FlatColorMaterialShader::FlatColorMaterialShader() void FlatColorMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { #if QT_CONFIG(opengl) - Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); + Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type()); QSGFlatColorMaterial *oldMaterial = static_cast<QSGFlatColorMaterial *>(oldEffect); QSGFlatColorMaterial *newMaterial = static_cast<QSGFlatColorMaterial *>(newEffect); const QColor &c = newMaterial->color(); - if (oldMaterial == 0 || c != oldMaterial->color() || state.isOpacityDirty()) { + if (oldMaterial == nullptr || c != oldMaterial->color() || state.isOpacityDirty()) { float opacity = state.opacity() * c.alphaF(); QVector4D v(c.redF() * opacity, c.greenF() * opacity, @@ -103,7 +103,7 @@ void FlatColorMaterialShader::updateState(const RenderState &state, QSGMaterial char const *const *FlatColorMaterialShader::attributeNames() const { - static char const *const attr[] = { "vCoord", 0 }; + static char const *const attr[] = { "vCoord", nullptr }; return attr; } diff --git a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp index e134a5d4d3..93fc213f2e 100644 --- a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp +++ b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp @@ -262,8 +262,8 @@ void QSGShaderSourceBuilder::addDefinition(const QByteArray &definition) tok.initialize(input); // First find #version, #extension's and "void main() { ... " - const char *versionPos = 0; - const char *extensionPos = 0; + const char *versionPos = nullptr; + const char *extensionPos = nullptr; bool inSingleLineComment = false; bool inMultiLineComment = false; bool foundVersionStart = false; @@ -325,8 +325,8 @@ void QSGShaderSourceBuilder::removeVersion() tok.initialize(input); // First find #version beginning and end (if present) - const char *versionStartPos = 0; - const char *versionEndPos = 0; + const char *versionStartPos = nullptr; + const char *versionEndPos = nullptr; bool inSingleLineComment = false; bool inMultiLineComment = false; bool foundVersionStart = false; @@ -361,7 +361,7 @@ void QSGShaderSourceBuilder::removeVersion() t = tok.next(); } - if (versionStartPos == 0) + if (versionStartPos == nullptr) return; // Construct a new shader string, inserting the definition diff --git a/src/quick/scenegraph/util/qsgsimplematerial.h b/src/quick/scenegraph/util/qsgsimplematerial.h index 8a81917bd2..dcf9b89b21 100644 --- a/src/quick/scenegraph/util/qsgsimplematerial.h +++ b/src/quick/scenegraph/util/qsgsimplematerial.h @@ -207,7 +207,7 @@ Q_INLINE_TEMPLATE void QSGSimpleMaterialShader<State>::updateState(const RenderS Q_UNUSED(state) #endif State *ns = static_cast<QSGSimpleMaterial<State> *>(newMaterial)->state(); - State *old = 0; + State *old = nullptr; if (oldMaterial) old = static_cast<QSGSimpleMaterial<State> *>(oldMaterial)->state(); updateState(ns, old); diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp index 6ce37de7cb..0c49ca9aa5 100644 --- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp +++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp @@ -47,8 +47,7 @@ class QSGSimpleTextureNodePrivate : public QSGGeometryNodePrivate { public: QSGSimpleTextureNodePrivate() - : QSGGeometryNodePrivate() - , texCoordMode(QSGSimpleTextureNode::NoTransform) + : texCoordMode(QSGSimpleTextureNode::NoTransform) , isAtlasTexture(false) , ownsTexture(false) {} diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp index d2599ebd72..fea92a5121 100644 --- a/src/quick/scenegraph/util/qsgtexture.cpp +++ b/src/quick/scenegraph/util/qsgtexture.cpp @@ -399,7 +399,7 @@ QSGTexture::~QSGTexture() QSGTexture *QSGTexture::removedFromAtlas() const { Q_ASSERT_X(!isAtlasTexture(), "QSGTexture::removedFromAtlas()", "Called on a non-atlas texture"); - return 0; + return nullptr; } /*! diff --git a/src/quick/scenegraph/util/qsgtexturematerial.cpp b/src/quick/scenegraph/util/qsgtexturematerial.cpp index 0f9ee9cfde..7b1d5abb26 100644 --- a/src/quick/scenegraph/util/qsgtexturematerial.cpp +++ b/src/quick/scenegraph/util/qsgtexturematerial.cpp @@ -57,7 +57,6 @@ inline static bool isPowerOfTwo(int x) QSGMaterialType QSGOpaqueTextureMaterialShader::type; QSGOpaqueTextureMaterialShader::QSGOpaqueTextureMaterialShader() - : QSGMaterialShader() { #if QT_CONFIG(opengl) setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/opaquetexture.vert")); @@ -67,7 +66,7 @@ QSGOpaqueTextureMaterialShader::QSGOpaqueTextureMaterialShader() char const *const *QSGOpaqueTextureMaterialShader::attributeNames() const { - static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", 0 }; + static char const *const attr[] = { "qt_VertexPosition", "qt_VertexTexCoord", nullptr }; return attr; } @@ -80,7 +79,7 @@ void QSGOpaqueTextureMaterialShader::initialize() void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { - Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); + Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type()); QSGOpaqueTextureMaterial *tx = static_cast<QSGOpaqueTextureMaterial *>(newEffect); QSGOpaqueTextureMaterial *oldTx = static_cast<QSGOpaqueTextureMaterial *>(oldEffect); @@ -112,7 +111,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa t->setMipmapFiltering(tx->mipmapFiltering()); t->setAnisotropyLevel(tx->anisotropyLevel()); - if (oldTx == 0 || oldTx->texture()->textureId() != t->textureId()) + if (oldTx == nullptr || oldTx->texture()->textureId() != t->textureId()) t->bind(); else t->updateBindOptions(); @@ -169,7 +168,7 @@ void QSGOpaqueTextureMaterialShader::updateState(const RenderState &state, QSGMa */ QSGOpaqueTextureMaterial::QSGOpaqueTextureMaterial() - : m_texture(0) + : m_texture(nullptr) , m_filtering(QSGTexture::Nearest) , m_mipmap_filtering(QSGTexture::None) , m_horizontal_wrap(QSGTexture::ClampToEdge) @@ -398,7 +397,7 @@ QSGTextureMaterialShader::QSGTextureMaterialShader() void QSGTextureMaterialShader::updateState(const RenderState &state, QSGMaterial *newEffect, QSGMaterial *oldEffect) { - Q_ASSERT(oldEffect == 0 || newEffect->type() == oldEffect->type()); + Q_ASSERT(oldEffect == nullptr || newEffect->type() == oldEffect->type()); #if QT_CONFIG(opengl) if (state.isOpacityDirty()) program()->setUniformValue(m_opacity_id, state.opacity()); diff --git a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp index 42c589b14a..cb61430e2e 100644 --- a/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp +++ b/src/quick/scenegraph/util/qsgvertexcolormaterial.cpp @@ -64,7 +64,6 @@ private: QSGMaterialType QSGVertexColorMaterialShader::type; QSGVertexColorMaterialShader::QSGVertexColorMaterialShader() - : QSGMaterialShader() { #if QT_CONFIG(opengl) setShaderSourceFile(QOpenGLShader::Vertex, QStringLiteral(":/qt-project.org/scenegraph/shaders/vertexcolor.vert")); @@ -87,7 +86,7 @@ void QSGVertexColorMaterialShader::updateState(const RenderState &state, QSGMate char const *const *QSGVertexColorMaterialShader::attributeNames() const { - static const char *const attr[] = { "vertexCoord", "vertexColor", 0 }; + static const char *const attr[] = { "vertexCoord", "vertexColor", nullptr }; return attr; } diff --git a/src/quick/util/qquickanimation.cpp b/src/quick/util/qquickanimation.cpp index 76b9b8f343..c936ba4e93 100644 --- a/src/quick/util/qquickanimation.cpp +++ b/src/quick/util/qquickanimation.cpp @@ -91,7 +91,7 @@ QQuickAbstractAnimation::~QQuickAbstractAnimation() { Q_D(QQuickAbstractAnimation); if (d->group) - setGroup(0); //remove from group + setGroup(nullptr); //remove from group delete d->animationInstance; } @@ -643,7 +643,7 @@ QAbstractAnimationJob* QQuickAbstractAnimation::transition(QQuickStateActions &a Q_UNUSED(modified); Q_UNUSED(direction); Q_UNUSED(defaultTarget); - return 0; + return nullptr; } void QQuickAbstractAnimationPrivate::animationFinished(QAbstractAnimationJob*) @@ -838,7 +838,7 @@ void QQuickColorAnimation::setTo(const QColor &t) } QActionAnimation::QActionAnimation() - : QAbstractAnimationJob(), animAction(0) + : QAbstractAnimationJob(), animAction(nullptr) { } @@ -1706,7 +1706,7 @@ void QQuickAnimationGroupPrivate::clear_animation(QQmlListProperty<QQuickAbstrac if (q) { while (q->d_func()->animations.count()) { QQuickAbstractAnimation *firstAnim = q->d_func()->animations.at(0); - firstAnim->setGroup(0); + firstAnim->setGroup(nullptr); } } } @@ -1715,7 +1715,7 @@ QQuickAnimationGroup::~QQuickAnimationGroup() { Q_D(QQuickAnimationGroup); for (int i = 0; i < d->animations.count(); ++i) - d->animations.at(i)->d_func()->group = 0; + d->animations.at(i)->d_func()->group = nullptr; d->animations.clear(); } @@ -1937,7 +1937,7 @@ void QQuickPropertyAnimationPrivate::convertVariant(QVariant &variant, int type) } QQuickBulkValueAnimator::QQuickBulkValueAnimator() - : QAbstractAnimationJob(), animValue(0), fromSourced(0), m_duration(250) + : QAbstractAnimationJob(), animValue(nullptr), fromSourced(nullptr), m_duration(250) { } @@ -2556,7 +2556,7 @@ void QQuickAnimationPropertyUpdater::setValue(qreal v) if (deleted) return; } - wasDeleted = 0; + wasDeleted = nullptr; fromSourced = true; } diff --git a/src/quick/util/qquickanimation_p.h b/src/quick/util/qquickanimation_p.h index 5edbcc089a..d1f460fef7 100644 --- a/src/quick/util/qquickanimation_p.h +++ b/src/quick/util/qquickanimation_p.h @@ -87,7 +87,7 @@ public: AnyThread }; - QQuickAbstractAnimation(QObject *parent=0); + QQuickAbstractAnimation(QObject *parent=nullptr); virtual ~QQuickAbstractAnimation(); enum Loops { Infinite = -2 }; @@ -144,7 +144,7 @@ public: virtual QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0); + QObject *defaultTarget = nullptr); QAbstractAnimationJob* qtAnimation(); private Q_SLOTS: @@ -166,7 +166,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPauseAnimation : public QQuickAbstractAnimati Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) public: - QQuickPauseAnimation(QObject *parent=0); + QQuickPauseAnimation(QObject *parent=nullptr); virtual ~QQuickPauseAnimation(); int duration() const; @@ -179,7 +179,7 @@ protected: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; }; class QQuickScriptActionPrivate; @@ -192,7 +192,7 @@ class QQuickScriptAction : public QQuickAbstractAnimation Q_PROPERTY(QString scriptName READ stateChangeScriptName WRITE setStateChangeScriptName) public: - QQuickScriptAction(QObject *parent=0); + QQuickScriptAction(QObject *parent=nullptr); virtual ~QQuickScriptAction(); QQmlScriptString script() const; @@ -205,7 +205,7 @@ protected: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; }; class QQuickPropertyActionPrivate; @@ -222,7 +222,7 @@ class QQuickPropertyAction : public QQuickAbstractAnimation Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged) public: - QQuickPropertyAction(QObject *parent=0); + QQuickPropertyAction(QObject *parent=nullptr); virtual ~QQuickPropertyAction(); QObject *target() const; @@ -250,7 +250,7 @@ protected: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; }; class QQuickPropertyAnimationPrivate; @@ -270,7 +270,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPropertyAnimation : public QQuickAbstractAnim Q_PROPERTY(QQmlListProperty<QObject> exclude READ exclude) public: - QQuickPropertyAnimation(QObject *parent=0); + QQuickPropertyAnimation(QObject *parent=nullptr); virtual ~QQuickPropertyAnimation(); virtual int duration() const; @@ -300,13 +300,13 @@ public: protected: QQuickStateActions createTransitionActions(QQuickStateActions &actions, QQmlProperties &modified, - QObject *defaultTarget = 0); + QObject *defaultTarget = nullptr); QQuickPropertyAnimation(QQuickPropertyAnimationPrivate &dd, QObject *parent); QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; Q_SIGNALS: void durationChanged(int); void fromChanged(); @@ -325,7 +325,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickColorAnimation : public QQuickPropertyAnimati Q_PROPERTY(QColor to READ to WRITE setTo) public: - QQuickColorAnimation(QObject *parent=0); + QQuickColorAnimation(QObject *parent=nullptr); virtual ~QQuickColorAnimation(); QColor from() const; @@ -344,7 +344,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickNumberAnimation : public QQuickPropertyAnimat Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) public: - QQuickNumberAnimation(QObject *parent=0); + QQuickNumberAnimation(QObject *parent=nullptr); virtual ~QQuickNumberAnimation(); qreal from() const; @@ -369,7 +369,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickVector3dAnimation : public QQuickPropertyAnim Q_PROPERTY(QVector3D to READ to WRITE setTo NOTIFY toChanged) public: - QQuickVector3dAnimation(QObject *parent=0); + QQuickVector3dAnimation(QObject *parent=nullptr); virtual ~QQuickVector3dAnimation(); QVector3D from() const; @@ -390,7 +390,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickRotationAnimation : public QQuickPropertyAnim Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged) public: - QQuickRotationAnimation(QObject *parent=0); + QQuickRotationAnimation(QObject *parent=nullptr); virtual ~QQuickRotationAnimation(); qreal from() const; @@ -434,7 +434,7 @@ class QQuickSequentialAnimation : public QQuickAnimationGroup Q_DECLARE_PRIVATE(QQuickAnimationGroup) public: - QQuickSequentialAnimation(QObject *parent=0); + QQuickSequentialAnimation(QObject *parent=nullptr); virtual ~QQuickSequentialAnimation(); protected: @@ -442,7 +442,7 @@ protected: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; }; class Q_QUICK_PRIVATE_EXPORT QQuickParallelAnimation : public QQuickAnimationGroup @@ -451,7 +451,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickParallelAnimation : public QQuickAnimationGro Q_DECLARE_PRIVATE(QQuickAnimationGroup) public: - QQuickParallelAnimation(QObject *parent=0); + QQuickParallelAnimation(QObject *parent=nullptr); virtual ~QQuickParallelAnimation(); protected: @@ -459,7 +459,7 @@ protected: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; }; diff --git a/src/quick/util/qquickanimation_p_p.h b/src/quick/util/qquickanimation_p_p.h index 7a1bd8ff13..304258cde1 100644 --- a/src/quick/util/qquickanimation_p_p.h +++ b/src/quick/util/qquickanimation_p_p.h @@ -178,7 +178,7 @@ public: : running(false), paused(false), alwaysRunToEnd(false), /*connectedTimeLine(false), */componentComplete(true), avoidPropertyValueSourceStart(false), disableUserControl(false), - registered(false), loopCount(1), group(0), animationInstance(0) {} + registered(false), loopCount(1), group(nullptr), animationInstance(nullptr) {} bool running:1; bool paused:1; @@ -237,7 +237,7 @@ class QQuickPropertyActionPrivate : public QQuickAbstractAnimationPrivate Q_DECLARE_PUBLIC(QQuickPropertyAction) public: QQuickPropertyActionPrivate() - : QQuickAbstractAnimationPrivate(), target(0) {} + : QQuickAbstractAnimationPrivate(), target(nullptr) {} QObject *target; QString propertyName; @@ -265,8 +265,8 @@ class QQuickPropertyAnimationPrivate : public QQuickAbstractAnimationPrivate Q_DECLARE_PUBLIC(QQuickPropertyAnimation) public: QQuickPropertyAnimationPrivate() - : QQuickAbstractAnimationPrivate(), target(0), fromSourced(false), fromIsDefined(false), toIsDefined(false), - defaultToInterpolatorType(0), interpolatorType(0), interpolator(0), duration(250), actions(0) {} + : QQuickAbstractAnimationPrivate(), target(nullptr), fromSourced(false), fromIsDefined(false), toIsDefined(false), + defaultToInterpolatorType(0), interpolatorType(0), interpolator(nullptr), duration(250), actions(nullptr) {} QVariant from; QVariant to; @@ -306,7 +306,7 @@ public: class Q_AUTOTEST_EXPORT QQuickAnimationPropertyUpdater : public QQuickBulkValueUpdater { public: - QQuickAnimationPropertyUpdater() : interpolatorType(0), interpolator(0), prevInterpolatorType(0), reverse(false), fromSourced(false), fromDefined(false), wasDeleted(0) {} + QQuickAnimationPropertyUpdater() : interpolatorType(0), interpolator(nullptr), prevInterpolatorType(0), reverse(false), fromSourced(false), fromDefined(false), wasDeleted(nullptr) {} ~QQuickAnimationPropertyUpdater(); void setValue(qreal v) override; diff --git a/src/quick/util/qquickanimationcontroller.cpp b/src/quick/util/qquickanimationcontroller.cpp index 5e56460098..63373541a6 100644 --- a/src/quick/util/qquickanimationcontroller.cpp +++ b/src/quick/util/qquickanimationcontroller.cpp @@ -49,7 +49,7 @@ class QQuickAnimationControllerPrivate : public QObjectPrivate, QAnimationJobCha Q_DECLARE_PUBLIC(QQuickAnimationController) public: QQuickAnimationControllerPrivate() - : progress(0.0), animation(0), animationInstance(0), finalized(false) {} + : progress(0.0), animation(nullptr), animationInstance(nullptr), finalized(false) {} void animationFinished(QAbstractAnimationJob *job) override; void animationCurrentTimeChanged(QAbstractAnimationJob *job, int currentTime) override; @@ -197,7 +197,7 @@ void QQuickAnimationController::reload() return; if (!d->animation) { - d->animationInstance = 0; + d->animationInstance = nullptr; } else { QQuickStateActions actions; QQmlProperties properties; diff --git a/src/quick/util/qquickanimationcontroller_p.h b/src/quick/util/qquickanimationcontroller_p.h index 43555ac1c1..d9ce377060 100644 --- a/src/quick/util/qquickanimationcontroller_p.h +++ b/src/quick/util/qquickanimationcontroller_p.h @@ -69,7 +69,7 @@ class Q_AUTOTEST_EXPORT QQuickAnimationController : public QObject, public QQmlP Q_PROPERTY(QQuickAbstractAnimation *animation READ animation WRITE setAnimation NOTIFY animationChanged) public: - QQuickAnimationController(QObject *parent=0); + QQuickAnimationController(QObject *parent=nullptr); ~QQuickAnimationController(); qreal progress() const; diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp index 5608326f8a..d1ff78f8bc 100644 --- a/src/quick/util/qquickanimator.cpp +++ b/src/quick/util/qquickanimator.cpp @@ -280,22 +280,22 @@ QAbstractAnimationJob *QQuickAnimator::transition(QQuickStateActions &actions, if (d->defaultProperty.isValid() && propertyName() != d->defaultProperty.name()) { qDebug() << Q_FUNC_INFO << "property name conflict..."; - return 0; + return nullptr; } // The animation system cannot handle backwards uncontrolled animations. if (direction == Backward) - return 0; + return nullptr; QQuickAnimatorJob *job = createJob(); if (!job) - return 0; + return nullptr; d->apply(job, propertyName(), actions, modified, defaultTarget); if (!job->target()) { delete job; - return 0; + return nullptr; } return job; @@ -576,7 +576,7 @@ QQuickAnimatorJob *QQuickUniformAnimator::createJob() const { QString u = propertyName(); if (u.isEmpty()) - return 0; + return nullptr; QQuickUniformAnimatorJob *job = new QQuickUniformAnimatorJob(); job->setUniform(u.toLatin1()); diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h index 92c66299dc..511cecda7f 100644 --- a/src/quick/util/qquickanimator_p.h +++ b/src/quick/util/qquickanimator_p.h @@ -94,8 +94,8 @@ protected: TransitionDirection, QObject *) override; - QQuickAnimator(QQuickAnimatorPrivate &dd, QObject *parent = 0); - QQuickAnimator(QObject *parent = 0); + QQuickAnimator(QQuickAnimatorPrivate &dd, QObject *parent = nullptr); + QQuickAnimator(QObject *parent = nullptr); Q_SIGNALS: void targetItemChanged(QQuickItem *); @@ -110,7 +110,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickScaleAnimator : public QQuickAnimator { Q_OBJECT public: - QQuickScaleAnimator(QObject *parent = 0); + QQuickScaleAnimator(QObject *parent = nullptr); protected: QQuickAnimatorJob *createJob() const override; QString propertyName() const override { return QStringLiteral("scale"); } @@ -120,7 +120,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickXAnimator : public QQuickAnimator { Q_OBJECT public: - QQuickXAnimator(QObject *parent = 0); + QQuickXAnimator(QObject *parent = nullptr); protected: QQuickAnimatorJob *createJob() const override; QString propertyName() const override { return QStringLiteral("x"); } @@ -130,7 +130,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickYAnimator : public QQuickAnimator { Q_OBJECT public: - QQuickYAnimator(QObject *parent = 0); + QQuickYAnimator(QObject *parent = nullptr); protected: QQuickAnimatorJob *createJob() const override; QString propertyName() const override { return QStringLiteral("y"); } @@ -140,7 +140,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickOpacityAnimator : public QQuickAnimator { Q_OBJECT public: - QQuickOpacityAnimator(QObject *parent = 0); + QQuickOpacityAnimator(QObject *parent = nullptr); protected: QQuickAnimatorJob *createJob() const override; QString propertyName() const override { return QStringLiteral("opacity"); } @@ -157,7 +157,7 @@ public: enum RotationDirection { Numerical, Shortest, Clockwise, Counterclockwise }; Q_ENUM(RotationDirection) - QQuickRotationAnimator(QObject *parent = 0); + QQuickRotationAnimator(QObject *parent = nullptr); void setDirection(RotationDirection dir); RotationDirection direction() const; @@ -179,7 +179,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimator : public QQuickAnimator Q_PROPERTY(QString uniform READ uniform WRITE setUniform NOTIFY uniformChanged) public: - QQuickUniformAnimator(QObject *parent = 0); + QQuickUniformAnimator(QObject *parent = nullptr); QString uniform() const; void setUniform(const QString &); diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index 43c8eb302a..6574f8f67e 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -250,8 +250,8 @@ void QQuickAnimatorProxyJob::syncBackCurrentValues() } QQuickAnimatorJob::QQuickAnimatorJob() - : m_target(0) - , m_controller(0) + : m_target(nullptr) + , m_controller(nullptr) , m_from(0) , m_to(0) , m_value(0) diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h index 777da2ee6c..74085526c0 100644 --- a/src/quick/util/qquickanimatorjob_p.h +++ b/src/quick/util/qquickanimatorjob_p.h @@ -194,7 +194,7 @@ public: { Helper() : ref(1) - , node(0) + , node(nullptr) , ox(0) , oy(0) , dx(0) diff --git a/src/quick/util/qquickapplication_p.h b/src/quick/util/qquickapplication_p.h index 8ee203f0da..66a33489e4 100644 --- a/src/quick/util/qquickapplication_p.h +++ b/src/quick/util/qquickapplication_p.h @@ -72,7 +72,7 @@ class Q_AUTOTEST_EXPORT QQuickApplication : public QQmlApplication Q_PROPERTY(QQmlListProperty<QQuickScreenInfo> screens READ screens NOTIFY screensChanged) public: - explicit QQuickApplication(QObject *parent = 0); + explicit QQuickApplication(QObject *parent = nullptr); virtual ~QQuickApplication(); bool active() const; Qt::LayoutDirection layoutDirection() const; diff --git a/src/quick/util/qquickbehavior.cpp b/src/quick/util/qquickbehavior.cpp index a562ebd937..8a4ff6a779 100644 --- a/src/quick/util/qquickbehavior.cpp +++ b/src/quick/util/qquickbehavior.cpp @@ -57,7 +57,7 @@ class QQuickBehaviorPrivate : public QObjectPrivate, public QAnimationJobChangeL { Q_DECLARE_PUBLIC(QQuickBehavior) public: - QQuickBehaviorPrivate() : animation(0), animationInstance(0), enabled(true), finalized(false) + QQuickBehaviorPrivate() : animation(nullptr), animationInstance(nullptr), enabled(true), finalized(false) , blockRunningChanged(false) {} void animationStateChanged(QAbstractAnimationJob *, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) override; diff --git a/src/quick/util/qquickbehavior_p.h b/src/quick/util/qquickbehavior_p.h index b3fd2af400..f939597d15 100644 --- a/src/quick/util/qquickbehavior_p.h +++ b/src/quick/util/qquickbehavior_p.h @@ -72,7 +72,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickBehavior : public QObject, public QQmlPropert Q_CLASSINFO("DeferredPropertyNames", "animation") public: - QQuickBehavior(QObject *parent=0); + QQuickBehavior(QObject *parent=nullptr); ~QQuickBehavior(); void setTarget(const QQmlProperty &) override; diff --git a/src/quick/util/qquickfontloader.cpp b/src/quick/util/qquickfontloader.cpp index 68e27c25fd..2da541304d 100644 --- a/src/quick/util/qquickfontloader.cpp +++ b/src/quick/util/qquickfontloader.cpp @@ -77,8 +77,8 @@ Q_SIGNALS: void fontDownloaded(const QString&, QQuickFontLoader::Status); private: - int redirectCount; - QNetworkReply *reply; + int redirectCount = 0; + QNetworkReply *reply = nullptr; private Q_SLOTS: void replyFinished(); @@ -91,13 +91,8 @@ public: }; QQuickFontObject::QQuickFontObject(int _id) - : QObject(0) -#if QT_CONFIG(qml_network) - ,redirectCount(0), reply(0) -#endif - ,id(_id) + : QObject(nullptr), id(_id) { - } #if QT_CONFIG(qml_network) @@ -119,7 +114,7 @@ void QQuickFontObject::replyFinished() QUrl url = reply->url().resolved(redirect.toUrl()); QNetworkAccessManager *manager = reply->manager(); reply->deleteLater(); - reply = 0; + reply = nullptr; download(url, manager); return; } @@ -138,7 +133,7 @@ void QQuickFontObject::replyFinished() emit fontDownloaded(QString(), QQuickFontLoader::Error); } reply->deleteLater(); - reply = 0; + reply = nullptr; } } #endif // qml_network @@ -148,11 +143,11 @@ class QQuickFontLoaderPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickFontLoader) public: - QQuickFontLoaderPrivate() : status(QQuickFontLoader::Null) {} + QQuickFontLoaderPrivate() {} QUrl url; QString name; - QQuickFontLoader::Status status; + QQuickFontLoader::Status status = QQuickFontLoader::Null; }; static void q_QFontLoaderFontsStaticReset(); diff --git a/src/quick/util/qquickfontloader_p.h b/src/quick/util/qquickfontloader_p.h index 29feecde4f..8d277f7cf7 100644 --- a/src/quick/util/qquickfontloader_p.h +++ b/src/quick/util/qquickfontloader_p.h @@ -72,7 +72,7 @@ public: enum Status { Null = 0, Ready, Loading, Error }; Q_ENUM(Status) - QQuickFontLoader(QObject *parent = 0); + QQuickFontLoader(QObject *parent = nullptr); ~QQuickFontLoader(); QUrl source() const; diff --git a/src/quick/util/qquickfontmetrics_p.h b/src/quick/util/qquickfontmetrics_p.h index ebabe51712..db2b7b6796 100644 --- a/src/quick/util/qquickfontmetrics_p.h +++ b/src/quick/util/qquickfontmetrics_p.h @@ -80,7 +80,7 @@ class Q_AUTOTEST_EXPORT QQuickFontMetrics : public QObject Q_PROPERTY(qreal strikeOutPosition READ strikeOutPosition NOTIFY fontChanged) Q_PROPERTY(qreal lineWidth READ lineWidth NOTIFY fontChanged) public: - explicit QQuickFontMetrics(QObject *parent = 0); + explicit QQuickFontMetrics(QObject *parent = nullptr); ~QQuickFontMetrics(); QFont font() const; diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 5f8d2b94d3..7fa20636ec 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -419,7 +419,7 @@ public: break; } - return 0; + return nullptr; } bool init(int type, QVariant& dst) override @@ -863,8 +863,8 @@ void QQuick_initializeProviders() void QQuick_deinitializeProviders() { QQml_removeValueTypeProvider(getValueTypeProvider()); - QQml_setColorProvider(0); // technically, another plugin may have overridden our providers - QQml_setGuiProvider(0); // but we cannot handle that case in a sane way. + QQml_setColorProvider(nullptr); // technically, another plugin may have overridden our providers + QQml_setGuiProvider(nullptr); // but we cannot handle that case in a sane way. } QT_END_NAMESPACE diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp index 4003b88d09..1a13f6395a 100644 --- a/src/quick/util/qquickimageprovider.cpp +++ b/src/quick/util/qquickimageprovider.cpp @@ -108,7 +108,7 @@ QImage QQuickTextureFactory::image() const QQuickTextureFactory *QQuickTextureFactory::textureFactoryForImage(const QImage &image) { if (image.isNull()) - return 0; + return nullptr; QQuickTextureFactory *texture = QSGContext::createTextureFactoryFromImage(image); if (texture) return texture; @@ -469,7 +469,7 @@ QQuickTextureFactory *QQuickImageProvider::requestTexture(const QString &id, QSi Q_UNUSED(requestedSize); if (d->type == Texture) qWarning("ImageProvider supports Texture type but has not implemented requestTexture()"); - return 0; + return nullptr; } /*! @@ -484,7 +484,7 @@ QQuickTextureFactory *QQuickImageProvider::requestTexture(const QString &id, QSi */ QQuickAsyncImageProvider::QQuickAsyncImageProvider() : QQuickImageProvider(ImageResponse, ForceAsynchronousImageLoading) - , d(0) // just as a placeholder in case we need it for the future + , d(nullptr) // just as a placeholder in case we need it for the future { Q_UNUSED(d); } @@ -515,15 +515,12 @@ class QQuickImageProviderOptionsPrivate : public QSharedData { public: QQuickImageProviderOptionsPrivate() - : autoTransform(QQuickImageProviderOptions::UsePluginDefaultTransform) - , preserveAspectRatioCrop(false) - , preserveAspectRatioFit(false) { } - QQuickImageProviderOptions::AutoTransform autoTransform; - bool preserveAspectRatioCrop; - bool preserveAspectRatioFit; + QQuickImageProviderOptions::AutoTransform autoTransform = QQuickImageProviderOptions::UsePluginDefaultTransform; + bool preserveAspectRatioCrop = false; + bool preserveAspectRatioFit = false; }; /*! diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp index 1ae9b78669..56eafcd12a 100644 --- a/src/quick/util/qquickpath.cpp +++ b/src/quick/util/qquickpath.cpp @@ -256,7 +256,7 @@ bool QQuickPath::isClosed() const QQmlListProperty<QQuickPathElement> QQuickPath::pathElements() { return QQmlListProperty<QQuickPathElement>(this, - 0, + nullptr, pathElements_append, pathElements_count, pathElements_at, diff --git a/src/quick/util/qquickpath_p.h b/src/quick/util/qquickpath_p.h index a49403fd0e..f8b67ef945 100644 --- a/src/quick/util/qquickpath_p.h +++ b/src/quick/util/qquickpath_p.h @@ -78,7 +78,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathElement : public QObject { Q_OBJECT public: - QQuickPathElement(QObject *parent=0) : QObject(parent) {} + QQuickPathElement(QObject *parent=nullptr) : QObject(parent) {} Q_SIGNALS: void changed(); }; @@ -90,7 +90,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathAttribute : public QQuickPathElement Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) public: - QQuickPathAttribute(QObject *parent=0) : QQuickPathElement(parent), _value(0) {} + QQuickPathAttribute(QObject *parent=nullptr) : QQuickPathElement(parent) {} QString name() const; @@ -105,7 +105,7 @@ Q_SIGNALS: private: QString _name; - qreal _value; + qreal _value = 0; }; class Q_QUICK_PRIVATE_EXPORT QQuickCurve : public QQuickPathElement @@ -117,7 +117,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickCurve : public QQuickPathElement Q_PROPERTY(qreal relativeX READ relativeX WRITE setRelativeX NOTIFY relativeXChanged) Q_PROPERTY(qreal relativeY READ relativeY WRITE setRelativeY NOTIFY relativeYChanged) public: - QQuickCurve(QObject *parent=0) : QQuickPathElement(parent) {} + QQuickCurve(QObject *parent=nullptr) : QQuickPathElement(parent) {} qreal x() const; void setX(qreal x); @@ -154,7 +154,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathLine : public QQuickCurve { Q_OBJECT public: - QQuickPathLine(QObject *parent=0) : QQuickCurve(parent) {} + QQuickPathLine(QObject *parent=nullptr) : QQuickCurve(parent) {} void addToPath(QPainterPath &path, const QQuickPathData &) override; }; @@ -163,7 +163,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathMove : public QQuickCurve { Q_OBJECT public: - QQuickPathMove(QObject *parent=0) : QQuickCurve(parent) {} + QQuickPathMove(QObject *parent=nullptr) : QQuickCurve(parent) {} void addToPath(QPainterPath &path, const QQuickPathData &) override; }; @@ -177,7 +177,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathQuad : public QQuickCurve Q_PROPERTY(qreal relativeControlX READ relativeControlX WRITE setRelativeControlX NOTIFY relativeControlXChanged) Q_PROPERTY(qreal relativeControlY READ relativeControlY WRITE setRelativeControlY NOTIFY relativeControlYChanged) public: - QQuickPathQuad(QObject *parent=0) : QQuickCurve(parent), _controlX(0), _controlY(0) {} + QQuickPathQuad(QObject *parent=nullptr) : QQuickCurve(parent) {} qreal controlX() const; void setControlX(qreal x); @@ -202,8 +202,8 @@ Q_SIGNALS: void relativeControlYChanged(); private: - qreal _controlX; - qreal _controlY; + qreal _controlX = 0; + qreal _controlY = 0; QQmlNullableValue<qreal> _relativeControlX; QQmlNullableValue<qreal> _relativeControlY; }; @@ -221,7 +221,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathCubic : public QQuickCurve Q_PROPERTY(qreal relativeControl2X READ relativeControl2X WRITE setRelativeControl2X NOTIFY relativeControl2XChanged) Q_PROPERTY(qreal relativeControl2Y READ relativeControl2Y WRITE setRelativeControl2Y NOTIFY relativeControl2YChanged) public: - QQuickPathCubic(QObject *parent=0) : QQuickCurve(parent), _control1X(0), _control1Y(0), _control2X(0), _control2Y(0) {} + QQuickPathCubic(QObject *parent=nullptr) : QQuickCurve(parent) {} qreal control1X() const; void setControl1X(qreal x); @@ -264,10 +264,10 @@ Q_SIGNALS: void relativeControl2YChanged(); private: - qreal _control1X; - qreal _control1Y; - qreal _control2X; - qreal _control2Y; + qreal _control1X = 0; + qreal _control1Y = 0; + qreal _control2X = 0; + qreal _control2Y = 0; QQmlNullableValue<qreal> _relativeControl1X; QQmlNullableValue<qreal> _relativeControl1Y; QQmlNullableValue<qreal> _relativeControl2X; @@ -278,7 +278,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathCatmullRomCurve : public QQuickCurve { Q_OBJECT public: - QQuickPathCatmullRomCurve(QObject *parent=0) : QQuickCurve(parent) {} + QQuickPathCatmullRomCurve(QObject *parent=nullptr) : QQuickCurve(parent) {} void addToPath(QPainterPath &path, const QQuickPathData &) override; }; @@ -293,8 +293,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathArc : public QQuickCurve Q_PROPERTY(qreal xAxisRotation READ xAxisRotation WRITE setXAxisRotation NOTIFY xAxisRotationChanged REVISION 2) public: - QQuickPathArc(QObject *parent=0) - : QQuickCurve(parent), _radiusX(0), _radiusY(0), _useLargeArc(false), _direction(Clockwise), _xAxisRotation(0) {} + QQuickPathArc(QObject *parent=nullptr) + : QQuickCurve(parent) {} enum ArcDirection { Clockwise, Counterclockwise }; Q_ENUM(ArcDirection) @@ -324,11 +324,11 @@ Q_SIGNALS: Q_REVISION(2) void xAxisRotationChanged(); private: - qreal _radiusX; - qreal _radiusY; - bool _useLargeArc; - ArcDirection _direction; - qreal _xAxisRotation; + qreal _radiusX = 0; + qreal _radiusY = 0; + bool _useLargeArc = false; + ArcDirection _direction = Clockwise; + qreal _xAxisRotation = 0; }; class Q_QUICK_PRIVATE_EXPORT QQuickPathAngleArc : public QQuickCurve @@ -343,8 +343,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathAngleArc : public QQuickCurve Q_PROPERTY(bool moveToStart READ moveToStart WRITE setMoveToStart NOTIFY moveToStartChanged) public: - QQuickPathAngleArc(QObject *parent=0) - : QQuickCurve(parent), _centerX(0), _centerY(0), _radiusX(0), _radiusY(0), _startAngle(0), _sweepAngle(0), _moveToStart(true) {} + QQuickPathAngleArc(QObject *parent=nullptr) + : QQuickCurve(parent) {} qreal centerX() const; void setCenterX(qreal); @@ -379,13 +379,13 @@ Q_SIGNALS: void moveToStartChanged(); private: - qreal _centerX; - qreal _centerY; - qreal _radiusX; - qreal _radiusY; - qreal _startAngle; - qreal _sweepAngle; - bool _moveToStart; + qreal _centerX = 0; + qreal _centerY = 0; + qreal _radiusX = 0; + qreal _radiusY = 0; + qreal _startAngle = 0; + qreal _sweepAngle = 0; + bool _moveToStart = true; }; class Q_QUICK_PRIVATE_EXPORT QQuickPathSvg : public QQuickCurve @@ -393,7 +393,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathSvg : public QQuickCurve Q_OBJECT Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) public: - QQuickPathSvg(QObject *parent=0) : QQuickCurve(parent) {} + QQuickPathSvg(QObject *parent=nullptr) : QQuickCurve(parent) {} QString path() const; void setPath(const QString &path); @@ -412,7 +412,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPathPercent : public QQuickPathElement Q_OBJECT Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged) public: - QQuickPathPercent(QObject *parent=0) : QQuickPathElement(parent), _value(0) {} + QQuickPathPercent(QObject *parent=nullptr) : QQuickPathElement(parent) {} qreal value() const; void setValue(qreal value); @@ -421,18 +421,18 @@ Q_SIGNALS: void valueChanged(); private: - qreal _value; + qreal _value = 0; }; struct QQuickCachedBezier { - QQuickCachedBezier() : isValid(false) {} + QQuickCachedBezier() {} QBezier bezier; int element; qreal bezLength; qreal currLength; qreal p; - bool isValid; + bool isValid = false; }; class QQuickPathPrivate; @@ -448,7 +448,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPath : public QObject, public QQmlParserStatu Q_CLASSINFO("DefaultProperty", "pathElements") Q_INTERFACES(QQmlParserStatus) public: - QQuickPath(QObject *parent=0); + QQuickPath(QObject *parent=nullptr); ~QQuickPath(); QQmlListProperty<QQuickPathElement> pathElements(); @@ -467,7 +467,7 @@ public: QStringList attributes() const; qreal attributeAt(const QString &, qreal) const; QPointF pointAt(qreal) const; - QPointF sequentialPointAt(qreal p, qreal *angle = 0) const; + QPointF sequentialPointAt(qreal p, qreal *angle = nullptr) const; void invalidateSequentialHistory() const; Q_SIGNALS: @@ -494,15 +494,15 @@ private Q_SLOTS: private: struct AttributePoint { - AttributePoint() : percent(0), scale(1), origpercent(0) {} + AttributePoint() {} AttributePoint(const AttributePoint &other) : percent(other.percent), scale(other.scale), origpercent(other.origpercent), values(other.values) {} AttributePoint &operator=(const AttributePoint &other) { percent = other.percent; scale = other.scale; origpercent = other.origpercent; values = other.values; return *this; } - qreal percent; //massaged percent along the painter path - qreal scale; - qreal origpercent; //'real' percent along the painter path + qreal percent = 0; //massaged percent along the painter path + qreal scale = 1; + qreal origpercent = 0; //'real' percent along the painter path QHash<QString, qreal> values; }; @@ -512,8 +512,8 @@ private: static void interpolate(QList<AttributePoint> &points, int idx, const QString &name, qreal value); static void endpoint(QList<AttributePoint> &attributePoints, const QString &name); - static QPointF forwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle = 0); - static QPointF backwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle = 0); + static QPointF forwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle = nullptr); + static QPointF backwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle = nullptr); private: Q_DISABLE_COPY(QQuickPath) @@ -521,9 +521,9 @@ private: friend class QQuickPathAnimationUpdater; public: - QPainterPath createPath(const QPointF &startPoint, const QPointF &endPoint, const QStringList &attributes, qreal &pathLength, QList<AttributePoint> &attributePoints, bool *closed = 0); - QPainterPath createShapePath(const QPointF &startPoint, const QPointF &endPoint, qreal &pathLength, bool *closed = 0); - static QPointF sequentialPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle = 0); + QPainterPath createPath(const QPointF &startPoint, const QPointF &endPoint, const QStringList &attributes, qreal &pathLength, QList<AttributePoint> &attributePoints, bool *closed = nullptr); + QPainterPath createShapePath(const QPointF &startPoint, const QPointF &endPoint, qreal &pathLength, bool *closed = nullptr); + static QPointF sequentialPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle = nullptr); }; QT_END_NAMESPACE diff --git a/src/quick/util/qquickpath_p_p.h b/src/quick/util/qquickpath_p_p.h index f5c9664223..9735d51264 100644 --- a/src/quick/util/qquickpath_p_p.h +++ b/src/quick/util/qquickpath_p_p.h @@ -72,7 +72,7 @@ public: static QQuickPathPrivate* get(QQuickPath *path) { return path->d_func(); } static const QQuickPathPrivate* get(const QQuickPath *path) { return path->d_func(); } - QQuickPathPrivate() : pathLength(0), closed(false), componentComplete(true), isShapePath(false) { } + QQuickPathPrivate() {} QPainterPath _path; QList<QQuickPathElement*> _pathElements; @@ -83,10 +83,10 @@ public: mutable QQuickCachedBezier prevBez; QQmlNullableValue<qreal> startX; QQmlNullableValue<qreal> startY; - qreal pathLength; - bool closed; - bool componentComplete; - bool isShapePath; + qreal pathLength = 0; + bool closed = false; + bool componentComplete = true; + bool isShapePath = false; }; QT_END_NAMESPACE diff --git a/src/quick/util/qquickpathinterpolator.cpp b/src/quick/util/qquickpathinterpolator.cpp index 838213042e..bb47ca0205 100644 --- a/src/quick/util/qquickpathinterpolator.cpp +++ b/src/quick/util/qquickpathinterpolator.cpp @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE */ QQuickPathInterpolator::QQuickPathInterpolator(QObject *parent) : - QObject(parent), _path(0), _x(0), _y(0), _angle(0), _progress(0) + QObject(parent), _path(nullptr), _x(0), _y(0), _angle(0), _progress(0) { } diff --git a/src/quick/util/qquickpathinterpolator_p.h b/src/quick/util/qquickpathinterpolator_p.h index 0fdb1a444f..60a9ff2e22 100644 --- a/src/quick/util/qquickpathinterpolator_p.h +++ b/src/quick/util/qquickpathinterpolator_p.h @@ -70,7 +70,7 @@ class Q_AUTOTEST_EXPORT QQuickPathInterpolator : public QObject Q_PROPERTY(qreal y READ y NOTIFY yChanged) Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged) public: - explicit QQuickPathInterpolator(QObject *parent = 0); + explicit QQuickPathInterpolator(QObject *parent = nullptr); QQuickPath *path() const; void setPath(QQuickPath *path); diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 7097bcc156..e1937aeec2 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -244,8 +244,8 @@ public: : refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Error), url(u), errorString(e), requestSize(s), providerOptions(po), appliedTransform(QQuickImageProviderOptions::UsePluginDefaultTransform), - textureFactory(0), reply(0), prevUnreferenced(0), - prevUnreferencedPtr(0), nextUnreferenced(0) + textureFactory(nullptr), reply(nullptr), prevUnreferenced(nullptr), + prevUnreferencedPtr(nullptr), nextUnreferenced(nullptr) { declarativePixmaps.insert(pixmap); } @@ -254,8 +254,8 @@ public: : refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Loading), url(u), requestSize(r), providerOptions(po), appliedTransform(aTransform), - textureFactory(0), reply(0), prevUnreferenced(0), prevUnreferencedPtr(0), - nextUnreferenced(0) + textureFactory(nullptr), reply(nullptr), prevUnreferenced(nullptr), prevUnreferencedPtr(nullptr), + nextUnreferenced(nullptr) { declarativePixmaps.insert(pixmap); } @@ -265,8 +265,8 @@ public: : refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Ready), url(u), implicitSize(s), requestSize(r), providerOptions(po), appliedTransform(aTransform), - textureFactory(texture), reply(0), prevUnreferenced(0), - prevUnreferencedPtr(0), nextUnreferenced(0) + textureFactory(texture), reply(nullptr), prevUnreferenced(nullptr), + prevUnreferencedPtr(nullptr), nextUnreferenced(nullptr) { declarativePixmaps.insert(pixmap); } @@ -274,8 +274,8 @@ public: QQuickPixmapData(QQuickPixmap *pixmap, QQuickTextureFactory *texture) : refCount(1), inCache(false), pixmapStatus(QQuickPixmap::Ready), appliedTransform(QQuickImageProviderOptions::UsePluginDefaultTransform), - textureFactory(texture), reply(0), prevUnreferenced(0), - prevUnreferencedPtr(0), nextUnreferenced(0) + textureFactory(texture), reply(nullptr), prevUnreferenced(nullptr), + prevUnreferencedPtr(nullptr), nextUnreferenced(nullptr) { if (texture) requestSize = implicitSize = texture->textureSize(); @@ -287,7 +287,7 @@ public: while (!declarativePixmaps.isEmpty()) { QQuickPixmap *referencer = declarativePixmaps.first(); declarativePixmaps.remove(referencer); - referencer->d = 0; + referencer->d = nullptr; } delete textureFactory; } @@ -443,9 +443,9 @@ static QString existingImageFileForPath(const QString &localFile) } QQuickPixmapReader::QQuickPixmapReader(QQmlEngine *eng) -: QThread(eng), engine(eng), threadObject(0) +: QThread(eng), engine(eng), threadObject(nullptr) #if QT_CONFIG(qml_network) -, accessManager(0) +, accessManager(nullptr) #endif { eventLoopQuitHack = new QObject; @@ -464,7 +464,7 @@ QQuickPixmapReader::~QQuickPixmapReader() // manually cancel all outstanding jobs. for (QQuickPixmapReply *reply : qAsConst(jobs)) { if (reply->data && reply->data->reply == reply) - reply->data->reply = 0; + reply->data->reply = nullptr; delete reply; } jobs.clear(); @@ -473,7 +473,7 @@ QQuickPixmapReader::~QQuickPixmapReader() const auto cancelJob = [this](QQuickPixmapReply *reply) { if (reply->loading) { cancelled.append(reply); - reply->data = 0; + reply->data = nullptr; } }; @@ -547,7 +547,7 @@ void QQuickPixmapReader::asyncResponseFinished(QQuickImageResponse *response) QQuickPixmapReply *job = asyncResponses.take(response); if (job) { - QQuickTextureFactory *t = 0; + QQuickTextureFactory *t = nullptr; QQuickPixmapReply::ReadError error = QQuickPixmapReply::NoError; QString errorString; if (!response->errorString().isEmpty()) { @@ -646,7 +646,7 @@ void QQuickPixmapReader::processJobs() const QUrl url = job->url; QString localFile; QQuickImageProvider::ImageType imageType = QQuickImageProvider::Invalid; - QQuickImageProvider *provider = 0; + QQuickImageProvider *provider = nullptr; if (url.scheme() == QLatin1String("image")) { provider = static_cast<QQuickImageProvider *>(engine->imageProvider(imageProviderId(url))); @@ -695,7 +695,7 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u QString errorStr = QQuickPixmap::tr("Invalid image provider: %1").arg(url.toString()); mutex.lock(); if (!cancelled.contains(runningJob)) - runningJob->postReply(QQuickPixmapReply::Loading, errorStr, readSize, 0); + runningJob->postReply(QQuickPixmapReply::Loading, errorStr, readSize, nullptr); mutex.unlock(); return; } @@ -884,7 +884,7 @@ void QQuickPixmapReader::cancel(QQuickPixmapReply *reply) mutex.lock(); if (reply->loading) { cancelled.append(reply); - reply->data = 0; + reply->data = nullptr; // XXX if (threadObject) threadObject->processJobs(); } else { @@ -918,7 +918,7 @@ void QQuickPixmapReader::run() exec(); delete threadObject; - threadObject = 0; + threadObject = nullptr; } class QQuickPixmapKey @@ -971,7 +971,7 @@ Q_GLOBAL_STATIC(QQuickPixmapStore, pixmapStore); QQuickPixmapStore::QQuickPixmapStore() - : m_unreferencedPixmaps(0), m_lastUnreferencedPixmap(0), m_unreferencedCost(0), m_timerId(-1), m_destroying(false) + : m_unreferencedPixmaps(nullptr), m_lastUnreferencedPixmap(nullptr), m_unreferencedCost(0), m_timerId(-1), m_destroying(false) { } @@ -1014,9 +1014,9 @@ QQuickPixmapStore::~QQuickPixmapStore() void QQuickPixmapStore::unreferencePixmap(QQuickPixmapData *data) { - Q_ASSERT(data->prevUnreferenced == 0); - Q_ASSERT(data->prevUnreferencedPtr == 0); - Q_ASSERT(data->nextUnreferenced == 0); + Q_ASSERT(data->prevUnreferenced == nullptr); + Q_ASSERT(data->prevUnreferencedPtr == nullptr); + Q_ASSERT(data->nextUnreferenced == nullptr); data->nextUnreferenced = m_unreferencedPixmaps; data->prevUnreferencedPtr = &m_unreferencedPixmaps; @@ -1052,9 +1052,9 @@ void QQuickPixmapStore::referencePixmap(QQuickPixmapData *data) if (m_lastUnreferencedPixmap == data) m_lastUnreferencedPixmap = data->prevUnreferenced; - data->nextUnreferenced = 0; - data->prevUnreferencedPtr = 0; - data->prevUnreferenced = 0; + data->nextUnreferenced = nullptr; + data->prevUnreferencedPtr = nullptr; + data->prevUnreferenced = nullptr; m_unreferencedCost -= data->cost(); } @@ -1063,12 +1063,12 @@ void QQuickPixmapStore::shrinkCache(int remove) { while ((remove > 0 || m_unreferencedCost > cache_limit) && m_lastUnreferencedPixmap) { QQuickPixmapData *data = m_lastUnreferencedPixmap; - Q_ASSERT(data->nextUnreferenced == 0); + Q_ASSERT(data->nextUnreferenced == nullptr); - *data->prevUnreferencedPtr = 0; + *data->prevUnreferencedPtr = nullptr; m_lastUnreferencedPixmap = data->prevUnreferenced; - data->prevUnreferencedPtr = 0; - data->prevUnreferenced = 0; + data->prevUnreferencedPtr = nullptr; + data->prevUnreferenced = nullptr; if (!m_destroying) { remove -= data->cost(); @@ -1085,7 +1085,7 @@ void QQuickPixmapStore::timerEvent(QTimerEvent *) shrinkCache(removalCost); - if (m_unreferencedPixmaps == 0) { + if (m_unreferencedPixmaps == nullptr) { killTimer(m_timerId); m_timerId = -1; } @@ -1102,7 +1102,7 @@ void QQuickPixmap::purgeCache() } QQuickPixmapReply::QQuickPixmapReply(QQuickPixmapData *d) -: data(d), engineForReader(0), requestSize(d->requestSize), url(d->url), loading(false), providerOptions(d->providerOptions), redirectCount(0) +: data(d), engineForReader(nullptr), requestSize(d->requestSize), url(d->url), loading(false), providerOptions(d->providerOptions), redirectCount(0) { if (finishedIndex == -1) { finishedIndex = QMetaMethod::fromSignal(&QQuickPixmapReply::finished).methodIndex(); @@ -1125,10 +1125,10 @@ bool QQuickPixmapReply::event(QEvent *event) data->pixmapStatus = (de->error == NoError) ? QQuickPixmap::Ready : QQuickPixmap::Error; if (data->pixmapStatus == QQuickPixmap::Ready) { data->textureFactory = de->textureFactory; - de->textureFactory = 0; + de->textureFactory = nullptr; data->implicitSize = de->implicitSize; PIXMAP_PROFILE(pixmapLoadingFinished(data->url, - data->textureFactory != 0 && data->textureFactory->textureSize().isValid() ? + data->textureFactory != nullptr && data->textureFactory->textureSize().isValid() ? data->textureFactory->textureSize() : (data->requestSize.isValid() ? data->requestSize : data->implicitSize))); } else { @@ -1137,7 +1137,7 @@ bool QQuickPixmapReply::event(QEvent *event) data->removeFromCache(); // We don't continue to cache error'd pixmaps } - data->reply = 0; + data->reply = nullptr; emit finished(); } else { PIXMAP_PROFILE(pixmapStateChanged<QQuickProfiler::PixmapLoadingError>(url)); @@ -1173,8 +1173,8 @@ void QQuickPixmapData::release() if (refCount == 0) { if (reply) { QQuickPixmapReply *cancelReply = reply; - reply->data = 0; - reply = 0; + reply->data = nullptr; + reply = nullptr; QQuickPixmapReader::readerMutex.lock(); QQuickPixmapReader *reader = QQuickPixmapReader::existingInstance(cancelReply->engineForReader); if (reader) @@ -1276,7 +1276,7 @@ static QQuickPixmapData* createPixmapDataSync(QQuickPixmap *declarativePixmap, Q QString localFile = QQmlFile::urlToLocalFileOrQrc(url); if (localFile.isEmpty()) - return 0; + return nullptr; QFile f(existingImageFileForPath(localFile)); QSize readSize; @@ -1318,18 +1318,18 @@ struct QQuickPixmapNull { Q_GLOBAL_STATIC(QQuickPixmapNull, nullPixmap); QQuickPixmap::QQuickPixmap() -: d(0) +: d(nullptr) { } QQuickPixmap::QQuickPixmap(QQmlEngine *engine, const QUrl &url) -: d(0) +: d(nullptr) { load(engine, url); } QQuickPixmap::QQuickPixmap(QQmlEngine *engine, const QUrl &url, const QSize &size) -: d(0) +: d(nullptr) { load(engine, url, size); } @@ -1345,13 +1345,13 @@ QQuickPixmap::~QQuickPixmap() if (d) { d->declarativePixmaps.remove(this); d->release(); - d = 0; + d = nullptr; } } bool QQuickPixmap::isNull() const { - return d == 0; + return d == nullptr; } bool QQuickPixmap::isReady() const @@ -1422,7 +1422,7 @@ QQuickTextureFactory *QQuickPixmap::textureFactory() const if (d) return d->textureFactory; - return 0; + return nullptr; } QImage QQuickPixmap::image() const @@ -1500,7 +1500,7 @@ void QQuickPixmap::load(QQmlEngine *engine, const QUrl &url, const QSize &reques if (d) { d->declarativePixmaps.remove(this); d->release(); - d = 0; + d = nullptr; } QQuickPixmapKey key = { &url, &requestSize, providerOptions }; @@ -1572,7 +1572,7 @@ void QQuickPixmap::clear() if (d) { d->declarativePixmaps.remove(this); d->release(); - d = 0; + d = nullptr; } } @@ -1580,10 +1580,10 @@ void QQuickPixmap::clear(QObject *obj) { if (d) { if (d->reply) - QObject::disconnect(d->reply, 0, obj, 0); + QObject::disconnect(d->reply, nullptr, obj, nullptr); d->declarativePixmaps.remove(this); d->release(); - d = 0; + d = nullptr; } } diff --git a/src/quick/util/qquickprofiler.cpp b/src/quick/util/qquickprofiler.cpp index d8e48d8ba9..decc6eac31 100644 --- a/src/quick/util/qquickprofiler.cpp +++ b/src/quick/util/qquickprofiler.cpp @@ -47,12 +47,12 @@ QT_BEGIN_NAMESPACE // instance will be set, unset in constructor. Allows static methods to be inlined. -QQuickProfiler *QQuickProfiler::s_instance = 0; +QQuickProfiler *QQuickProfiler::s_instance = nullptr; quint64 QQuickProfiler::featuresEnabled = 0; void QQuickProfiler::initialize(QObject *parent) { - Q_ASSERT(s_instance == 0); + Q_ASSERT(s_instance == nullptr); s_instance = new QQuickProfiler(parent); } @@ -99,7 +99,7 @@ QQuickProfiler::~QQuickProfiler() { QMutexLocker lock(&m_dataMutex); featuresEnabled = 0; - s_instance = 0; + s_instance = nullptr; } void QQuickProfiler::startProfilingImpl(quint64 features) diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index c585d4c16d..a3a598621f 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -213,13 +213,15 @@ public: class ExpressionChange { public: ExpressionChange(const QString &_name, + const QV4::CompiledData::Binding *_binding, QQmlBinding::Identifier _id, const QString& _expr, const QUrl &_url, int _line, int _column) - : name(_name), id(_id), expression(_expr), url(_url), line(_line), column(_column) {} + : name(_name), binding(_binding), id(_id), expression(_expr), url(_url), line(_line), column(_column) {} QString name; + const QV4::CompiledData::Binding *binding; QQmlBinding::Identifier id; QString expression; QUrl url; @@ -296,8 +298,7 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix, } } - if (binding->type == QV4::CompiledData::Binding::Type_Script) { - QString expression = binding->valueAsString(qmlUnit); + if (binding->type == QV4::CompiledData::Binding::Type_Script || binding->containsTranslations()) { QUrl url = QUrl(); int line = -1; int column = -1; @@ -309,16 +310,23 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix, column = ddata->columnNumber; } - expressions << ExpressionChange(propertyName, binding->value.compiledScriptIndex, expression, url, line, column); + QString expression; + QQmlBinding::Identifier id = QQmlBinding::Invalid; + + if (!binding->containsTranslations()) { + expression = binding->valueAsString(qmlUnit); + id = binding->value.compiledScriptIndex; + } + expressions << ExpressionChange(propertyName, binding, id, expression, url, line, column); return; } QVariant var; switch (binding->type) { case QV4::CompiledData::Binding::Type_Script: - Q_UNREACHABLE(); case QV4::CompiledData::Binding::Type_Translation: case QV4::CompiledData::Binding::Type_TranslationById: + Q_UNREACHABLE(); case QV4::CompiledData::Binding::Type_String: var = binding->valueAsString(qmlUnit); break; @@ -459,14 +467,15 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions() QQmlContextData *context = QQmlContextData::get(qmlContext(this)); - QQmlBinding *newBinding = 0; - if (e.id != QQmlBinding::Invalid) { + QQmlBinding *newBinding = nullptr; + if (e.binding && e.binding->containsTranslations()) { + newBinding = QQmlBinding::createTranslationBinding(d->compilationUnit, e.binding, object(), context); + } else if (e.id != QQmlBinding::Invalid) { QV4::Scope scope(qmlEngine(this)->handle()); QV4::Scoped<QV4::QmlContext> qmlContext(scope, QV4::QmlContext::create(scope.engine->rootContext(), context, object())); newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, d->compilationUnit->runtimeFunctions.at(e.id), object(), context, qmlContext); } -// QQmlBinding *newBinding = e.id != QQmlBinding::Invalid ? QQmlBinding::createBinding(e.id, object(), qmlContext(this)) : 0; if (!newBinding) newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, e.expression, object(), context, e.url.toString(), e.line); @@ -645,7 +654,7 @@ void QQuickPropertyChanges::changeExpression(const QString &name, const QString } // adding a new expression. - expressionIterator.insert(ExpressionEntry(name, QQmlBinding::Invalid, expression, QUrl(), -1, -1)); + expressionIterator.insert(ExpressionEntry(name, nullptr, QQmlBinding::Invalid, expression, QUrl(), -1, -1)); if (state() && state()->isStateActive()) { if (hadValue) { diff --git a/src/quick/util/qquicksmoothedanimation_p.h b/src/quick/util/qquicksmoothedanimation_p.h index 2f0e3bc0d8..7bceba387c 100644 --- a/src/quick/util/qquicksmoothedanimation_p.h +++ b/src/quick/util/qquicksmoothedanimation_p.h @@ -73,7 +73,7 @@ public: enum ReversingMode { Eased, Immediate, Sync }; Q_ENUM(ReversingMode) - QQuickSmoothedAnimation(QObject *parent = 0); + QQuickSmoothedAnimation(QObject *parent = nullptr); ~QQuickSmoothedAnimation(); ReversingMode reversingMode() const; @@ -91,7 +91,7 @@ public: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; Q_SIGNALS: void velocityChanged(); void reversingModeChanged(); diff --git a/src/quick/util/qquicksmoothedanimation_p_p.h b/src/quick/util/qquicksmoothedanimation_p_p.h index a415fdb55f..7850562594 100644 --- a/src/quick/util/qquicksmoothedanimation_p_p.h +++ b/src/quick/util/qquicksmoothedanimation_p_p.h @@ -65,7 +65,7 @@ class QSmoothedAnimationTimer : public QTimer { Q_OBJECT public: - explicit QSmoothedAnimationTimer(QSmoothedAnimation *animation, QObject *parent = 0); + explicit QSmoothedAnimationTimer(QSmoothedAnimation *animation, QObject *parent = nullptr); ~QSmoothedAnimationTimer(); public Q_SLOTS: void stopAnimation(); @@ -78,7 +78,7 @@ class Q_AUTOTEST_EXPORT QSmoothedAnimation : public QAbstractAnimationJob { Q_DISABLE_COPY(QSmoothedAnimation) public: - QSmoothedAnimation(QQuickSmoothedAnimationPrivate * = 0); + QSmoothedAnimation(QQuickSmoothedAnimationPrivate * = nullptr); ~QSmoothedAnimation(); qreal to; @@ -98,7 +98,7 @@ public: void init(); void prepareForRestart(); - void clearTemplate() { animationTemplate = 0; } + void clearTemplate() { animationTemplate = nullptr; } protected: void updateCurrentTime(int) override; diff --git a/src/quick/util/qquickspringanimation.cpp b/src/quick/util/qquickspringanimation.cpp index bf844589ba..4389d941fd 100644 --- a/src/quick/util/qquickspringanimation.cpp +++ b/src/quick/util/qquickspringanimation.cpp @@ -58,7 +58,7 @@ class Q_AUTOTEST_EXPORT QSpringAnimation : public QAbstractAnimationJob { Q_DISABLE_COPY(QSpringAnimation) public: - QSpringAnimation(QQuickSpringAnimationPrivate * = 0); + QSpringAnimation(QQuickSpringAnimationPrivate * = nullptr); ~QSpringAnimation(); int duration() const override; @@ -94,7 +94,7 @@ public: typedef QHash<QQmlProperty, QSpringAnimation*> ActiveAnimationHash; typedef ActiveAnimationHash::Iterator ActiveAnimationHashIt; - void clearTemplate() { animationTemplate = 0; } + void clearTemplate() { animationTemplate = nullptr; } protected: void updateCurrentTime(int time) override; diff --git a/src/quick/util/qquickspringanimation_p.h b/src/quick/util/qquickspringanimation_p.h index ffb2c41e6b..2014a4311a 100644 --- a/src/quick/util/qquickspringanimation_p.h +++ b/src/quick/util/qquickspringanimation_p.h @@ -73,7 +73,7 @@ class Q_AUTOTEST_EXPORT QQuickSpringAnimation : public QQuickNumberAnimation Q_PROPERTY(qreal mass READ mass WRITE setMass NOTIFY massChanged) public: - QQuickSpringAnimation(QObject *parent=0); + QQuickSpringAnimation(QObject *parent=nullptr); ~QQuickSpringAnimation(); qreal velocity() const; @@ -97,7 +97,7 @@ public: QAbstractAnimationJob* transition(QQuickStateActions &actions, QQmlProperties &modified, TransitionDirection direction, - QObject *defaultTarget = 0) override; + QObject *defaultTarget = nullptr) override; Q_SIGNALS: void modulusChanged(); diff --git a/src/quick/util/qquickstate.cpp b/src/quick/util/qquickstate.cpp index 3e0a2169a8..be8300f531 100644 --- a/src/quick/util/qquickstate.cpp +++ b/src/quick/util/qquickstate.cpp @@ -52,8 +52,8 @@ QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG); QQuickStateAction::QQuickStateAction() -: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(0), event(0), - specifiedObject(0) +: restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), fromBinding(nullptr), event(nullptr), + specifiedObject(nullptr) { } @@ -61,7 +61,7 @@ QQuickStateAction::QQuickStateAction(QObject *target, const QString &propertyNam const QVariant &value) : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), property(target, propertyName, qmlEngine(target)), toValue(value), - fromBinding(0), event(0), + fromBinding(nullptr), event(nullptr), specifiedObject(target), specifiedProperty(propertyName) { if (property.isValid()) @@ -71,7 +71,7 @@ QQuickStateAction::QQuickStateAction(QObject *target, const QString &propertyNam QQuickStateAction::QQuickStateAction(QObject *target, const QQmlProperty &property, const QString &propertyName, const QVariant &value) : restore(true), actionDone(false), reverseEvent(false), deletableToBinding(false), property(property), toValue(value), - fromBinding(0), event(0), + fromBinding(nullptr), event(nullptr), specifiedObject(target), specifiedProperty(propertyName) { if (property.isValid()) @@ -192,7 +192,7 @@ bool QQuickState::isNamed() const bool QQuickState::isWhenKnown() const { Q_D(const QQuickState); - return d->when != 0; + return d->when != nullptr; } /*! @@ -362,7 +362,7 @@ void QQuickStateAction::deleteFromBinding() { if (fromBinding) { QQmlPropertyPrivate::removeBinding(property); - fromBinding = 0; + fromBinding = nullptr; } } @@ -530,7 +530,7 @@ QQmlAbstractBinding *QQuickState::bindingInRevertList(QObject *target, const QSt } } - return 0; + return nullptr; } bool QQuickState::isStateActive() const diff --git a/src/quick/util/qquickstate_p.h b/src/quick/util/qquickstate_p.h index f551402e80..89af5882df 100644 --- a/src/quick/util/qquickstate_p.h +++ b/src/quick/util/qquickstate_p.h @@ -126,7 +126,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickStateOperation : public QObject { Q_OBJECT public: - QQuickStateOperation(QObject *parent = 0) + QQuickStateOperation(QObject *parent = nullptr) : QObject(parent) {} typedef QList<QQuickStateAction> ActionList; @@ -136,7 +136,7 @@ public: void setState(QQuickState *state); protected: - QQuickStateOperation(QObjectPrivate &dd, QObject *parent = 0); + QQuickStateOperation(QObjectPrivate &dd, QObject *parent = nullptr); private: Q_DECLARE_PRIVATE(QQuickStateOperation) @@ -159,7 +159,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickState : public QObject Q_CLASSINFO("DeferredPropertyNames", "changes") public: - QQuickState(QObject *parent=0); + QQuickState(QObject *parent=nullptr); virtual ~QQuickState(); QString name() const; diff --git a/src/quick/util/qquickstate_p_p.h b/src/quick/util/qquickstate_p_p.h index eba1dabecf..f1bc24c558 100644 --- a/src/quick/util/qquickstate_p_p.h +++ b/src/quick/util/qquickstate_p_p.h @@ -178,8 +178,8 @@ private: class QQuickRevertAction { public: - QQuickRevertAction() : event(0) {} - QQuickRevertAction(const QQmlProperty &prop) : property(prop), event(0) {} + QQuickRevertAction() : event(nullptr) {} + QQuickRevertAction(const QQmlProperty &prop) : property(prop), event(nullptr) {} QQuickRevertAction(QQuickStateActionEvent *e) : event(e) {} QQmlProperty property; QQuickStateActionEvent *event; @@ -192,7 +192,7 @@ class QQuickStateOperationPrivate : public QObjectPrivate public: QQuickStateOperationPrivate() - : m_state(0) {} + : m_state(nullptr) {} QQuickState *m_state; }; @@ -203,7 +203,7 @@ class QQuickStatePrivate : public QObjectPrivate public: QQuickStatePrivate() - : when(0), named(false), inState(false), group(0) {} + : when(nullptr), named(false), inState(false), group(nullptr) {} typedef QList<QQuickSimpleAction> SimpleActionList; @@ -233,7 +233,7 @@ public: QList<OperationGuard> *list = static_cast<QList<OperationGuard> *>(prop->data); QMutableListIterator<OperationGuard> listIterator(*list); while(listIterator.hasNext()) - listIterator.next()->setState(0); + listIterator.next()->setState(nullptr); list->clear(); } static int operations_count(QQmlListProperty<QQuickStateOperation> *prop) { diff --git a/src/quick/util/qquickstatechangescript_p.h b/src/quick/util/qquickstatechangescript_p.h index a1315ae2ef..ff509a7cf5 100644 --- a/src/quick/util/qquickstatechangescript_p.h +++ b/src/quick/util/qquickstatechangescript_p.h @@ -66,7 +66,7 @@ class Q_AUTOTEST_EXPORT QQuickStateChangeScript : public QQuickStateOperation, p Q_PROPERTY(QString name READ name WRITE setName) public: - QQuickStateChangeScript(QObject *parent=0); + QQuickStateChangeScript(QObject *parent=nullptr); ~QQuickStateChangeScript(); ActionList actions() override; diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp index ebcbbf93ed..1b99baed9a 100644 --- a/src/quick/util/qquickstategroup.cpp +++ b/src/quick/util/qquickstategroup.cpp @@ -60,7 +60,7 @@ class QQuickStateGroupPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QQuickStateGroup) public: QQuickStateGroupPrivate() - : nullState(0), componentComplete(true), + : nullState(nullptr), componentComplete(true), ignoreTrans(false), applyingState(false), unnamedCount(0) {} QString currentState; @@ -129,7 +129,7 @@ QQuickStateGroup::~QQuickStateGroup() { Q_D(const QQuickStateGroup); for (int i = 0; i < d->states.count(); ++i) - d->states.at(i)->setStateGroup(0); + d->states.at(i)->setStateGroup(nullptr); } QList<QQuickState *> QQuickStateGroup::states() const @@ -194,7 +194,7 @@ void QQuickStateGroupPrivate::clear_states(QQmlListProperty<QQuickState> *list) QQuickStateGroup *_this = static_cast<QQuickStateGroup *>(list->object); _this->d_func()->setCurrentStateInternal(QString(), true); for (int i = 0; i < _this->d_func()->states.count(); ++i) { - _this->d_func()->states.at(i)->setStateGroup(0); + _this->d_func()->states.at(i)->setStateGroup(nullptr); } _this->d_func()->states.clear(); } @@ -364,7 +364,7 @@ bool QQuickStateGroupPrivate::updateAutoState() QQuickTransition *QQuickStateGroupPrivate::findTransition(const QString &from, const QString &to) { - QQuickTransition *highest = 0; + QQuickTransition *highest = nullptr; int score = 0; bool reversed = false; bool done = false; @@ -444,7 +444,7 @@ void QQuickStateGroupPrivate::setCurrentStateInternal(const QString &state, applyingState = true; - QQuickTransition *transition = ignoreTrans ? 0 : findTransition(currentState, state); + QQuickTransition *transition = ignoreTrans ? nullptr : findTransition(currentState, state); if (stateChangeDebug()) { qWarning() << this << "Changing state. From" << currentState << ". To" << state; if (transition) @@ -452,7 +452,7 @@ void QQuickStateGroupPrivate::setCurrentStateInternal(const QString &state, << transition->toState(); } - QQuickState *oldState = 0; + QQuickState *oldState = nullptr; if (!currentState.isEmpty()) { for (int ii = 0; ii < states.count(); ++ii) { if (states.at(ii)->name() == currentState) { @@ -465,7 +465,7 @@ void QQuickStateGroupPrivate::setCurrentStateInternal(const QString &state, currentState = state; emit q->stateChanged(currentState); - QQuickState *newState = 0; + QQuickState *newState = nullptr; for (int ii = 0; ii < states.count(); ++ii) { if (states.at(ii)->name() == currentState) { newState = states.at(ii); @@ -473,7 +473,7 @@ void QQuickStateGroupPrivate::setCurrentStateInternal(const QString &state, } } - if (oldState == 0 || newState == 0) { + if (oldState == nullptr || newState == nullptr) { if (!nullState) { nullState = new QQuickState; QQml_setParent_noEvent(nullState, q); @@ -496,7 +496,7 @@ QQuickState *QQuickStateGroup::findState(const QString &name) const return state; } - return 0; + return nullptr; } void QQuickStateGroup::removeState(QQuickState *state) diff --git a/src/quick/util/qquickstategroup_p.h b/src/quick/util/qquickstategroup_p.h index eebe3a9e56..7235066d99 100644 --- a/src/quick/util/qquickstategroup_p.h +++ b/src/quick/util/qquickstategroup_p.h @@ -67,7 +67,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickStateGroup : public QObject, public QQmlParse Q_PROPERTY(QQmlListProperty<QQuickTransition> transitions READ transitionsProperty DESIGNABLE false) public: - QQuickStateGroup(QObject * = 0); + QQuickStateGroup(QObject * = nullptr); virtual ~QQuickStateGroup(); QString state() const; diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp index ae8719341d..762d49f2d2 100644 --- a/src/quick/util/qquickstyledtext.cpp +++ b/src/quick/util/qquickstyledtext.cpp @@ -695,7 +695,7 @@ void QQuickStyledTextPrivate::parseImageAttributes(const QChar *&ch, const QStri image->size = image->pix->implicitSize(); } else { delete image->pix; - image->pix = 0; + image->pix = nullptr; } } } diff --git a/src/quick/util/qquickstyledtext_p.h b/src/quick/util/qquickstyledtext_p.h index 2a2e234224..51f1b7d8f9 100644 --- a/src/quick/util/qquickstyledtext_p.h +++ b/src/quick/util/qquickstyledtext_p.h @@ -67,9 +67,7 @@ class QQmlContext; class Q_AUTOTEST_EXPORT QQuickStyledTextImgTag { public: - QQuickStyledTextImgTag() - : position(0), offset(0.0), align(QQuickStyledTextImgTag::Bottom), pix(0) - { } + QQuickStyledTextImgTag() { } ~QQuickStyledTextImgTag() { delete pix; } @@ -82,10 +80,10 @@ public: QUrl url; QPointF pos; QSize size; - int position; - qreal offset; // this offset allows us to compensate for flooring reserved space - Align align; - QQuickPixmap *pix; + int position = 0; + qreal offset = 0.0; // this offset allows us to compensate for flooring reserved space + Align align = QQuickStyledTextImgTag::Bottom; + QQuickPixmap *pix = nullptr; }; class Q_AUTOTEST_EXPORT QQuickStyledText diff --git a/src/quick/util/qquicksvgparser.cpp b/src/quick/util/qquicksvgparser.cpp index 086c6d0b28..2bf9c121d3 100644 --- a/src/quick/util/qquicksvgparser.cpp +++ b/src/quick/util/qquicksvgparser.cpp @@ -126,7 +126,7 @@ static qreal toDouble(const QChar *&str) val = -val; } else { bool ok = false; - val = qstrtod(temp, 0, &ok); + val = qstrtod(temp, nullptr, &ok); } return val; diff --git a/src/quick/util/qquicksystempalette_p.h b/src/quick/util/qquicksystempalette_p.h index 086fb31993..9a3a520ed1 100644 --- a/src/quick/util/qquicksystempalette_p.h +++ b/src/quick/util/qquicksystempalette_p.h @@ -81,7 +81,7 @@ class Q_AUTOTEST_EXPORT QQuickSystemPalette : public QObject Q_PROPERTY(QColor highlightedText READ highlightedText NOTIFY paletteChanged) public: - QQuickSystemPalette(QObject *parent=0); + QQuickSystemPalette(QObject *parent=nullptr); ~QQuickSystemPalette(); enum ColorGroup { Active = QPalette::Active, Inactive = QPalette::Inactive, Disabled = QPalette::Disabled }; diff --git a/src/quick/util/qquicktimeline.cpp b/src/quick/util/qquicktimeline.cpp index 1f4ac08d4d..ac9f75979e 100644 --- a/src/quick/util/qquicktimeline.cpp +++ b/src/quick/util/qquicktimeline.cpp @@ -57,7 +57,7 @@ struct Update { Update(QQuickTimeLineValue *_g, qreal _v) : g(_g), v(_v) {} Update(const QQuickTimeLineCallback &_e) - : g(0), v(0), e(_e) {} + : g(nullptr), v(0), e(_e) {} QQuickTimeLineValue *g; qreal v; @@ -104,11 +104,11 @@ struct QQuickTimeLinePrivate }; struct TimeLine { - TimeLine() : length(0), consumedOpLength(0), base(0.) {} + TimeLine() {} QList<Op> ops; - int length; - int consumedOpLength; - qreal base; + int length = 0; + int consumedOpLength = 0; + qreal base = 0.; }; int length; @@ -133,7 +133,7 @@ struct QQuickTimeLinePrivate }; QQuickTimeLinePrivate::QQuickTimeLinePrivate(QQuickTimeLine *parent) -: length(0), syncPoint(0), q(parent), clockRunning(false), prevTime(0), order(0), syncMode(QQuickTimeLine::LocalSync), syncAdj(0), updateQueue(0) +: length(0), syncPoint(0), q(parent), clockRunning(false), prevTime(0), order(0), syncMode(QQuickTimeLine::LocalSync), syncAdj(0), updateQueue(nullptr) { } @@ -326,9 +326,9 @@ QQuickTimeLine::~QQuickTimeLine() for (QQuickTimeLinePrivate::Ops::Iterator iter = d->ops.begin(); iter != d->ops.end(); ++iter) - iter.key()->_t = 0; + iter.key()->_t = nullptr; - delete d; d = 0; + delete d; d = nullptr; } /*! @@ -514,7 +514,7 @@ void QQuickTimeLine::reset(QQuickTimeLineValue &timeLineValue) return; } remove(&timeLineValue); - timeLineValue._t = 0; + timeLineValue._t = nullptr; } int QQuickTimeLine::duration() const @@ -666,7 +666,7 @@ void QQuickTimeLine::complete() void QQuickTimeLine::clear() { for (QQuickTimeLinePrivate::Ops::const_iterator iter = d->ops.cbegin(), cend = d->ops.cend(); iter != cend; ++iter) - iter.key()->_t = 0; + iter.key()->_t = nullptr; d->ops.clear(); d->length = 0; d->syncPoint = 0; @@ -800,7 +800,7 @@ int QQuickTimeLinePrivate::advance(int t) if (tl.ops.isEmpty()) { iter = ops.erase(iter); - v->_t = 0; + v->_t = nullptr; } else { if (tl.ops.first().type == Op::Pause && pauseTime != 0) { int opPauseTime = tl.ops.first().length - tl.consumedOpLength; @@ -826,7 +826,7 @@ int QQuickTimeLinePrivate::advance(int t) v.e.d0(v.e.d1); } } - updateQueue = 0; + updateQueue = nullptr; } while(t); return pauseTime; @@ -913,7 +913,7 @@ void QQuickTimeLine::remove(QQuickTimeLineObject *v) QQuickTimeLineObject::QQuickTimeLineObject() -: _t(0) +: _t(nullptr) { } @@ -921,12 +921,12 @@ QQuickTimeLineObject::~QQuickTimeLineObject() { if (_t) { _t->remove(this); - _t = 0; + _t = nullptr; } } QQuickTimeLineCallback::QQuickTimeLineCallback() -: d0(0), d1(0), d2(0) +: d0(nullptr), d1(nullptr), d2(nullptr) { } diff --git a/src/quick/util/qquicktimeline_p_p.h b/src/quick/util/qquicktimeline_p_p.h index ae1087487b..abb5369b7b 100644 --- a/src/quick/util/qquicktimeline_p_p.h +++ b/src/quick/util/qquicktimeline_p_p.h @@ -65,7 +65,7 @@ class Q_AUTOTEST_EXPORT QQuickTimeLine : public QObject, QAbstractAnimationJob { Q_OBJECT public: - QQuickTimeLine(QObject *parent = 0); + QQuickTimeLine(QObject *parent = nullptr); ~QQuickTimeLine(); enum SyncMode { LocalSync, GlobalSync }; @@ -152,7 +152,7 @@ public: typedef void (*Callback)(void *); QQuickTimeLineCallback(); - QQuickTimeLineCallback(QQuickTimeLineObject *b, Callback, void * = 0); + QQuickTimeLineCallback(QQuickTimeLineObject *b, Callback, void * = nullptr); QQuickTimeLineCallback(const QQuickTimeLineCallback &o); QQuickTimeLineCallback &operator=(const QQuickTimeLineCallback &o); @@ -170,7 +170,7 @@ class QQuickTimeLineValueProxy : public QQuickTimeLineValue { public: QQuickTimeLineValueProxy(T *cls, void (T::*func)(qreal), qreal v = 0.) - : QQuickTimeLineValue(v), _class(cls), _setFunctionReal(func), _setFunctionInt(0) + : QQuickTimeLineValue(v), _class(cls), _setFunctionReal(func), _setFunctionInt(nullptr) { Q_ASSERT(_class); } diff --git a/src/quick/util/qquicktransition.cpp b/src/quick/util/qquicktransition.cpp index 6ae89c4ed4..fd6415dffb 100644 --- a/src/quick/util/qquicktransition.cpp +++ b/src/quick/util/qquicktransition.cpp @@ -263,7 +263,7 @@ QQuickTransitionInstance *QQuickTransition::prepare(QQuickStateOperation::Action int start = d->reversed ? d->animations.count() - 1 : 0; int end = d->reversed ? -1 : d->animations.count(); - QAbstractAnimationJob *anim = 0; + QAbstractAnimationJob *anim = nullptr; for (int i = start; i != end;) { anim = d->animations.at(i)->transition(actions, after, direction, defaultTarget); if (anim) { diff --git a/src/quick/util/qquicktransition_p.h b/src/quick/util/qquicktransition_p.h index 6d2e41fc9d..c7d06b8832 100644 --- a/src/quick/util/qquicktransition_p.h +++ b/src/quick/util/qquicktransition_p.h @@ -105,7 +105,7 @@ class Q_QUICK_PRIVATE_EXPORT QQuickTransition : public QObject Q_CLASSINFO("DeferredPropertyNames", "animations") public: - QQuickTransition(QObject *parent=0); + QQuickTransition(QObject *parent=nullptr); ~QQuickTransition(); QString fromState() const; diff --git a/src/quick/util/qquicktransitionmanager.cpp b/src/quick/util/qquicktransitionmanager.cpp index 714e6d62b6..a1367249c6 100644 --- a/src/quick/util/qquicktransitionmanager.cpp +++ b/src/quick/util/qquicktransitionmanager.cpp @@ -56,7 +56,7 @@ class QQuickTransitionManagerPrivate { public: QQuickTransitionManagerPrivate() - : state(0), transitionInstance(0) {} + : state(nullptr), transitionInstance(nullptr) {} void applyBindings(); typedef QList<QQuickSimpleAction> SimpleActionList; @@ -79,7 +79,7 @@ void QQuickTransitionManager::setState(QQuickState *s) QQuickTransitionManager::~QQuickTransitionManager() { delete d->transitionInstance; - delete d; d = 0; + delete d; d = nullptr; } bool QQuickTransitionManager::isRunning() const @@ -274,7 +274,7 @@ void QQuickTransitionManager::cancel() QQuickStateAction action = d->bindingsList[i]; if (action.toBinding && action.deletableToBinding) { QQmlPropertyPrivate::removeBinding(action.property); - action.toBinding = 0; + action.toBinding = nullptr; action.deletableToBinding = false; } else if (action.event) { //### what do we do here? diff --git a/src/quick/util/qquicktransitionmanager_p_p.h b/src/quick/util/qquicktransitionmanager_p_p.h index 68daf6db3c..89317e1e07 100644 --- a/src/quick/util/qquicktransitionmanager_p_p.h +++ b/src/quick/util/qquicktransitionmanager_p_p.h @@ -66,7 +66,7 @@ public: bool isRunning() const; - void transition(const QList<QQuickStateAction> &, QQuickTransition *transition, QObject *defaultTarget = 0); + void transition(const QList<QQuickStateAction> &, QQuickTransition *transition, QObject *defaultTarget = nullptr); void cancel(); diff --git a/src/quick/util/qquickvalidator_p.h b/src/quick/util/qquickvalidator_p.h index ba188e947a..812e552d8e 100644 --- a/src/quick/util/qquickvalidator_p.h +++ b/src/quick/util/qquickvalidator_p.h @@ -62,7 +62,7 @@ class Q_AUTOTEST_EXPORT QQuickIntValidator : public QIntValidator Q_OBJECT Q_PROPERTY(QString locale READ localeName WRITE setLocaleName RESET resetLocaleName NOTIFY localeNameChanged) public: - QQuickIntValidator(QObject *parent = 0); + QQuickIntValidator(QObject *parent = nullptr); QString localeName() const; void setLocaleName(const QString &name); @@ -77,7 +77,7 @@ class Q_AUTOTEST_EXPORT QQuickDoubleValidator : public QDoubleValidator Q_OBJECT Q_PROPERTY(QString locale READ localeName WRITE setLocaleName RESET resetLocaleName NOTIFY localeNameChanged) public: - QQuickDoubleValidator(QObject *parent = 0); + QQuickDoubleValidator(QObject *parent = nullptr); QString localeName() const; void setLocaleName(const QString &name); diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index 6a767dbb46..6f3b685974 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -184,15 +184,15 @@ void QQuickWidgetPrivate::handleWindowChange() } QQuickWidgetPrivate::QQuickWidgetPrivate() - : root(0) - , component(0) - , offscreenWindow(0) - , offscreenSurface(0) - , renderControl(0) + : root(nullptr) + , component(nullptr) + , offscreenWindow(nullptr) + , offscreenSurface(nullptr) + , renderControl(nullptr) #if QT_CONFIG(opengl) - , fbo(0) - , resolvedFbo(0) - , context(0) + , fbo(nullptr) + , resolvedFbo(nullptr) + , context(nullptr) #endif , resizeMode(QQuickWidget::SizeViewToRootObject) , initialSize(0,0) @@ -233,11 +233,11 @@ void QQuickWidgetPrivate::execute() if (root) { delete root; - root = 0; + root = nullptr; } if (component) { delete component; - component = 0; + component = nullptr; } if (!source.isEmpty()) { QML_MEMORY_SCOPE_URL(engine.data()->baseUrl().resolved(source)); @@ -500,7 +500,7 @@ QImage QQuickWidgetPrivate::grabFramebuffer() */ QQuickWidget::QQuickWidget(QWidget *parent) -: QWidget(*(new QQuickWidgetPrivate), parent, 0) +: QWidget(*(new QQuickWidgetPrivate), parent, nullptr) { setMouseTracking(true); setFocusPolicy(Qt::StrongFocus); @@ -528,7 +528,7 @@ QQuickWidget::QQuickWidget(const QUrl &source, QWidget *parent) \sa Status, status(), errors() */ QQuickWidget::QQuickWidget(QQmlEngine* engine, QWidget *parent) - : QWidget(*(new QQuickWidgetPrivate), parent, 0) + : QWidget(*(new QQuickWidgetPrivate), parent, nullptr) { setMouseTracking(true); setFocusPolicy(Qt::StrongFocus); @@ -544,7 +544,7 @@ QQuickWidget::~QQuickWidget() // be a child of the QQuickWidgetPrivate, and will be destroyed by its dtor Q_D(QQuickWidget); delete d->root; - d->root = 0; + d->root = nullptr; } /*! @@ -588,7 +588,7 @@ void QQuickWidget::setContent(const QUrl& url, QQmlComponent *component, QObject if (d->component && d->component->isError()) { const QList<QQmlError> errorList = d->component->errors(); for (const QQmlError &error : errorList) { - QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning() << error; } emit statusChanged(status()); @@ -797,7 +797,7 @@ void QQuickWidgetPrivate::updateSize() void QQuickWidgetPrivate::updatePosition() { Q_Q(QQuickWidget); - if (offscreenWindow == 0) + if (offscreenWindow == nullptr) return; const QPoint &pos = q->mapToGlobal(QPoint(0, 0)); @@ -871,7 +871,7 @@ void QQuickWidgetPrivate::createContext() if (!context->create()) { const bool isEs = context->isOpenGLES(); delete context; - context = 0; + context = nullptr; handleContextCreationFailure(offscreenWindow->requestedFormat(), isEs); return; } @@ -897,10 +897,10 @@ void QQuickWidgetPrivate::createContext() void QQuickWidgetPrivate::destroyContext() { delete offscreenSurface; - offscreenSurface = 0; + offscreenSurface = nullptr; #if QT_CONFIG(opengl) delete context; - context = 0; + context = nullptr; #endif } @@ -1010,9 +1010,9 @@ void QQuickWidget::destroyFramebufferObject() #if QT_CONFIG(opengl) delete d->fbo; - d->fbo = 0; + d->fbo = nullptr; delete d->resolvedFbo; - d->resolvedFbo = 0; + d->resolvedFbo = nullptr; #endif } @@ -1033,7 +1033,7 @@ void QQuickWidget::continueExecute() if (d->component->isError()) { const QList<QQmlError> errorList = d->component->errors(); for (const QQmlError &error : errorList) { - QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning() << error; } emit statusChanged(status()); @@ -1045,7 +1045,7 @@ void QQuickWidget::continueExecute() if (d->component->isError()) { const QList<QQmlError> errorList = d->component->errors(); for (const QQmlError &error : errorList) { - QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), 0).warning() + QMessageLogger(error.url().toString().toLatin1().constData(), error.line(), nullptr).warning() << error; } emit statusChanged(status()); @@ -1078,7 +1078,7 @@ void QQuickWidgetPrivate::setRootObject(QObject *obj) << "Ensure your QML code is written for QtQuick 2, and uses a root that is or" << endl << "inherits from QtQuick's Item (not a Timer, QtObject, etc)." << endl; delete obj; - root = 0; + root = nullptr; } if (root) { initialSize = rootObjectSize(); diff --git a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp index c81fd37f07..7e19e925b6 100644 --- a/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp +++ b/tests/auto/qml/animation/qabstractanimationjob/tst_qabstractanimationjob.cpp @@ -53,7 +53,7 @@ private slots: class TestableQAbstractAnimation : public QAbstractAnimationJob { public: - TestableQAbstractAnimation() : m_duration(10) {} + TestableQAbstractAnimation() {} virtual ~TestableQAbstractAnimation() {}; int duration() const { return m_duration; } @@ -61,7 +61,7 @@ public: void setDuration(int duration) { m_duration = duration; } private: - int m_duration; + int m_duration = 10; }; class DummyQAnimationGroup : public QAnimationGroupJob diff --git a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp index b7f8280c5b..974357dc8e 100644 --- a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp @@ -71,10 +71,7 @@ class UncontrolledAnimation : public QObject, public QAbstractAnimationJob { Q_OBJECT public: - UncontrolledAnimation() - : id(0) - { - } + UncontrolledAnimation() { } int duration() const { return -1; /* not time driven */ } @@ -96,7 +93,7 @@ protected: } private: - int id; + int id = 0; }; class StateChangeListener: public QAnimationJobChangeListener diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp index 476ad2e955..a8bcadbc84 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp @@ -89,7 +89,6 @@ class UncontrolledAnimation : public QObject, public QAbstractAnimationJob Q_OBJECT public: UncontrolledAnimation() - : id(0) { } @@ -113,7 +112,7 @@ protected: } private: - int id; + int id = 0; }; class StateChangeListener: public QAnimationJobChangeListener @@ -133,14 +132,14 @@ public: class FinishedListener: public QAnimationJobChangeListener { public: - FinishedListener() : m_count(0) {} + FinishedListener() {} virtual void animationFinished(QAbstractAnimationJob *) { ++m_count; } void clear() { m_count = 0; } int count() { return m_count; } private: - int m_count; + int m_count = 0; }; void tst_QParallelAnimationGroupJob::setCurrentTime() @@ -685,10 +684,10 @@ void tst_QParallelAnimationGroupJob::stopUncontrolledAnimations() } struct AnimState { - AnimState(int time = -1) : time(time), state(-1) {} + AnimState(int time = -1) : time(time) {} AnimState(int time, int state) : time(time), state(state) {} int time; - int state; + int state = -1; }; #define Running QAbstractAnimationJob::Running @@ -848,7 +847,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/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp index ff295c5409..8f6b6a2ab7 100644 --- a/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp +++ b/tests/auto/qml/animation/qpauseanimationjob/tst_qpauseanimationjob.cpp @@ -39,17 +39,14 @@ static const char winTimerError[] = "On windows, consistent timing is not workin class TestablePauseAnimation : public QPauseAnimationJob { public: - TestablePauseAnimation() - : m_updateCurrentTimeCount(0) - { - } + TestablePauseAnimation() { } TestablePauseAnimation(int duration) : QPauseAnimationJob(duration), m_updateCurrentTimeCount(0) { } - int m_updateCurrentTimeCount; + int m_updateCurrentTimeCount = 0; protected: void updateCurrentTime(int currentTime) { diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp index ee5db3e75a..57b0905a8a 100644 --- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp @@ -95,7 +95,7 @@ class TestValueAnimation : public TestAnimation { public: TestValueAnimation(int duration = 250) - : TestAnimation(duration), start(0), end(0), value(0) {} + : TestAnimation(duration) {} void updateCurrentTime(int msecs) { @@ -105,8 +105,8 @@ public: value = start + (end - start) * (qreal(msecs) / duration()); } - qreal start, end; - qreal value; + qreal start = 0, end = 0; + qreal value = 0; }; class UncontrolledAnimation : public QObject, public QAbstractAnimationJob @@ -140,14 +140,14 @@ public: class FinishedListener: public QAnimationJobChangeListener { public: - FinishedListener() : m_count(0) {} + FinishedListener() {} virtual void animationFinished(QAbstractAnimationJob *) { ++m_count; } void clear() { m_count = 0; } int count() { return m_count; } private: - int m_count; + int m_count = 0; }; void tst_QSequentialAnimationGroupJob::setCurrentTime() 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 73e10e5dc4..9dc088486b 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -618,10 +618,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); @@ -642,7 +642,7 @@ void tst_QJSEngine::newQObject_ownership() QJSEngine eng; { QPointer<QObject> ptr = new QObject(); - QVERIFY(ptr != 0); + QVERIFY(ptr != nullptr); { QJSValue v = eng.newQObject(ptr); } @@ -653,7 +653,7 @@ void tst_QJSEngine::newQObject_ownership() } { QPointer<QObject> ptr = new QObject(this); - QVERIFY(ptr != 0); + QVERIFY(ptr != nullptr); { QJSValue v = eng.newQObject(ptr); } @@ -668,11 +668,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); } @@ -685,18 +685,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); @@ -738,23 +738,18 @@ public: }; Q_ENUMS(Enum1 Enum2) - Q_INVOKABLE TestQMetaObject() - : m_called(1) { - } + Q_INVOKABLE TestQMetaObject() {} Q_INVOKABLE TestQMetaObject(int) - : m_called(2) { - } + : m_called(2) {} Q_INVOKABLE TestQMetaObject(QString) - : m_called(3) { - } + : m_called(3) {} Q_INVOKABLE TestQMetaObject(QString, int) - : m_called(4) { - } + : m_called(4) {} int called() const { return m_called; } private: - int m_called; + int m_called = 1; }; void tst_QJSEngine::newQObjectPropertyCache() @@ -1303,8 +1298,8 @@ void tst_QJSEngine::errorMessage_QT679() struct Foo { public: - int x, y; - Foo() : x(-1), y(-1) { } + int x = -1, y = -1; + Foo() {} }; Q_DECLARE_METATYPE(Foo) @@ -1380,7 +1375,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() @@ -1466,7 +1461,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()); { @@ -1577,7 +1572,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*) { } }; @@ -1606,7 +1601,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) @@ -3159,10 +3154,9 @@ class ThreadedTestEngine : public QThread { Q_OBJECT; public: - int result; + int result = 0; - ThreadedTestEngine() - : result(0) {} + ThreadedTestEngine() {} void run() { QJSEngine firstEngine; @@ -3375,7 +3369,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)); @@ -4061,9 +4055,9 @@ class TestObject : public QObject { Q_OBJECT public: - TestObject() : called(false) {} + TestObject() {} - bool called; + bool called = false; Q_INVOKABLE void callMe(QQmlV4Function *) { called = true; 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..b49832499e 100644 --- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp +++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp @@ -45,13 +45,13 @@ struct Range template <typename T> struct Array { - Array() : array(0), count(0) {} + Array() : array(nullptr) {} template<int N> Array(const T (&array)[N]) : array(array), count(N) {} T operator [](int index) const { return array[index]; } const T *array; - int count; + int count = 0; }; typedef Array<int> IndexArray; @@ -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..eb6eb62648 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; @@ -1232,7 +1232,7 @@ class DateFormatter : public QObject { Q_OBJECT public: - DateFormatter() : QObject() {} + DateFormatter() {} Q_INVOKABLE QString getLocalizedForm(const QString &isoTimestamp); }; 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..8811f779bb 100644 --- a/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp +++ b/tests/auto/qml/qqmlnotifier/tst_qqmlnotifier.cpp @@ -46,21 +46,17 @@ class ExportedClass : public QObject Q_PROPERTY(int v4BindingProp2 READ v4BindingProp2 NOTIFY v4BindingProp2Changed) Q_PROPERTY(int scriptBindingProp READ scriptBindingProp NOTIFY scriptBindingPropChanged) public: - int qmlObjectPropConnections; - int cppObjectPropConnections; - int unboundPropConnections; - int v8BindingPropConnections; - int v4BindingPropConnections; - int v4BindingProp2Connections; - int scriptBindingPropConnections; - int boundSignalConnections; - int unusedSignalConnections; - - ExportedClass() - : qmlObjectPropConnections(0), cppObjectPropConnections(0), unboundPropConnections(0), - v8BindingPropConnections(0), v4BindingPropConnections(0), v4BindingProp2Connections(0), - scriptBindingPropConnections(0), boundSignalConnections(0), unusedSignalConnections(0) - {} + int qmlObjectPropConnections = 0; + int cppObjectPropConnections = 0; + int unboundPropConnections = 0; + int v8BindingPropConnections = 0; + int v4BindingPropConnections = 0; + int v4BindingProp2Connections = 0; + int scriptBindingPropConnections = 0; + int boundSignalConnections = 0; + int unusedSignalConnections = 0; + + ExportedClass() {} ~ExportedClass() { @@ -141,9 +137,7 @@ class tst_qqmlnotifier : public QQmlDataTest { Q_OBJECT public: - tst_qqmlnotifier() - : root(0), exportedClass(0), exportedObject(0) - {} + tst_qqmlnotifier() {} private slots: void initTestCase() override; @@ -166,9 +160,9 @@ private: void createObjects(); QQmlEngine engine; - QObject *root; - ExportedClass *exportedClass; - ExportedClass *exportedObject; + QObject *root = nullptr; + ExportedClass *exportedClass = nullptr; + ExportedClass *exportedObject = nullptr; }; void tst_qqmlnotifier::initTestCase() @@ -180,28 +174,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 +297,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..86229b95f3 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -71,8 +71,7 @@ class LazyPropertyMap : public QQmlPropertyMap, public QQmlParserStatus Q_PROPERTY(int someFixedProperty READ someFixedProperty WRITE setSomeFixedProperty NOTIFY someFixedPropertyChanged) public: LazyPropertyMap() - : QQmlPropertyMap(this, /*parent*/0) - , value(0) + : QQmlPropertyMap(this, /*parent*/nullptr) {} virtual void classBegin() {} @@ -87,7 +86,7 @@ signals: void someFixedPropertyChanged(); private: - int value; + int value = 0; }; void tst_QQmlPropertyMap::initTestCase() @@ -313,7 +312,7 @@ class MyEnhancedPropertyMap : public QQmlPropertyMap { Q_OBJECT public: - MyEnhancedPropertyMap() : QQmlPropertyMap(this, 0), m_testSlotCalled(false) {} + MyEnhancedPropertyMap() : QQmlPropertyMap(this, nullptr) {} bool testSlotCalled() const { return m_testSlotCalled; } signals: @@ -323,7 +322,7 @@ public slots: void testSlot() { m_testSlotCalled = true; } private: - bool m_testSlotCalled; + bool m_testSlotCalled = false; }; void tst_QQmlPropertyMap::metaObjectAccessibility() 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..b353d23539 100644 --- a/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp +++ b/tests/auto/qml/qqmlsettings/tst_qqmlsettings.cpp @@ -87,11 +87,8 @@ class CppObject : public QObject Q_PROPERTY(QFont fontProperty MEMBER m_fontProperty NOTIFY fontPropertyChanged) public: - CppObject(QObject *parent = 0) : QObject(parent), - m_intProperty(123), - m_boolProperty(true), - m_realProperty(1.23), - m_doubleProperty(3.45), + CppObject(QObject *parent = nullptr) : QObject(parent), + m_stringProperty("foo"), m_urlProperty("http://www.qt-project.org"), m_objectProperty(keyValueMap("foo", "bar")), @@ -127,10 +124,10 @@ signals: void fontPropertyChanged(const QFont &arg); private: - int m_intProperty; - bool m_boolProperty; - qreal m_realProperty; - double m_doubleProperty; + int m_intProperty = 123; + bool m_boolProperty = true; + qreal m_realProperty = 1.23; + double m_doubleProperty = 3.45; QString m_stringProperty; QUrl m_urlProperty; QVariant m_varProperty; 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..68ed22c01c 100644 --- a/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp +++ b/tests/auto/qml/qqmlstatemachine/tst_qqmlstatemachine.cpp @@ -55,10 +55,7 @@ public: }; public: - CppObject() - : QObject() - , m_objectState(State0) - {} + CppObject() {} ObjectState objectState() const { return m_objectState; } void setObjectState(ObjectState objectState) { m_objectState = objectState; emit objectStateChanged();} @@ -68,7 +65,7 @@ signals: void mySignal(int signalState); private: - ObjectState m_objectState; + ObjectState m_objectState = State0; }; tst_qqmlstatemachine::tst_qqmlstatemachine() @@ -86,7 +83,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..4e42d02514 100644 --- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp +++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp @@ -89,11 +89,9 @@ class TimerHelper : public QObject { Q_OBJECT public: - TimerHelper() : QObject(), count(0) - { - } + TimerHelper() { } - int count; + int count = 0; public slots: void timeout() { @@ -101,9 +99,7 @@ public slots: } }; -tst_qqmltimer::tst_qqmltimer() -{ -} +tst_qqmltimer::tst_qqmltimer() { } void tst_qqmltimer::initTestCase() { @@ -116,7 +112,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 +134,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 +159,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 +201,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 +235,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 +264,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 +277,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 +313,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 +346,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 +374,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 +397,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/data/TranslationChangeBase.qml b/tests/auto/qml/qqmltranslation/data/TranslationChangeBase.qml index c447c84987..294fff3284 100644 --- a/tests/auto/qml/qqmltranslation/data/TranslationChangeBase.qml +++ b/tests/auto/qml/qqmltranslation/data/TranslationChangeBase.qml @@ -1,5 +1,5 @@ -import QtQml 2.0 +import QtQuick 2.0 -QtObject { +Item { property string baseProperty: qsTr("translate me"); } diff --git a/tests/auto/qml/qqmltranslation/data/translationChange.qml b/tests/auto/qml/qqmltranslation/data/translationChange.qml index 23b87c2493..c48a482138 100644 --- a/tests/auto/qml/qqmltranslation/data/translationChange.qml +++ b/tests/auto/qml/qqmltranslation/data/translationChange.qml @@ -1,10 +1,24 @@ -import QtQml 2.0 +import QtQuick 2.0 TranslationChangeBase { + id: root + baseProperty: "do not translate" property string text1: qsTr("translate me") function weDoTranslations() { return qsTr("translate me") } property string text2: weDoTranslations() + property string text3 + + states: [ + State { + name: "default" + when: 1 == 1 + PropertyChanges { + target: root + text3: qsTr("translate me") + } + } + ] } diff --git a/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp b/tests/auto/qml/qqmltranslation/tst_qqmltranslation.cpp index 80c54bdf8e..1c67ba5541 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); @@ -194,6 +194,7 @@ void tst_qqmltranslation::translationChange() QCOMPARE(object->property("baseProperty").toString(), QString::fromUtf8("do not translate")); QCOMPARE(object->property("text1").toString(), QString::fromUtf8("translate me")); QCOMPARE(object->property("text2").toString(), QString::fromUtf8("translate me")); + QCOMPARE(object->property("text3").toString(), QString::fromUtf8("translate me")); DummyTranslator translator; QCoreApplication::installTranslator(&translator); @@ -204,6 +205,7 @@ void tst_qqmltranslation::translationChange() QCOMPARE(object->property("baseProperty").toString(), QString::fromUtf8("do not translate")); QCOMPARE(object->property("text1").toString(), QString::fromUtf8("xxx")); QCOMPARE(object->property("text2").toString(), QString::fromUtf8("xxx")); + QCOMPARE(object->property("text3").toString(), QString::fromUtf8("xxx")); QCoreApplication::removeTranslator(&translator); } 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..77fda3b555 100644 --- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp +++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp @@ -48,7 +48,7 @@ class tst_qquickfolderlistmodel : public QQmlDataTest { Q_OBJECT public: - tst_qquickfolderlistmodel() : removeStart(0), removeEnd(0) {} + tst_qquickfolderlistmodel() {} public slots: void removed(const QModelIndex &, int start, int end) { @@ -78,8 +78,8 @@ private: void checkNoErrors(const QQmlComponent& component); QQmlEngine engine; - int removeStart; - int removeEnd; + int removeStart = 0; + int removeEnd = 0; }; void tst_qquickfolderlistmodel::checkNoErrors(const QQmlComponent& component) @@ -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..79a9e5f757 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -76,9 +76,9 @@ private Q_SLOTS: void textureNodeRect(); private: - QOffscreenSurface *surface; - QOpenGLContext *context; - QSGDefaultRenderContext *renderContext; + QOffscreenSurface *surface = nullptr; + QOpenGLContext *context = nullptr; + QSGDefaultRenderContext *renderContext = nullptr; }; void NodesTest::initTestCase() @@ -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); @@ -147,9 +147,6 @@ public: int DummyRenderer::globalRendereringOrder; NodesTest::NodesTest() - : surface(nullptr) - , context(nullptr) - , renderContext(nullptr) { } 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 e303495944..3e5a054cc7 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -152,7 +152,7 @@ void tst_qquickanimatedimage::mirror_running() QQuickView window; window.setSource(testFileUrl("hearts.qml")); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject()); QVERIFY(anim); @@ -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()); @@ -565,8 +565,8 @@ void tst_qquickanimatedimage::noCaching() window_nocache.setSource(testFileUrl("colors_nocache.qml")); window.show(); window_nocache.show(); - QTest::qWaitForWindowExposed(&window); - QTest::qWaitForWindowExposed(&window_nocache); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QVERIFY(QTest::qWaitForWindowExposed(&window_nocache)); QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject()); QVERIFY(anim); diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp index fb5201946a..4ca31fd957 100644 --- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp +++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp @@ -31,6 +31,7 @@ #include <private/qabstractanimation_p.h> #include <private/qquickanimatedsprite_p.h> #include <private/qquickitem_p.h> +#include <QtCore/qscopedpointer.h> #include <QtGui/qpainter.h> #include <QtGui/qopenglcontext.h> #include <QtGui/qopenglfunctions.h> @@ -53,6 +54,7 @@ private slots: void test_reparenting(); void test_changeSourceToSmallerImgKeepingBigFrameSize(); void test_infiniteLoops(); + void test_implicitSize(); }; void tst_qquickanimatedsprite::initTestCase() @@ -63,11 +65,11 @@ void tst_qquickanimatedsprite::initTestCase() void tst_qquickanimatedsprite::test_properties() { - QQuickView *window = new QQuickView(0); + QScopedPointer<QQuickView> window(new QQuickView); window->setSource(testFileUrl("basic.qml")); window->show(); - QVERIFY(QTest::qWaitForWindowExposed(window)); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject()); QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); @@ -87,17 +89,15 @@ void tst_qquickanimatedsprite::test_properties() QCOMPARE(finishedSpy.count(), 0); sprite->setInterpolate(false); QVERIFY(!sprite->interpolate()); - - delete window; } void tst_qquickanimatedsprite::test_runningChangedSignal() { - QQuickView *window = new QQuickView(0); + QScopedPointer<QQuickView> window(new QQuickView); window->setSource(testFileUrl("runningChange.qml")); window->show(); - QVERIFY(QTest::qWaitForWindowExposed(window)); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject()); QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); @@ -115,8 +115,6 @@ void tst_qquickanimatedsprite::test_runningChangedSignal() QTRY_VERIFY(!sprite->running()); QTRY_COMPARE(runningChangedSpy.count(), 2); QCOMPARE(finishedSpy.count(), 1); - - delete window; } template <typename T> @@ -128,7 +126,7 @@ static bool isWithinRange(T min, T value, T max) void tst_qquickanimatedsprite::test_frameChangedSignal() { - QQuickView *window = new QQuickView(0); + QScopedPointer<QQuickView> window(new QQuickView); window->setSource(testFileUrl("frameChange.qml")); window->show(); @@ -137,7 +135,7 @@ void tst_qquickanimatedsprite::test_frameChangedSignal() QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); QSignalSpy frameChangedSpy(sprite, SIGNAL(currentFrameChanged(int))); QVERIFY(sprite); - QVERIFY(QTest::qWaitForWindowExposed(window)); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(!sprite->running()); QVERIFY(!sprite->paused()); @@ -165,8 +163,6 @@ void tst_qquickanimatedsprite::test_frameChangedSignal() prevFrame = frame; } QCOMPARE(loopCounter, 3); - - delete window; } void tst_qquickanimatedsprite::test_largeAnimation_data() @@ -225,11 +221,11 @@ void tst_qquickanimatedsprite::test_largeAnimation() { QFETCH(bool, frameSync); - QQuickView *window = new QQuickView(0); + QScopedPointer<QQuickView> window(new QQuickView); window->engine()->addImageProvider(QLatin1String("test"), new AnimationImageProvider); window->setSource(testFileUrl("largeAnimation.qml")); window->show(); - QVERIFY(QTest::qWaitForWindowExposed(window)); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject()); QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); @@ -275,7 +271,6 @@ void tst_qquickanimatedsprite::test_largeAnimation() maxTextureSize /= 512; QVERIFY(maxFrame > maxTextureSize); // make sure we go beyond the texture width limitation QCOMPARE(loopCounter, sprite->loops()); - delete window; } void tst_qquickanimatedsprite::test_reparenting() @@ -290,7 +285,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) @@ -324,7 +319,7 @@ void tst_qquickanimatedsprite::test_changeSourceToSmallerImgKeepingBigFrameSize( QQmlProperty big(sprite, "big"); big.write(QVariant::fromValue(false)); - KillerThread *killer = new KillerThread; + QScopedPointer<KillerThread> killer(new KillerThread); killer->start(); // will kill us in case the GUI or render thread enters an infinite loop QTest::qWait(50); // let it draw with the new source. @@ -333,7 +328,44 @@ void tst_qquickanimatedsprite::test_changeSourceToSmallerImgKeepingBigFrameSize( killer->terminate(); killer->wait(); - delete killer; +} + +void tst_qquickanimatedsprite::test_implicitSize() +{ + QQuickView window; + window.setSource(testFileUrl("basic.qml")); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QVERIFY(window.rootObject()); + + QQuickAnimatedSprite* sprite = window.rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); + QVERIFY(sprite); + QCOMPARE(sprite->frameWidth(), 31); + QCOMPARE(sprite->frameHeight(), 30); + QCOMPARE(sprite->implicitWidth(), 31); + QCOMPARE(sprite->implicitHeight(), 30); + + // Ensure that implicitWidth matches frameWidth. + QSignalSpy frameWidthChangedSpy(sprite, SIGNAL(frameWidthChanged(int))); + QVERIFY(frameWidthChangedSpy.isValid()); + + QSignalSpy frameImplicitWidthChangedSpy(sprite, SIGNAL(implicitWidthChanged())); + QVERIFY(frameImplicitWidthChangedSpy.isValid()); + + sprite->setFrameWidth(20); + QCOMPARE(frameWidthChangedSpy.count(), 1); + QCOMPARE(frameImplicitWidthChangedSpy.count(), 1); + + // Ensure that implicitHeight matches frameHeight. + QSignalSpy frameHeightChangedSpy(sprite, SIGNAL(frameHeightChanged(int))); + QVERIFY(frameHeightChangedSpy.isValid()); + + QSignalSpy frameImplicitHeightChangedSpy(sprite, SIGNAL(implicitHeightChanged())); + QVERIFY(frameImplicitHeightChangedSpy.isValid()); + + sprite->setFrameHeight(20); + QCOMPARE(frameHeightChangedSpy.count(), 1); + QCOMPARE(frameImplicitHeightChangedSpy.count(), 1); } void tst_qquickanimatedsprite::test_infiniteLoops() 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 89b7924618..62027f59f4 100644 --- a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp +++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp @@ -95,12 +95,12 @@ void tst_qquickapplication::active() // active window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(QGuiApplication::focusWindow(), &window); 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" @@ -165,13 +165,13 @@ void tst_qquickapplication::state() // triggered by window activation. window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(QGuiApplication::focusWindow(), &window); QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationActive); 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 71b0160c8e..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(); @@ -248,7 +248,7 @@ void tst_qquickborderimage::mirror() screenshot = window->grabWindow(); window->show(); - QTest::qWaitForWindowExposed(window); + QVERIFY(QTest::qWaitForWindowExposed(window)); if (window->rendererInterface()->graphicsApi() == QSGRendererInterface::Software) QSKIP("QTBUG-53823"); QCOMPARE(screenshot, srcPixmap); @@ -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); @@ -590,7 +590,7 @@ void tst_qquickborderimage::borderImageMesh() window->setSource(testFileUrl("nonmesh.qml")); window->show(); - QTest::qWaitForWindowExposed(window); + QVERIFY(QTest::qWaitForWindowExposed(window)); QImage nonmesh = window->grabWindow(); window->setSource(testFileUrl("mesh.qml")); 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..9d832066af 100644 --- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp +++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp @@ -57,16 +57,8 @@ class TestDropTarget : public QQuickItem { Q_OBJECT public: - TestDropTarget(QQuickItem *parent = 0) + TestDropTarget(QQuickItem *parent = nullptr) : QQuickItem(parent) - , enterEvents(0) - , moveEvents(0) - , leaveEvents(0) - , dropEvents(0) - , acceptAction(Qt::MoveAction) - , defaultAction(Qt::IgnoreAction) - , proposedAction(Qt::IgnoreAction) - , accept(true) { setFlags(ItemAcceptsDrops); } @@ -119,16 +111,16 @@ public: event->setAccepted(accept); } - int enterEvents; - int moveEvents; - int leaveEvents; - int dropEvents; - Qt::DropAction acceptAction; - Qt::DropAction defaultAction; - Qt::DropAction proposedAction; + int enterEvents = 0; + int moveEvents = 0; + int leaveEvents = 0; + int dropEvents = 0; + Qt::DropAction acceptAction = Qt::MoveAction; + Qt::DropAction defaultAction = Qt::IgnoreAction; + Qt::DropAction proposedAction = Qt::IgnoreAction; Qt::DropActions supportedActions; QPointF position; - bool accept; + bool accept = true; }; class tst_QQuickDrag: public QObject @@ -199,16 +191,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 +224,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 +235,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 +263,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 +275,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 +303,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 +314,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 +338,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 +502,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 +514,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 +630,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 +743,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 +767,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 +1038,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 5ac7fa7015..e59bb7266c 100644 --- a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp +++ b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp @@ -67,15 +67,15 @@ 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(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(view->isTopLevel()); @@ -111,16 +111,16 @@ 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(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(item1->hasActiveFocus()); @@ -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,15 +179,15 @@ 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(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(item0->hasActiveFocus()); @@ -231,16 +231,16 @@ 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(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(item0->hasActiveFocus()); @@ -277,7 +277,7 @@ void tst_qquickfocusscope::noParentFocus() view->show(); view->requestActivate(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(!view->rootObject()->property("focus1").toBool()); @@ -298,15 +298,15 @@ 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(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVariant blue(QColor("blue")); 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/qquickframebufferobject/tst_qquickframebufferobject.cpp b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp index 363064aa31..12e9794dc8 100644 --- a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp +++ b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp @@ -193,7 +193,7 @@ void tst_QQuickFramebufferObject::testThatStuffWorks() view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QImage result = view.grabWindow(); @@ -233,7 +233,7 @@ void tst_QQuickFramebufferObject::testInvalidate() view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(frameInfo.fboSize, QSize(200, 200)); diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 58c9ffce71..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 @@ -1974,17 +1974,17 @@ void tst_QQuickGridView::keyNavigation() window->rootContext()->setContextProperty("testModel", &model); window->setSource(testFileUrl("gridview1.qml")); window->show(); - QTest::qWaitForWindowActive(window); + 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); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); window->requestActivate(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QTRY_COMPARE(qGuiApp->focusWindow(), window); QCOMPARE(gridview->currentIndex(), 0); @@ -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..d8464ebc74 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); @@ -393,7 +393,7 @@ void tst_qquickimageprovider::imageProviderId() class TestThreadProvider : public QQuickImageProvider { public: - TestThreadProvider() : QQuickImageProvider(Image), ok(false) {} + TestThreadProvider() : QQuickImageProvider(Image) {} ~TestThreadProvider() {} @@ -417,7 +417,7 @@ class TestThreadProvider : public QQuickImageProvider QWaitCondition cond; QMutex mutex; - bool ok; + bool ok = false; }; @@ -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); } @@ -495,7 +495,7 @@ class TestImageResponse : public QQuickImageResponse, public QRunnable class TestAsyncProvider : public QQuickAsyncImageProvider { public: - TestAsyncProvider() : ok(false) + TestAsyncProvider() { pool.setMaxThreadCount(4); } @@ -512,7 +512,7 @@ class TestAsyncProvider : public QQuickAsyncImageProvider QThreadPool pool; QMutex lock; QWaitCondition condition; - bool ok; + bool ok = 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 f5e8c6858a..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: @@ -203,12 +203,12 @@ private: NoOp, Append, Remove, StackBefore, StackAfter, SetZ }; - void ensureFocus(QWindow *w) { + bool ensureFocus(QWindow *w) { if (w->width() <=0 || w->height() <= 0) w->setGeometry(100, 100, 400, 300); w->show(); w->requestActivate(); - QTest::qWaitForWindowActive(w); + return QTest::qWaitForWindowActive(w); } }; @@ -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; @@ -299,7 +299,7 @@ struct FocusState : public QHash<QQuickItem *, FocusData> void tst_qquickitem::simpleFocus() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); @@ -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); @@ -351,7 +351,7 @@ void tst_qquickitem::simpleFocus() void tst_qquickitem::scopedFocus() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *l1c1 = new TestItem(window.contentItem()); @@ -431,7 +431,7 @@ void tst_qquickitem::addedToWindow() { { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *item = new TestItem; @@ -451,7 +451,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *item = new TestItem(window.contentItem()); @@ -480,7 +480,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *tree = new TestItem; @@ -504,7 +504,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *tree = new TestFocusScope; QQuickItem *c1 = new TestItem(tree); @@ -532,7 +532,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *tree = new TestFocusScope; QQuickItem *c1 = new TestItem(tree); @@ -558,7 +558,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *tree = new TestFocusScope; @@ -598,7 +598,7 @@ void tst_qquickitem::changeParent() // Parent to no parent { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); @@ -611,16 +611,16 @@ 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(); } // Different parent, same focus scope { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *child2 = new TestItem(window.contentItem()); @@ -641,7 +641,7 @@ void tst_qquickitem::changeParent() // Different parent, different focus scope { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *child2 = new TestFocusScope(window.contentItem()); @@ -658,12 +658,12 @@ void tst_qquickitem::changeParent() item->setParentItem(child2); focusState[item].set(true, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); } { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *child2 = new TestFocusScope(window.contentItem()); @@ -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); @@ -685,7 +685,7 @@ void tst_qquickitem::changeParent() } { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *child2 = new TestFocusScope(window.contentItem()); @@ -711,7 +711,7 @@ void tst_qquickitem::changeParent() // child is deleted, then its parent changes again to a valid parent { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *item = new TestFocusScope(window.contentItem()); QQuickItem *child = new TestItem(item); @@ -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); @@ -750,7 +750,7 @@ void tst_qquickitem::multipleFocusClears() QQuickView view; view.setSource(testFileUrl("multipleFocusClears.qml")); view.show(); - ensureFocus(&view); + QVERIFY(ensureFocus(&view)); QTRY_COMPARE(QGuiApplication::focusWindow(), &view); } @@ -759,7 +759,7 @@ void tst_qquickitem::focusSubItemInNonFocusScope() QQuickView view; view.setSource(testFileUrl("focusSubItemInNonFocusScope.qml")); view.show(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickItem *dummyItem = view.rootObject()->findChild<QQuickItem *>("dummyItem"); QVERIFY(dummyItem); @@ -781,7 +781,7 @@ void tst_qquickitem::focusSubItemInNonFocusScope() void tst_qquickitem::parentItemWithFocus() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); { QQuickItem parent; @@ -880,7 +880,7 @@ void tst_qquickitem::parentItemWithFocus() void tst_qquickitem::reparentFocusedItem() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem parent(window.contentItem()); @@ -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); @@ -1047,7 +1047,7 @@ void tst_qquickitem::enabled() void tst_qquickitem::enabledFocus() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QQuickFocusScope root; @@ -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); @@ -1308,14 +1308,14 @@ void tst_qquickitem::touchEventAcceptIgnore() TestWindow window; window.resize(100, 100); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QScopedPointer<TestItem> item(new TestItem); item->setSize(QSizeF(100, 100)); item->setParentItem(window.contentItem()); item->acceptIncomingTouchEvents = itemSupportsTouch; - static QTouchDevice* device = 0; + static QTouchDevice* device = nullptr; if (!device) { device =new QTouchDevice; device->setType(QTouchDevice::TouchScreen); @@ -1419,7 +1419,7 @@ void tst_qquickitem::polishOnCompleted() QQuickView view; view.setSource(testFileUrl("polishOnCompleted.qml")); view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); TestPolishItem *item = qobject_cast<TestPolishItem*>(view.rootObject()); QVERIFY(item); @@ -1451,7 +1451,7 @@ void tst_qquickitem::wheelEvent() QQuickWindow window; window.resize(width, height); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); TestItem *item = new TestItem; item->setSize(QSizeF(width, height)); @@ -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); @@ -2072,7 +2072,7 @@ void tst_qquickitem::shortcutOverride() { QQuickView view; view.setSource(testFileUrl("shortcutOverride.qml")); - ensureFocus(&view); + QVERIFY(ensureFocus(&view)); QCOMPARE(view.rootObject()->property("escapeHandlerActivationCount").toInt(), 0); QCOMPARE(view.rootObject()->property("shortcutActivationCount").toInt(), 0); @@ -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 b66dc1708f..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(); @@ -2811,7 +2811,7 @@ void tst_QQuickItem::changeListener() { QQuickWindow window; window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickItem *item = new QQuickItem; TestListener itemListener; @@ -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() @@ -3312,7 +3312,7 @@ void tst_QQuickItem::grab() QQuickView view; view.setSource(testFileUrl("grabToImage.qml")); view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QQuickItem *root = qobject_cast<QQuickItem *>(view.rootObject()); QVERIFY(root); diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp index a8a00b51e9..1a289a2087 100644 --- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp +++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp @@ -89,17 +89,12 @@ private slots: private: void mirroringCheck(int mirroring, int x, bool shouldMirror, const QImage &fb); - bool m_isMesaSoftwareRasterizer; - int m_mesaVersion; - bool m_isOpenGLRenderer; + bool m_isMesaSoftwareRasterizer = false; + int m_mesaVersion = 0; + bool m_isOpenGLRenderer = true; }; -tst_QQuickItemLayer::tst_QQuickItemLayer() - : m_isMesaSoftwareRasterizer(false) - , m_mesaVersion(0) - , m_isOpenGLRenderer(true) -{ -} +tst_QQuickItemLayer::tst_QQuickItemLayer() { } void tst_QQuickItemLayer::initTestCase() { @@ -139,7 +134,7 @@ void tst_QQuickItemLayer::initTestCase() #endif QQuickView view; view.showNormal(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); if (view.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL) m_isOpenGLRenderer = false; } @@ -307,7 +302,7 @@ void tst_QQuickItemLayer::layerVisibility() view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QImage fb = view.grabWindow(); uint pixel = fb.pixel(0, 0); @@ -513,7 +508,7 @@ void tst_QQuickItemLayer::textureMirroring() view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QImage fb = view.grabWindow(); diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index dc8c727cbe..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); @@ -2282,13 +2282,13 @@ void tst_QQuickListView::sectionsDelegate_headerVisibility() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); window->requestActivate(); - QTest::qWaitForWindowActive(window.data()); + 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 @@ -2826,10 +2826,10 @@ void tst_QQuickListView::keyNavigation() window->rootContext()->setContextProperty("testObject", testObject); window->setSource(testFileUrl("listviewtest.qml")); window->show(); - QTest::qWaitForWindowActive(window); + 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); @@ -2837,7 +2837,7 @@ void tst_QQuickListView::keyNavigation() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); window->requestActivate(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QTRY_COMPARE(qGuiApp->focusWindow(), window); QTest::keyClick(window, forwardsKey); @@ -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); @@ -7264,13 +7264,13 @@ void tst_QQuickListView::parentBinding() window->setSource(testFileUrl("parentBinding.qml")); window->show(); - QTest::qWaitForWindowExposed(window.data()); + 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; @@ -8643,7 +8643,7 @@ void tst_QQuickListView::itemFiltered() window->setContent(QUrl(), &component, component.create()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); // this should not crash model.setData(model.index(2), QStringLiteral("modified three"), Qt::DisplayRole); @@ -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 65493f52e2..30fc52f95a 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -54,11 +54,11 @@ class PeriodicIncubationController : public QObject, public QQmlIncubationController { public: - PeriodicIncubationController() : incubated(false) {} + PeriodicIncubationController() {} void start() { startTimer(20); } - bool incubated; + bool incubated = false; protected: virtual void timerEvent(QTimerEvent *) { @@ -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); @@ -1188,7 +1188,7 @@ void tst_QQuickLoader::transientWindow() // QTBUG-52944 timer.start(); view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(loadedWindowVisibleTime >= 0); QVERIFY(viewVisibleTime >= 0); @@ -1229,7 +1229,7 @@ void tst_QQuickLoader::nestedTransientWindow() // QTBUG-52944 timer.start(); view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(loadedWindowVisibleTime >= 0); QVERIFY(viewVisibleTime >= 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 4fe01787fa..ea55c25761 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -219,20 +219,20 @@ void tst_QQuickMouseArea::dragProperties() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("dragproperties.qml"), true, &errorMessage), errorMessage.constData()); window.show(); - QTest::qWaitForWindowExposed(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + 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); @@ -317,22 +317,22 @@ void tst_QQuickMouseArea::resetDrag() window.rootContext()->setContextProperty("haveTarget", QVariant(true)); QVERIFY2(initView(window, testFileUrl("dragreset.qml"), true, &errorMessage), errorMessage.constData()); window.show(); - QTest::qWaitForWindowExposed(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + 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(); } @@ -524,24 +524,24 @@ void tst_QQuickMouseArea::invalidDrag() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); - QTest::qWaitForWindowExposed(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + 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); @@ -656,8 +656,8 @@ void tst_QQuickMouseArea::setDragOnPressed() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("setDragOnPressed.qml"), true, &errorMessage), errorMessage.constData()); window.show(); - QTest::qWaitForWindowExposed(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + 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()); @@ -908,7 +908,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QWindow *secondWindow = qvariant_cast<QWindow*>(window.rootObject()->property("secondWindow")); secondWindow->setProperty("visible", true); - QTest::qWaitForWindowExposed(secondWindow); + QVERIFY(QTest::qWaitForWindowExposed(secondWindow)); QTRY_VERIFY(!window.rootObject()->property("pressed").toBool()); QVERIFY(window.rootObject()->property("canceled").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; } @@ -1671,11 +1671,11 @@ void tst_QQuickMouseArea::pressedMultipleButtons() QByteArray errorMessage; QVERIFY2(initView(view, testFileUrl("simple.qml"), true, &errorMessage), errorMessage.constData()); view.show(); - QTest::qWaitForWindowExposed(&view); - QVERIFY(view.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + 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); @@ -2157,7 +2157,7 @@ void tst_QQuickMouseArea::notPressedAfterStolenGrab() QQuickWindow window; window.resize(200, 200); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickMouseArea *ma = new QQuickMouseArea(window.contentItem()); ma->setSize(window.size()); @@ -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..73f3cab318 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() { } private slots: void initTestCase() { @@ -73,16 +73,16 @@ private slots: private: QQuickView *createAndShowView(const QString &file); - QTouchDevice *device; + QTouchDevice *device = nullptr; }; 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..2571e4f288 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() { } private slots: void initTestCase(); void cleanupTestCase(); @@ -55,7 +55,7 @@ private slots: private: QQuickView *createView(); - QTouchDevice *device; + QTouchDevice *device = nullptr; }; void tst_QQuickPinchArea::initTestCase() { @@ -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 1b3939401a..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); @@ -1037,7 +1037,7 @@ void tst_qquickpositioners::populateTransitions(const QString &positionerObjectN QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName); QVERIFY(positioner); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); qApp->processEvents(); if (!dynamicallyPopulate && usePopulateTransition) { @@ -1120,7 +1120,7 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName) ctxt->setContextProperty("testedPositioner", QString()); window->setSource(testFileUrl(qmlFile)); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); qApp->processEvents(); QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName); @@ -1243,7 +1243,7 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName) ctxt->setContextProperty("testedPositioner", QString()); window->setSource(testFileUrl(qmlFile)); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); qApp->processEvents(); QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); @@ -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 d0031e397b..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(); @@ -790,7 +790,7 @@ void tst_qquicktextedit::hAlign_RightToLeft() QVERIFY(textEdit->positionToRectangle(0).x() < window.width()/2); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); textEdit->setText(QString()); @@ -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); } } @@ -1224,7 +1224,7 @@ void tst_qquicktextedit::persistentSelection() QQuickView window(testFileUrl("persistentSelection.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(window.rootObject()); QVERIFY(edit); @@ -1267,7 +1267,7 @@ void tst_qquicktextedit::selectionOnFocusOut() QQuickView window(testFileUrl("focusOutSelection.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QPoint p1(25, 35); QPoint p2(25, 85); @@ -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); @@ -1335,13 +1335,13 @@ void tst_qquicktextedit::focusOnPress() textEditObject->setParentItem(window.contentItem()); window.showNormal(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(textEditObject->hasFocus(), false); 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))); @@ -1487,7 +1487,7 @@ void tst_qquicktextedit::overwriteMode() textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); @@ -1603,13 +1603,13 @@ void tst_qquicktextedit::keySelection() QQuickView window(testFileUrl("navigation.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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); @@ -2060,11 +2060,11 @@ void tst_qquicktextedit::mouseSelection() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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); @@ -2107,19 +2107,19 @@ void tst_qquicktextedit::dragMouseSelection() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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); @@ -2160,19 +2160,19 @@ void tst_qquicktextedit::mouseSelectionMode() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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); @@ -2345,7 +2345,7 @@ void tst_qquicktextedit::keyboardSelection() edit->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(edit->hasActiveFocus()); simulateKeys(&window, standardKey); @@ -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(); - QTest::qWaitForWindowActive(&window); + 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(); - QTest::qWaitForWindowActive(&window); + 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()); @@ -2572,9 +2572,9 @@ void tst_qquicktextedit::cursorDelegate() QQuickView view(source); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + 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")); } @@ -2687,9 +2687,9 @@ void tst_qquicktextedit::remoteCursorDelegate() view.setSource(testFileUrl("cursorTestRemote.qml")); view.showNormal(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + 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. @@ -2713,7 +2713,7 @@ void tst_qquicktextedit::cursorVisible() QQuickView view(testFileUrl("cursorVisible.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(&view, qGuiApp->focusWindow()); QCOMPARE(edit.isCursorVisible(), false); @@ -2745,13 +2745,13 @@ void tst_qquicktextedit::cursorVisible() QWindow alternateView; alternateView.show(); alternateView.requestActivate(); - QTest::qWaitForWindowActive(&alternateView); + QVERIFY(QTest::qWaitForWindowActive(&alternateView)); QCOMPARE(edit.isCursorVisible(), false); QCOMPARE(spy.count(), 6); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(edit.isCursorVisible(), true); QCOMPARE(spy.count(), 7); @@ -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"); @@ -2858,7 +2858,7 @@ void tst_qquicktextedit::cursorDelegateHeight() QQuickView view(testFileUrl("cursorHeight.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject"); QVERIFY(textEditObject); // Delegate creation is deferred until focus in or cursor visibility is forced. @@ -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; @@ -3051,11 +3051,11 @@ void tst_qquicktextedit::middleClickPaste() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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(); @@ -3122,7 +3122,7 @@ void tst_qquicktextedit::textInput() QQuickView view(testFileUrl("inputMethodEvent.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); QVERIFY(edit->hasActiveFocus()); @@ -3175,7 +3175,7 @@ void tst_qquicktextedit::inputMethodUpdate() QQuickView view(testFileUrl("inputMethodEvent.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); QVERIFY(edit->hasActiveFocus()); @@ -3265,7 +3265,7 @@ void tst_qquicktextedit::openInputPanel() QQuickView view(testFileUrl("openInputPanel.qml")); view.showNormal(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); @@ -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); @@ -3663,7 +3663,7 @@ void tst_qquicktextedit::preeditCursorRectangle() QQuickView view(testFileUrl("inputMethodEvent.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); @@ -3746,7 +3746,7 @@ void tst_qquicktextedit::inputMethodComposing() QQuickView view(testFileUrl("inputContext.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); @@ -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,11 +3873,11 @@ 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(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QInputMethodQueryEvent event(Qt::ImCursorRectangle); qApp->sendEvent(textEdit, &event); @@ -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,13 +4876,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); @@ -5038,13 +5038,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); QVERIFY(!textEdit->canUndo()); @@ -5124,13 +5124,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); QVERIFY(!textEdit->canUndo()); @@ -5345,13 +5345,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); simulateKeys(&window, keys); @@ -5369,13 +5369,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); QSignalSpy spy(textEdit, SIGNAL(canUndoChanged())); @@ -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,11 +5507,11 @@ 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(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextEdit *input = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("inputField"))); QVERIFY(input->hasActiveFocus()); @@ -5530,7 +5530,7 @@ void tst_qquicktextedit::cursorRectangle_QTBUG_38947() window.show(); window.requestActivate(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickTextEdit *edit = window.rootObject()->findChild<QQuickTextEdit *>("textedit"); QVERIFY(edit); @@ -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 06b76d129c..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 @@ -750,7 +750,7 @@ void tst_qquicktextinput::persistentSelection() QQuickView window(testFileUrl("persistentSelection.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(window.rootObject()); QVERIFY(input); @@ -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))); @@ -801,7 +801,7 @@ void tst_qquicktextinput::overwriteMode() textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); @@ -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); @@ -1304,19 +1304,19 @@ void tst_qquicktextinput::dragMouseSelection() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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); @@ -1365,11 +1365,11 @@ void tst_qquicktextinput::mouseSelectionMode() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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(); @@ -1545,7 +1545,7 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft() QCOMPARE(textInput->boundingRect().left(), qreal(0)); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); // If there is no committed text, the preedit text should determine the alignment. @@ -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(); - QTest::qWaitForWindowActive(&window); + 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(); - QTest::qWaitForWindowActive(&window); + 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; ")); @@ -1957,9 +1957,9 @@ void tst_qquicktextinput::validators() QQuickView window(testFileUrl("validators.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QLocale defaultLocale; QLocale enLocale("en"); @@ -2247,12 +2247,12 @@ void tst_qquicktextinput::inputMethods() QQuickView window(testFileUrl("inputmethods.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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); @@ -2339,9 +2339,9 @@ void tst_qquicktextinput::signal_accepted() QQuickView window(testFileUrl("signal_accepted.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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); @@ -2381,9 +2381,9 @@ void tst_qquicktextinput::signal_editingfinished() QQuickView window(testFileUrl("signal_editingfinished.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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); @@ -2451,7 +2451,7 @@ void tst_qquicktextinput::signal_textEdited() QQuickWindow window; window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *input = new QQuickTextInput(window.contentItem()); QVERIFY(input); @@ -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,13 +2696,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); // copy and paste QVERIFY(textInput->hasActiveFocus()); @@ -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); @@ -2796,11 +2796,11 @@ void tst_qquicktextinput::middleClickPaste() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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(); @@ -2861,9 +2861,9 @@ void tst_qquicktextinput::cursorDelegate() QQuickView view(source); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + 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")); } @@ -2979,9 +2979,9 @@ void tst_qquicktextinput::remoteCursorDelegate() view.setSource(testFileUrl("cursorTestRemote.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + 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. @@ -3006,7 +3006,7 @@ void tst_qquicktextinput::cursorVisible() QQuickView view(testFileUrl("cursorVisible.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(input.isCursorVisible(), false); @@ -3037,13 +3037,13 @@ void tst_qquicktextinput::cursorVisible() QQuickView alternateView; alternateView.show(); alternateView.requestActivate(); - QTest::qWaitForWindowActive(&alternateView); + QVERIFY(QTest::qWaitForWindowActive(&alternateView)); QCOMPARE(input.isCursorVisible(), false); QCOMPARE(spy.count(), 6); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(input.isCursorVisible(), true); QCOMPARE(spy.count(), 7); @@ -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()); @@ -3335,13 +3335,13 @@ void tst_qquicktextinput::echoMode() QQuickView window(testFileUrl("echoMode.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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; @@ -3411,9 +3411,9 @@ void tst_qquicktextinput::passwordEchoDelay() QQuickView window(testFileUrl("echoMode.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + 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); @@ -3517,12 +3517,12 @@ void tst_qquicktextinput::focusOnPress() textInputObject->setParentItem(window.contentItem()); window.showNormal(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); 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); @@ -3575,7 +3575,7 @@ void tst_qquicktextinput::focusOnPressOnlyOneItem() QQuickView window(testFileUrl("focusOnlyOneOnPress.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *first = window.rootObject()->findChild<QQuickTextInput*>("first"); QQuickTextInput *second = window.rootObject()->findChild<QQuickTextInput*>("second"); @@ -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. @@ -3619,7 +3619,7 @@ void tst_qquicktextinput::openInputPanel() QQuickView view(testFileUrl("openInputPanel.qml")); view.showNormal(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); @@ -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; } @@ -3708,7 +3708,7 @@ void tst_qquicktextinput::setHAlignClearCache() input.setParentItem(view.contentItem()); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QTRY_COMPARE(input.nbPaint, 1); input.setHAlign(QQuickTextInput::AlignRight); //Changing the alignment should trigger a repaint @@ -3728,7 +3728,7 @@ void tst_qquicktextinput::focusOutClearSelection() input2.componentComplete(); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QVERIFY(input.hasActiveFocus()); input.select(2,5); //The selection should work @@ -3749,7 +3749,7 @@ void tst_qquicktextinput::focusOutNotClearSelection() input.componentComplete(); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QVERIFY(input.hasActiveFocus()); input.select(2,5); @@ -3842,7 +3842,7 @@ void tst_qquicktextinput::preeditAutoScroll() QQuickView view(testFileUrl("preeditAutoScroll.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); QVERIFY(input->hasActiveFocus()); @@ -3928,7 +3928,7 @@ void tst_qquicktextinput::preeditCursorRectangle() QQuickView view(testFileUrl("inputMethodEvent.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); QVERIFY(input->hasActiveFocus()); @@ -4011,7 +4011,7 @@ void tst_qquicktextinput::inputContextMouseHandler() view.showNormal(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QTextLayout layout(text); layout.setFont(input->font()); @@ -4047,7 +4047,7 @@ void tst_qquicktextinput::inputMethodComposing() QQuickView view(testFileUrl("inputContext.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); QVERIFY(input->hasActiveFocus()); @@ -4153,7 +4153,7 @@ void tst_qquicktextinput::inputMethodUpdate() QQuickView view(testFileUrl("inputContext.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); QVERIFY(input->hasActiveFocus()); @@ -4232,18 +4232,18 @@ 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(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(textInput->hasActiveFocus()); QInputMethodQueryEvent event(Qt::ImCursorRectangle); @@ -4275,7 +4275,7 @@ void tst_qquicktextinput::tripleClickSelectsAll() QQuickView view(QUrl::fromLocalFile(qmlfile)); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput* input = qobject_cast<QQuickTextInput*>(view.rootObject()); QVERIFY(input); @@ -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,14 +5264,14 @@ 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; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKey(&window, layoutDirection); @@ -5426,13 +5426,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); QVERIFY(!textInput->canUndo()); @@ -5512,13 +5512,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); QVERIFY(!textInput->canUndo()); @@ -5844,13 +5844,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKeys(&window, keys); @@ -5868,13 +5868,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); QVERIFY(!textInput->canUndo()); @@ -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()); @@ -5956,8 +5956,8 @@ void tst_qquicktextinput::QTBUG_19956() QQuickView window(testFileUrl(url)); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowActive(&window)); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput*>(window.rootObject()); QVERIFY(input); input->setFocus(true); @@ -5995,8 +5995,8 @@ void tst_qquicktextinput::QTBUG_19956_regexp() QQuickView window(url); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowActive(&window)); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput*>(window.rootObject()); QVERIFY(input); input->setFocus(true); @@ -6181,13 +6181,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKeys(&window, keys); @@ -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) { @@ -6421,7 +6421,7 @@ void tst_qquicktextinput::setInputMask() textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKey(&window, Qt::Key_Home); @@ -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,13 +6551,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKeys(&window, keys); @@ -6574,13 +6574,13 @@ 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()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); { @@ -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"); } @@ -6717,7 +6717,7 @@ void tst_qquicktextinput::fixup() QQuickWindow window; window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *input = new QQuickTextInput(window.contentItem()); input->setValidator(new TestValidator(input)); @@ -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 fe9e8bb1fa..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; } }; @@ -490,7 +490,7 @@ void tst_qquickwindow::openglContextCreatedSignal() window.setTitle(QTest::currentTestFunction()); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); if (window.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL) QSKIP("Skipping OpenGL context test due to not running with OpenGL"); @@ -506,7 +506,7 @@ void tst_qquickwindow::aboutToStopSignal() QQuickWindow window; window.setTitle(QTest::currentTestFunction()); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QSignalSpy spy(&window, SIGNAL(sceneGraphAboutToStop())); @@ -578,7 +578,7 @@ void tst_qquickwindow::constantUpdatesOnWindow() bool ok = connect(&window, signal.constData(), &window, SLOT(update()), Qt::DirectConnection); Q_ASSERT(ok); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); FrameCounter counter; connect(&window, SIGNAL(frameSwapped()), &counter, SLOT(incr()), Qt::DirectConnection); @@ -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() @@ -1395,7 +1395,7 @@ void tst_qquickwindow::defaultState() QQuickWindow cppWindow; cppWindow.show(); - QTest::qWaitForWindowExposed(&cppWindow); + QVERIFY(QTest::qWaitForWindowExposed(&cppWindow)); QCOMPARE(qmlWindow->windowState(), cppWindow.windowState()); } @@ -1602,7 +1602,7 @@ void tst_qquickwindow::noUpdateWhenNothingChanges() QQuickRectangle rect(window.contentItem()); window.showNormal(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); // Many platforms are broken in the sense that that they follow up // the initial expose with a second expose or more. Let these go // through before we let the test continue. @@ -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; @@ -1927,7 +1927,7 @@ void tst_qquickwindow::hideThenDelete() window.resize(400, 300); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); const bool threaded = QQuickWindowPrivate::get(&window)->context->thread() != QGuiApplication::instance()->thread(); const bool isGL = window.rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL; #if QT_CONFIG(opengl) @@ -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"); @@ -2077,7 +2077,7 @@ void tst_qquickwindow::testWindowVisibilityOrder() QVERIFY(window2); QVERIFY(window3); - QTest::qWaitForWindowExposed(window3); + QVERIFY(QTest::qWaitForWindowExposed(window3)); QWindowList windows = QGuiApplication::topLevelWindows(); QTRY_COMPARE(windows.size(), 5); @@ -2099,7 +2099,7 @@ void tst_qquickwindow::testWindowVisibilityOrder() window4->setVisible(true); - QTest::qWaitForWindowExposed(window5); + QVERIFY(QTest::qWaitForWindowExposed(window5)); QVERIFY(window4->isVisible()); QVERIFY(window5->isVisible()); } @@ -2113,7 +2113,7 @@ void tst_qquickwindow::blockClosing() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->isVisible()); QWindowSystemInterface::handleCloseEvent(window.data()); QVERIFY(window->isVisible()); @@ -2133,7 +2133,7 @@ void tst_qquickwindow::blockCloseMethod() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->isVisible()); QVERIFY(QMetaObject::invokeMethod(window.data(), "close", Qt::DirectConnection)); QVERIFY(window->isVisible()); @@ -2154,7 +2154,7 @@ void tst_qquickwindow::crashWhenHoverItemDeleted() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowActive(window.data()); + QVERIFY(QTest::qWaitForWindowActive(window.data())); // Simulate a move from the first rectangle to the second. Crash will happen in here // Moving instantaneously from (0, 99) to (0, 102) does not cause the crash @@ -2173,10 +2173,10 @@ void tst_qquickwindow::unloadSubWindow() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QPointer<QQuickWindow> transient; QTRY_VERIFY(transient = window->property("transientWindow").value<QQuickWindow*>()); - QTest::qWaitForWindowExposed(transient); + QVERIFY(QTest::qWaitForWindowExposed(transient)); // Unload the inner window (in nested Loaders) and make sure it doesn't crash QQuickLoader *loader = window->property("loader1").value<QQuickLoader*>(); @@ -2194,13 +2194,13 @@ void tst_qquickwindow::changeVisibilityInCompleted() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QPointer<QQuickWindow> winVisible; QTRY_VERIFY(winVisible = window->property("winVisible").value<QQuickWindow*>()); QPointer<QQuickWindow> winVisibility; QTRY_VERIFY(winVisibility = window->property("winVisibility").value<QQuickWindow*>()); - QTest::qWaitForWindowExposed(winVisible); - QTest::qWaitForWindowExposed(winVisibility); + QVERIFY(QTest::qWaitForWindowExposed(winVisible)); + QVERIFY(QTest::qWaitForWindowExposed(winVisibility)); QVERIFY(winVisible->isVisible()); QCOMPARE(winVisibility->visibility(), QWindow::Windowed); @@ -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; @@ -2795,7 +2795,7 @@ void tst_qquickwindow::test_circleMapItem() QSignalSpy topSpy(mat, SIGNAL(clicked(QQuickMouseEvent *))); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QTest::qWait(1000); QPoint pos(50, 50); @@ -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/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp index d6e1982b1e..0e06ee6f50 100644 --- a/tests/auto/quick/rendernode/tst_rendernode.cpp +++ b/tests/auto/quick/rendernode/tst_rendernode.cpp @@ -120,7 +120,7 @@ private: class MessUpNode : public QSGRenderNode, protected QOpenGLFunctions { public: - MessUpNode() : initialized(false) { } + MessUpNode() {} StateFlags changedStates() const override { @@ -157,7 +157,7 @@ public: glBindFramebuffer(GL_FRAMEBUFFER, fbo); } - bool initialized; + bool initialized = false; }; class MessUpItem : public QQuickItem diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index d8d9cd26e0..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 @@ -269,7 +269,7 @@ void tst_SceneGraph::manyWindows() } for (int i=0; i<COUNT; ++i) { QQuickView *view = views.at(i); - QTest::qWaitForWindowExposed(view); + QVERIFY(QTest::qWaitForWindowExposed(view)); QImage content = view->grabWindow(); if (i == 0) { baseLine = content; @@ -282,7 +282,7 @@ void tst_SceneGraph::manyWindows() // Wipe and recreate one (scope pointer delets it...) delete views.takeLast(); QQuickView *last = createView(file, parent.data(), 100, 100, 100, 100); - QTest::qWaitForWindowExposed(last); + QVERIFY(QTest::qWaitForWindowExposed(last)); views << last; QVERIFY(compareImages(baseLine, last->grabWindow())); @@ -295,7 +295,7 @@ void tst_SceneGraph::manyWindows() } for (int i=0; i<COUNT; ++i) { QQuickView *view = views.at(i); - QTest::qWaitForWindowExposed(view); + QVERIFY(QTest::qWaitForWindowExposed(view)); QImage content = view->grabWindow(); QVERIFY(compareImages(content, baseLine)); } @@ -548,7 +548,7 @@ void tst_SceneGraph::createTextureFromImage() QQuickView view; view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(view.isSceneGraphInitialized()); QScopedPointer<QSGTexture> texture(view.createTextureFromImage(image, (QQuickWindow::CreateTextureOptions) flags)); 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..a79ff4e78f 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -86,8 +86,8 @@ Q_SIGNALS: void onTouchEvent(QQuickItem *receiver); public: - EventItem(QQuickItem *parent = 0) - : QQuickItem(parent), touchUngrabCount(0), acceptMouse(false), acceptTouch(false), filterTouch(false), point0(-1) + EventItem(QQuickItem *parent = nullptr) + : QQuickItem(parent) { setAcceptedMouseButtons(Qt::LeftButton); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) @@ -140,10 +140,10 @@ public: } QList<Event> eventList; - int touchUngrabCount; - bool acceptMouse; - bool acceptTouch; - bool filterTouch; // when used as event filter + int touchUngrabCount = 0; + bool acceptMouse = false; + bool acceptTouch = false; + bool filterTouch = false; // when used as event filter bool eventFilter(QObject *, QEvent *event) { @@ -162,7 +162,7 @@ public: } return false; } - int point0; + int point0 = -1; }; class tst_TouchMouse : public QQmlDataTest @@ -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 f54da7819c..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()); @@ -73,8 +73,8 @@ void tst_SignalSpy::testCount() window.resize(200, 200); window.setSource(testFileUrl("signalspy.qml")); window.show(); - QTest::qWaitForWindowActive(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowActive(&window)); + 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()); diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index c8858a44ae..6cf6ad3b2c 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -71,8 +71,8 @@ #define FILE_OPEN_EVENT_WAIT_TIME 3000 // ms -static Config *conf = 0; -static QQmlApplicationEngine *qae = 0; +static Config *conf = nullptr; +static QQmlApplicationEngine *qae = nullptr; #if defined(Q_OS_DARWIN) || defined(QT_GUI_LIB) static int exitTimerId = -1; #endif @@ -438,7 +438,7 @@ static void loadDummyDataFiles(QQmlEngine &engine, const QString& directory) int main(int argc, char *argv[]) { getAppFlags(argc, argv); - QCoreApplication *app = 0; + QCoreApplication *app = nullptr; switch (applicationType) { case QmlApplicationTypeCore: app = new QCoreApplication(argc, argv); diff --git a/tools/qmlcachegen/generateloader.cpp b/tools/qmlcachegen/generateloader.cpp index 083af29a2d..1a0b987c64 100644 --- a/tools/qmlcachegen/generateloader.cpp +++ b/tools/qmlcachegen/generateloader.cpp @@ -58,12 +58,10 @@ struct VirtualDirectoryEntry { QString name; QVector<VirtualDirectoryEntry*> dirEntries; - int firstChildIndex; // node index inside generated data - bool isDirectory; + int firstChildIndex = -1; // node index inside generated data + bool isDirectory = true; VirtualDirectoryEntry() - : firstChildIndex(-1) - , isDirectory(true) {} ~VirtualDirectoryEntry() @@ -98,7 +96,7 @@ struct VirtualDirectoryEntry struct DataStream { - DataStream(QVector<unsigned char > *data = 0) + DataStream(QVector<unsigned char > *data = nullptr) : data(data) {} diff --git a/tools/qmlcachegen/qmlcachegen.cpp b/tools/qmlcachegen/qmlcachegen.cpp index 1751ba2ecf..9c97ef7694 100644 --- a/tools/qmlcachegen/qmlcachegen.cpp +++ b/tools/qmlcachegen/qmlcachegen.cpp @@ -197,7 +197,7 @@ static bool compileQmlFile(const QString &inputFileName, SaveFunction saveFuncti QmlIR::JSCodeGen v4CodeGen(irDocument.code, &irDocument.jsGenerator, &irDocument.jsModule, &irDocument.jsParserEngine, irDocument.program, - /*import cache*/0, &irDocument.jsGenerator.stringTable, illegalNames); + /*import cache*/nullptr, &irDocument.jsGenerator.stringTable, illegalNames); v4CodeGen.setUseFastLookups(false); // Disable lookups in non-standalone (aka QML) mode for (QmlIR::Object *object: qAsConst(irDocument.objects)) { if (object->functionsAndExpressions->count == 0) @@ -298,7 +298,7 @@ static bool compileJSFile(const QString &inputFileName, const QString &inputFile { QmlIR::JSCodeGen v4CodeGen(irDocument.code, &irDocument.jsGenerator, &irDocument.jsModule, &irDocument.jsParserEngine, - irDocument.program, /*import cache*/0, + irDocument.program, /*import cache*/nullptr, &irDocument.jsGenerator.stringTable, illegalNames); v4CodeGen.setUseFastLookups(false); // Disable lookups in non-standalone (aka QML) mode v4CodeGen.generateFromProgram(inputFileName, inputFileUrl, sourceCode, program, diff --git a/tools/qmleasing/segmentproperties.cpp b/tools/qmleasing/segmentproperties.cpp index 01123d3e97..f37527f863 100644 --- a/tools/qmleasing/segmentproperties.cpp +++ b/tools/qmleasing/segmentproperties.cpp @@ -30,7 +30,7 @@ #include "splineeditor.h" SegmentProperties::SegmentProperties(QWidget *parent) : - QWidget(parent), m_splineEditor(0), m_blockSignals(false) + QWidget(parent), m_splineEditor(nullptr), m_blockSignals(false) { QVBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); diff --git a/tools/qmleasing/splineeditor.cpp b/tools/qmleasing/splineeditor.cpp index af5c519b04..2a6081903f 100644 --- a/tools/qmleasing/splineeditor.cpp +++ b/tools/qmleasing/splineeditor.cpp @@ -42,7 +42,7 @@ const int canvasHeight = 320; const int canvasMargin = 160; SplineEditor::SplineEditor(QWidget *parent) : - QWidget(parent), m_pointListWidget(0), m_block(false) + QWidget(parent), m_pointListWidget(nullptr), m_block(false) { setFixedSize(canvasWidth + canvasMargin * 2, canvasHeight + canvasMargin * 2); diff --git a/tools/qmlimportscanner/main.cpp b/tools/qmlimportscanner/main.cpp index d596613553..5bd66243e6 100644 --- a/tools/qmlimportscanner/main.cpp +++ b/tools/qmlimportscanner/main.cpp @@ -509,7 +509,7 @@ int main(int argc, char *argv[]) while (i < args.count()) { const QString &arg = args.at(i); ++i; - QStringList *argReceiver = 0; + QStringList *argReceiver = nullptr; if (!arg.startsWith(QLatin1Char('-')) || arg == QLatin1String("-")) { qmlRootPaths += arg; } else if (arg == QLatin1String("-rootPath")) { diff --git a/tools/qmlplugindump/main.cpp b/tools/qmlplugindump/main.cpp index 422e37fd89..5c5a6a8eb1 100644 --- a/tools/qmlplugindump/main.cpp +++ b/tools/qmlplugindump/main.cpp @@ -300,7 +300,7 @@ QSet<const QMetaObject *> collectReachableMetaObjects(QQmlEngine *engine, continue; inObjectInstantiation = tyName; - QObject *object = 0; + QObject *object = nullptr; if (ty.isSingleton()) { QQmlType::SingletonInstanceInfo *siinfo = ty.singletonInstanceInfo(); @@ -403,7 +403,7 @@ public: return exportString; } - void writeMetaContent(const QMetaObject *meta, KnownAttributes *knownAttributes = 0) + void writeMetaContent(const QMetaObject *meta, KnownAttributes *knownAttributes = nullptr) { QSet<QString> implicitSignals; for (int index = meta->propertyOffset(); index < meta->propertyCount(); ++index) { @@ -642,7 +642,7 @@ private: qml->writeScriptBinding(QLatin1String("isPointer"), QLatin1String("true")); } - void dump(const QMetaProperty &prop, KnownAttributes *knownAttributes = 0) + void dump(const QMetaProperty &prop, KnownAttributes *knownAttributes = nullptr) { int revision = prop.revision(); QByteArray propName = prop.name(); @@ -658,7 +658,7 @@ private: } void dump(const QMetaMethod &meth, const QSet<QString> &implicitSignals, - KnownAttributes *knownAttributes = 0) + KnownAttributes *knownAttributes = nullptr) { if (meth.methodType() == QMetaMethod::Signal) { if (meth.access() != QMetaMethod::Public) @@ -973,7 +973,7 @@ int main(int argc, char *argv[]) sigAction.sa_handler = &sigSegvHandler; sigAction.sa_flags = 0; - sigaction(SIGSEGV, &sigAction, 0); + sigaction(SIGSEGV, &sigAction, nullptr); #endif #ifdef QT_SIMULATOR diff --git a/tools/qmlprofiler/qmlprofilerapplication.cpp b/tools/qmlprofiler/qmlprofilerapplication.cpp index fd65e1599a..64cd4ec87f 100644 --- a/tools/qmlprofiler/qmlprofilerapplication.cpp +++ b/tools/qmlprofiler/qmlprofilerapplication.cpp @@ -76,7 +76,7 @@ Q_STATIC_ASSERT(sizeof(features) == QmlProfilerApplication::QmlProfilerApplication(int &argc, char **argv) : QCoreApplication(argc, argv), m_runMode(LaunchMode), - m_process(0), + m_process(nullptr), m_hostName(QLatin1String("127.0.0.1")), m_port(0), m_pendingRequest(REQUEST_NONE), diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp index fc8b9c5292..bc7fe72d4c 100644 --- a/tools/qmlscene/main.cpp +++ b/tools/qmlscene/main.cpp @@ -145,21 +145,7 @@ struct Options }; Options() - : originalQml(false) - , originalQmlRaster(false) - , maximized(false) - , fullscreen(false) - , transparent(false) - , clip(false) - , versionDetection(true) - , slowAnimations(false) - , quitImmediately(false) - , resizeViewToRootItem(false) - , multisample(false) - , coreProfile(false) - , verbose(false) - , applicationType(DefaultQmlApplicationType) - , textRenderType(QQuickWindow::textRenderType()) + : textRenderType(QQuickWindow::textRenderType()) { // QtWebEngine needs a shared context in order for the GPU thread to // upload textures. @@ -167,22 +153,22 @@ struct Options } QUrl url; - bool originalQml; - bool originalQmlRaster; - bool maximized; - bool fullscreen; - bool transparent; - bool clip; - bool versionDetection; - bool slowAnimations; - bool quitImmediately; - bool resizeViewToRootItem; - bool multisample; - bool coreProfile; - bool verbose; + bool originalQml = false; + bool originalQmlRaster = false; + bool maximized = false; + bool fullscreen = false; + bool transparent = false; + bool clip = false; + bool versionDetection = true; + bool slowAnimations = false; + bool quitImmediately = false; + bool resizeViewToRootItem = false; + bool multisample = false; + bool coreProfile = false; + bool verbose = false; QVector<Qt::ApplicationAttribute> applicationAttributes; QString translationFile; - QmlApplicationType applicationType; + QmlApplicationType applicationType = DefaultQmlApplicationType; QQuickWindow::TextRenderType textRenderType; }; @@ -310,7 +296,7 @@ static void displayFileDialog(Options *options) { #if defined(QT_WIDGETS_LIB) && QT_CONFIG(filedialog) if (options->applicationType == Options::QmlApplicationTypeWidget) { - QString fileName = QFileDialog::getOpenFileName(0, "Open QML file", QString(), "QML Files (*.qml)"); + QString fileName = QFileDialog::getOpenFileName(nullptr, "Open QML file", QString(), "QML Files (*.qml)"); if (!fileName.isEmpty()) { QFileInfo fi(fileName); options->url = QUrl::fromLocalFile(fi.canonicalFilePath()); @@ -640,7 +626,7 @@ int main(int argc, char ** argv) } else { QQuickItem *contentItem = qobject_cast<QQuickItem *>(topLevel); if (contentItem) { - QQuickView* qxView = new QQuickView(&engine, NULL); + QQuickView* qxView = new QQuickView(&engine, nullptr); window.reset(qxView); // Set window default properties; the qml can still override them if (options.resizeViewToRootItem) diff --git a/tools/qmltime/qmltime.cpp b/tools/qmltime/qmltime.cpp index b337ccac5c..b897d304fc 100644 --- a/tools/qmltime/qmltime.cpp +++ b/tools/qmltime/qmltime.cpp @@ -66,10 +66,10 @@ private: }; QML_DECLARE_TYPE(Timer); -Timer *Timer::m_timer = 0; +Timer *Timer::m_timer = nullptr; Timer::Timer() - : m_component(0) + : m_component(nullptr) , m_willparent(false) , m_item(new QQuickItem) { |