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 /src/quick/items | |
parent | 41edb3bd9f373a865d5698ac8c18bf341071eae9 (diff) | |
parent | e41d067227eb6225b05df88ab724708588fa5304 (diff) |
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
Diffstat (limited to 'src/quick/items')
104 files changed, 742 insertions, 750 deletions
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 |