From 499ec43937e926e4f2fa57a9baa455fcb3862262 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 21 Feb 2018 10:41:54 +0100 Subject: use nullptr consistently (clang-tidy) From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann --- src/qml/types/qqmlbind.cpp | 4 +- src/qml/types/qqmlbind_p.h | 2 +- src/qml/types/qqmlconnections.cpp | 6 +- src/qml/types/qqmlconnections_p.h | 2 +- src/qml/types/qqmldelegatemodel.cpp | 118 ++++++++++++++--------------- src/qml/types/qqmldelegatemodel_p.h | 8 +- src/qml/types/qqmldelegatemodel_p_p.h | 8 +- src/qml/types/qqmlinstantiator.cpp | 14 ++-- src/qml/types/qqmlinstantiator_p.h | 2 +- src/qml/types/qqmllistmodel.cpp | 102 ++++++++++++------------- src/qml/types/qqmllistmodel_p.h | 4 +- src/qml/types/qqmllistmodelworkeragent.cpp | 2 +- src/qml/types/qqmllistmodelworkeragent_p.h | 2 +- src/qml/types/qqmlobjectmodel.cpp | 4 +- src/qml/types/qqmlobjectmodel_p.h | 4 +- src/qml/types/qqmltimer_p.h | 2 +- src/qml/types/qquickpackage.cpp | 2 +- src/qml/types/qquickpackage_p.h | 2 +- src/qml/types/qquickworkerscript.cpp | 16 ++-- src/qml/types/qquickworkerscript_p.h | 4 +- 20 files changed, 154 insertions(+), 154 deletions(-) (limited to 'src/qml/types') diff --git a/src/qml/types/qqmlbind.cpp b/src/qml/types/qqmlbind.cpp index 91c5a50877..513f7f2997 100644 --- a/src/qml/types/qqmlbind.cpp +++ b/src/qml/types/qqmlbind.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE class QQmlBindPrivate : public QObjectPrivate { public: - QQmlBindPrivate() : obj(0), componentComplete(true), delayed(false), pendingEval(false) {} + QQmlBindPrivate() : obj(nullptr), componentComplete(true), delayed(false), pendingEval(false) {} ~QQmlBindPrivate() { } QQmlNullableValue when; @@ -370,7 +370,7 @@ void QQmlBind::eval() //restore any previous binding if (d->prevBind) { QQmlAbstractBinding::Ptr p = d->prevBind; - d->prevBind = 0; + d->prevBind = nullptr; QQmlPropertyPrivate::setBinding(p.data()); } return; diff --git a/src/qml/types/qqmlbind_p.h b/src/qml/types/qqmlbind_p.h index c9dd14b58a..5bf9ef85c6 100644 --- a/src/qml/types/qqmlbind_p.h +++ b/src/qml/types/qqmlbind_p.h @@ -71,7 +71,7 @@ class Q_AUTOTEST_EXPORT QQmlBind : public QObject, public QQmlPropertyValueSourc Q_PROPERTY(bool delayed READ delayed WRITE setDelayed REVISION 8) public: - QQmlBind(QObject *parent=0); + QQmlBind(QObject *parent=nullptr); ~QQmlBind(); bool when() const; diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp index e218cdcfe4..a43562a7b8 100644 --- a/src/qml/types/qqmlconnections.cpp +++ b/src/qml/types/qqmlconnections.cpp @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE class QQmlConnectionsPrivate : public QObjectPrivate { public: - QQmlConnectionsPrivate() : target(0), enabled(true), targetSet(false), ignoreUnknownSignals(false), componentcomplete(true) {} + QQmlConnectionsPrivate() : target(nullptr), enabled(true), targetSet(false), ignoreUnknownSignals(false), componentcomplete(true) {} QList boundsignals; QObject *target; @@ -274,7 +274,7 @@ void QQmlConnections::connectSignals() return; QObject *target = this->target(); QQmlData *ddata = QQmlData::get(this); - QQmlContextData *ctxtdata = ddata ? ddata->outerContext : 0; + QQmlContextData *ctxtdata = ddata ? ddata->outerContext : nullptr; const QV4::CompiledData::Unit *qmlUnit = d->compilationUnit->data; for (const QV4::CompiledData::Binding *binding : qAsConst(d->bindings)) { @@ -290,7 +290,7 @@ void QQmlConnections::connectSignals() QQmlBoundSignalExpression *expression = ctxtdata ? new QQmlBoundSignalExpression(target, signalIndex, - ctxtdata, this, d->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]) : 0; + ctxtdata, this, d->compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex]) : nullptr; signal->takeExpression(expression); d->boundsignals += signal; } else { diff --git a/src/qml/types/qqmlconnections_p.h b/src/qml/types/qqmlconnections_p.h index 580b6522de..50e2c59ac3 100644 --- a/src/qml/types/qqmlconnections_p.h +++ b/src/qml/types/qqmlconnections_p.h @@ -73,7 +73,7 @@ class Q_AUTOTEST_EXPORT QQmlConnections : public QObject, public QQmlParserStatu Q_PROPERTY(bool ignoreUnknownSignals READ ignoreUnknownSignals WRITE setIgnoreUnknownSignals) public: - QQmlConnections(QObject *parent=0); + QQmlConnections(QObject *parent=nullptr); ~QQmlConnections(); QObject *target() const; diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index ca19d68948..44166e4aa8 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -200,10 +200,10 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) */ QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt) - : m_delegate(0) - , m_cacheMetaType(0) + : m_delegate(nullptr) + , m_cacheMetaType(nullptr) , m_context(ctxt) - , m_parts(0) + , m_parts(nullptr) , m_filterGroup(QStringLiteral("items")) , m_count(0) , m_groupCount(Compositor::MinimumGroupCount) @@ -214,9 +214,9 @@ QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt) , m_transaction(false) , m_incubatorCleanupScheduled(false) , m_waitingToFetchMore(false) - , m_cacheItems(0) - , m_items(0) - , m_persistedItems(0) + , m_cacheItems(nullptr) + , m_items(nullptr) + , m_persistedItems(nullptr) { } @@ -268,10 +268,10 @@ QQmlDelegateModel::~QQmlDelegateModel() if (cacheItem->object) { delete cacheItem->object; - cacheItem->object = 0; + cacheItem->object = nullptr; cacheItem->contextData->invalidate(); Q_ASSERT(cacheItem->contextData->refCount == 1); - cacheItem->contextData = 0; + cacheItem->contextData = nullptr; cacheItem->scriptRef -= 1; } cacheItem->groups &= ~Compositor::UnresolvedFlag; @@ -279,7 +279,7 @@ QQmlDelegateModel::~QQmlDelegateModel() if (!cacheItem->isReferenced()) delete cacheItem; else if (cacheItem->incubationTask) - cacheItem->incubationTask->vdm = 0; + cacheItem->incubationTask->vdm = nullptr; } } @@ -408,7 +408,7 @@ void QQmlDelegateModel::setDelegate(QQmlComponent *delegate) qmlWarning(this) << tr("The delegate of a DelegateModel cannot be changed within onUpdated."); return; } - bool wasValid = d->m_delegate != 0; + bool wasValid = d->m_delegate != nullptr; d->m_delegate = delegate; d->m_delegateValidated = false; if (wasValid && d->m_complete) { @@ -536,7 +536,7 @@ int QQmlDelegateModel::count() const QQmlDelegateModel::ReleaseFlags QQmlDelegateModelPrivate::release(QObject *object) { - QQmlDelegateModel::ReleaseFlags stat = 0; + QQmlDelegateModel::ReleaseFlags stat = nullptr; if (!object) return stat; @@ -546,7 +546,7 @@ QQmlDelegateModel::ReleaseFlags QQmlDelegateModelPrivate::release(QObject *objec emitDestroyingItem(object); if (cacheItem->incubationTask) { releaseIncubator(cacheItem->incubationTask); - cacheItem->incubationTask = 0; + cacheItem->incubationTask = nullptr; } cacheItem->Dispose(); stat |= QQmlInstanceModel::Destroyed; @@ -582,7 +582,7 @@ void QQmlDelegateModel::cancel(int index) if (cacheItem) { if (cacheItem->incubationTask && !cacheItem->isObjectReferenced()) { d->releaseIncubator(cacheItem->incubationTask); - cacheItem->incubationTask = 0; + cacheItem->incubationTask = nullptr; if (cacheItem->object) { QObject *object = cacheItem->object; @@ -631,7 +631,7 @@ QQmlDelegateModelGroup *QQmlDelegateModelPrivate::group_at( QQmlDelegateModelPrivate *d = static_cast(property->data); return index >= 0 && index < d->m_groupCount - 1 ? d->m_groups[index + 1] - : 0; + : nullptr; } /*! @@ -661,7 +661,7 @@ QQmlListProperty QQmlDelegateModel::groups() QQmlDelegateModelPrivate::group_append, QQmlDelegateModelPrivate::group_count, QQmlDelegateModelPrivate::group_at, - 0); + nullptr); } /*! @@ -839,11 +839,11 @@ void QQDMIncubationTask::statusChanged(Status status) Q_ASSERT(incubating); // The model was deleted from under our feet, cleanup ourselves delete incubating->object; - incubating->object = 0; + incubating->object = nullptr; if (incubating->contextData) { incubating->contextData->invalidate(); Q_ASSERT(incubating->contextData->refCount == 1); - incubating->contextData = 0; + incubating->contextData = nullptr; } incubating->scriptRef = 0; incubating->deleteLater(); @@ -879,8 +879,8 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba return; QQmlDelegateModelItem *cacheItem = incubationTask->incubating; - cacheItem->incubationTask = 0; - incubationTask->incubating = 0; + cacheItem->incubationTask = nullptr; + incubationTask->incubating = nullptr; releaseIncubator(incubationTask); if (status == QQmlIncubator::Ready) { @@ -900,13 +900,13 @@ void QQmlDelegateModelPrivate::incubatorStatusChanged(QQDMIncubationTask *incuba else emitDestroyingItem(cacheItem->object); delete cacheItem->object; - cacheItem->object = 0; + cacheItem->object = nullptr; cacheItem->scriptRef -= 1; if (cacheItem->contextData) { cacheItem->contextData->invalidate(); Q_ASSERT(cacheItem->contextData->refCount == 1); } - cacheItem->contextData = 0; + cacheItem->contextData = nullptr; if (!cacheItem->isReferenced()) { removeCacheItem(cacheItem); @@ -935,9 +935,9 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ { if (!m_delegate || index < 0 || index >= m_compositor.count(group)) { qWarning() << "DelegateModel::item: index out range" << index << m_compositor.count(group); - return 0; + return nullptr; } else if (!m_context || !m_context->isValid()) { - return 0; + return nullptr; } Compositor::iterator it = m_compositor.find(group, index); @@ -947,7 +947,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ if (!cacheItem) { cacheItem = m_adaptorModel.createItem(m_cacheMetaType, it.modelIndex()); if (!cacheItem) - return 0; + return nullptr; cacheItem->groups = it->flags; @@ -1016,7 +1016,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, QQ delete cacheItem; } - return 0; + return nullptr; } /* @@ -1032,7 +1032,7 @@ QObject *QQmlDelegateModel::object(int index, QQmlIncubator::IncubationMode incu Q_D(QQmlDelegateModel); if (!d->m_delegate || index < 0 || index >= d->m_compositor.count(d->m_compositorGroup)) { qWarning() << "DelegateModel::item: index out range" << index << d->m_compositor.count(d->m_compositorGroup); - return 0; + return nullptr; } return d->object(d->m_compositorGroup, index, incubationMode); @@ -1347,7 +1347,7 @@ void QQmlDelegateModelPrivate::itemsRemoved( if (QQDMIncubationTask *incubationTask = cacheItem->incubationTask) { if (!cacheItem->isObjectReferenced()) { releaseIncubator(cacheItem->incubationTask); - cacheItem->incubationTask = 0; + cacheItem->incubationTask = nullptr; if (cacheItem->object) { QObject *object = cacheItem->object; cacheItem->destroyObject(); @@ -1668,7 +1668,7 @@ bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const // Must be before the new object is inserted into the cache or its indexes will be adjusted too. itemsInserted(QVector(1, Compositor::Insert(before, 1, cacheItem->groups & ~Compositor::CacheFlag))); - before = m_compositor.insert(before, 0, 0, 1, cacheItem->groups); + before = m_compositor.insert(before, nullptr, 0, 1, cacheItem->groups); m_cache.insert(before.cacheIndex, cacheItem); return true; @@ -1681,7 +1681,7 @@ QQmlDelegateModelItemMetaType::QQmlDelegateModelItemMetaType( : model(model) , groupCount(groupNames.count() + 1) , v4Engine(engine) - , metaObject(0) + , metaObject(nullptr) , groupNames(groupNames) { } @@ -1724,7 +1724,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() QV4::Scope scope(v4Engine); QV4::ScopedObject proto(scope, v4Engine->newObject()); - proto->defineAccessorProperty(QStringLiteral("model"), QQmlDelegateModelItem::get_model, 0); + proto->defineAccessorProperty(QStringLiteral("model"), QQmlDelegateModelItem::get_model, nullptr); proto->defineAccessorProperty(QStringLiteral("groups"), QQmlDelegateModelItem::get_groups, QQmlDelegateModelItem::set_groups); QV4::ScopedString s(scope); QV4::ScopedProperty p(scope); @@ -1733,7 +1733,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() QV4::ScopedFunctionObject f(scope); QV4::ExecutionContext *global = scope.engine->rootContext(); p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, 30, QQmlDelegateModelItem::get_member))); - p->setSetter(0); + p->setSetter(nullptr); proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); s = v4Engine->newString(QStringLiteral("inItems")); @@ -1752,7 +1752,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() s = v4Engine->newString(QStringLiteral("persistedItemsIndex")); p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, QQmlListCompositor::Persisted, QQmlDelegateModelItem::get_index))); - p->setSetter(0); + p->setSetter(nullptr); proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); for (int i = 2; i < groupNames.count(); ++i) { @@ -1767,7 +1767,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() const QString propertyName = groupNames.at(i) + QLatin1String("Index"); s = v4Engine->newString(propertyName); p->setGetter((f = QV4::DelegateModelGroupFunction::create(global, i + 1, QQmlDelegateModelItem::get_index))); - p->setSetter(0); + p->setSetter(nullptr); proto->insertMember(s, p, QV4::Attr_Accessor|QV4::Attr_NotConfigurable|QV4::Attr_NotEnumerable); } modelItemProto.set(v4Engine, proto); @@ -1909,10 +1909,10 @@ QQmlDelegateModelItem::QQmlDelegateModelItem( QQmlDelegateModelItemMetaType *metaType, int modelIndex) : v4(metaType->v4Engine) , metaType(metaType) - , contextData(0) - , object(0) - , attached(0) - , incubationTask(0) + , contextData(nullptr) + , object(nullptr) + , attached(nullptr) + , incubationTask(nullptr) , objectRef(0) , scriptRef(0) , groups(0) @@ -1962,39 +1962,39 @@ void QQmlDelegateModelItem::destroyObject() data->ownContext->clearContext(); if (data->ownContext->contextObject == object) data->ownContext->contextObject = nullptr; - data->ownContext = 0; - data->context = 0; + data->ownContext = nullptr; + data->context = nullptr; } object->deleteLater(); if (attached) { - attached->m_cacheItem = 0; - attached = 0; + attached->m_cacheItem = nullptr; + attached = nullptr; } contextData->invalidate(); - contextData = 0; - object = 0; + contextData = nullptr; + object = nullptr; } QQmlDelegateModelItem *QQmlDelegateModelItem::dataForObject(QObject *object) { QQmlData *d = QQmlData::get(object); - QQmlContextData *context = d ? d->context : 0; - for (context = context ? context->parent : 0; context; context = context->parent) { + QQmlContextData *context = d ? d->context : nullptr; + for (context = context ? context->parent : nullptr; context; context = context->parent) { if (QQmlDelegateModelItem *cacheItem = qobject_cast( context->contextObject)) { return cacheItem; } } - return 0; + return nullptr; } int QQmlDelegateModelItem::groupIndex(Compositor::Group group) { if (QQmlDelegateModelPrivate * const model = metaType->model ? QQmlDelegateModelPrivate::get(metaType->model) - : 0) { + : nullptr) { return model->m_compositor.find(Compositor::Cache, model->m_cache.indexOf(this)).index[group]; } return -1; @@ -2067,7 +2067,7 @@ int QQmlDelegateModelAttachedMetaObject::metaCall(QObject *object, QMetaObject:: } QQmlDelegateModelAttached::QQmlDelegateModelAttached(QObject *parent) - : m_cacheItem(0) + : m_cacheItem(nullptr) , m_previousGroups(0) { QQml_setParent_noEvent(this, parent); @@ -2107,7 +2107,7 @@ QQmlDelegateModelAttached::QQmlDelegateModelAttached( QQmlDelegateModel *QQmlDelegateModelAttached::model() const { - return m_cacheItem ? m_cacheItem->metaType->model : 0; + return m_cacheItem ? m_cacheItem->metaType->model : nullptr; } /*! @@ -2219,11 +2219,11 @@ void QQmlDelegateModelAttached::emitChanges() const QMetaObject *meta = metaObject(); for (int i = 1; i < m_cacheItem->metaType->groupCount; ++i, ++notifierId) { if (groupChanges & (1 << i)) - QMetaObject::activate(this, meta, notifierId, 0); + QMetaObject::activate(this, meta, notifierId, nullptr); } for (int i = 1; i < m_cacheItem->metaType->groupCount; ++i, ++notifierId) { if (indexChanges & (1 << i)) - QMetaObject::activate(this, meta, notifierId, 0); + QMetaObject::activate(this, meta, notifierId, nullptr); } if (groupChanges) @@ -2508,7 +2508,7 @@ bool QQmlDelegateModelGroupPrivate::parseIndex(const QV4::Value &value, int *ind QQmlDelegateModelItem * const cacheItem = object->d()->item; if (QQmlDelegateModelPrivate *model = cacheItem->metaType->model ? QQmlDelegateModelPrivate::get(cacheItem->metaType->model) - : 0) { + : nullptr) { *index = model->m_cache.indexOf(cacheItem); *group = Compositor::Cache; return true; @@ -3133,7 +3133,7 @@ QObject *QQmlPartsModel::object(int index, QQmlIncubator::IncubationMode incubat if (!model->m_delegate || index < 0 || index >= model->m_compositor.count(m_compositorGroup)) { qWarning() << "DelegateModel::item: index out range" << index << model->m_compositor.count(m_compositorGroup); - return 0; + return nullptr; } QObject *object = model->object(m_compositorGroup, index, incubationMode); @@ -3141,7 +3141,7 @@ QObject *QQmlPartsModel::object(int index, QQmlIncubator::IncubationMode incubat if (QQuickPackage *package = qmlobject_cast(object)) { QObject *part = package->part(m_part); if (!part) - return 0; + return nullptr; m_packaged.insertMulti(part, package); return part; } @@ -3153,12 +3153,12 @@ QObject *QQmlPartsModel::object(int index, QQmlIncubator::IncubationMode incubat model->m_delegateValidated = true; } - return 0; + return nullptr; } QQmlInstanceModel::ReleaseFlags QQmlPartsModel::release(QObject *item) { - QQmlInstanceModel::ReleaseFlags flags = 0; + QQmlInstanceModel::ReleaseFlags flags = nullptr; QHash::iterator it = m_packaged.find(item); if (it != m_packaged.end()) { @@ -3336,9 +3336,9 @@ QQmlDelegateModelEngineData::QQmlDelegateModelEngineData(QV4::ExecutionEngine *v QV4::Scope scope(v4); QV4::ScopedObject proto(scope, v4->newObject()); - proto->defineAccessorProperty(QStringLiteral("index"), QQmlDelegateModelGroupChange::method_get_index, 0); - proto->defineAccessorProperty(QStringLiteral("count"), QQmlDelegateModelGroupChange::method_get_count, 0); - proto->defineAccessorProperty(QStringLiteral("moveId"), QQmlDelegateModelGroupChange::method_get_moveId, 0); + proto->defineAccessorProperty(QStringLiteral("index"), QQmlDelegateModelGroupChange::method_get_index, nullptr); + proto->defineAccessorProperty(QStringLiteral("count"), QQmlDelegateModelGroupChange::method_get_count, nullptr); + proto->defineAccessorProperty(QStringLiteral("moveId"), QQmlDelegateModelGroupChange::method_get_moveId, nullptr); changeProto.set(v4, proto); } diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h index 71179fd8be..b894df8f82 100644 --- a/src/qml/types/qqmldelegatemodel_p.h +++ b/src/qml/types/qqmldelegatemodel_p.h @@ -90,7 +90,7 @@ class Q_QML_PRIVATE_EXPORT QQmlDelegateModel : public QQmlInstanceModel, public Q_INTERFACES(QQmlParserStatus) public: QQmlDelegateModel(); - QQmlDelegateModel(QQmlContext *, QObject *parent=0); + QQmlDelegateModel(QQmlContext *, QObject *parent=nullptr); ~QQmlDelegateModel(); void classBegin() override; @@ -109,7 +109,7 @@ public: Q_INVOKABLE QVariant parentModelIndex() const; int count() const override; - bool isValid() const override { return delegate() != 0; } + bool isValid() const override { return delegate() != nullptr; } QObject *object(int index, QQmlIncubator::IncubationMode incubationMode = QQmlIncubator::AsynchronousIfNested) override; ReleaseFlags release(QObject *object) override; void cancel(int index) override; @@ -164,8 +164,8 @@ class Q_QML_PRIVATE_EXPORT QQmlDelegateModelGroup : public QObject Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(bool includeByDefault READ defaultInclude WRITE setDefaultInclude NOTIFY defaultIncludeChanged) public: - QQmlDelegateModelGroup(QObject *parent = 0); - QQmlDelegateModelGroup(const QString &name, QQmlDelegateModel *model, int compositorType, QObject *parent = 0); + QQmlDelegateModelGroup(QObject *parent = nullptr); + QQmlDelegateModelGroup(const QString &name, QQmlDelegateModel *model, int compositorType, QObject *parent = nullptr); ~QQmlDelegateModelGroup(); QString name() const; diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index 7b60bcddc0..68b987a5fa 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -182,7 +182,7 @@ class QQDMIncubationTask : public QQmlIncubator public: QQDMIncubationTask(QQmlDelegateModelPrivate *l, IncubationMode mode) : QQmlIncubator(mode) - , incubating(0) + , incubating(nullptr) , vdm(l) {} void statusChanged(Status) override; @@ -278,12 +278,12 @@ public: void itemsInserted( const QVector &inserts, QVarLengthArray, Compositor::MaximumGroupCount> *translatedInserts, - QHash > *movedItems = 0); + QHash > *movedItems = nullptr); void itemsInserted(const QVector &inserts); void itemsRemoved( const QVector &removes, QVarLengthArray, Compositor::MaximumGroupCount> *translatedRemoves, - QHash > *movedItems = 0); + QHash > *movedItems = nullptr); void itemsRemoved(const QVector &removes); void itemsMoved( const QVector &removes, const QVector &inserts); @@ -341,7 +341,7 @@ class QQmlPartsModel : public QQmlInstanceModel, public QQmlDelegateModelGroupEm Q_OBJECT Q_PROPERTY(QString filterOnGroup READ filterGroup WRITE setFilterGroup NOTIFY filterGroupChanged RESET resetFilterGroup) public: - QQmlPartsModel(QQmlDelegateModel *model, const QString &part, QObject *parent = 0); + QQmlPartsModel(QQmlDelegateModel *model, const QString &part, QObject *parent = nullptr); ~QQmlPartsModel(); QString filterGroup() const; diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp index 6e2b66aea7..213bef7879 100644 --- a/src/qml/types/qqmlinstantiator.cpp +++ b/src/qml/types/qqmlinstantiator.cpp @@ -56,8 +56,8 @@ QQmlInstantiatorPrivate::QQmlInstantiatorPrivate() , ownModel(false) , requestedIndex(-1) , model(QVariant(1)) - , instanceModel(0) - , delegate(0) + , instanceModel(nullptr) + , delegate(nullptr) { } @@ -183,7 +183,7 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo objects = objects.mid(0, index) + movedObjects + objects.mid(index); } else { if (insert.index <= objects.size()) - objects.insert(insert.index, insert.count, 0); + objects.insert(insert.index, insert.count, nullptr); for (int i = 0; i < insert.count; ++i) { int modelIndex = index + i; QObject* obj = modelObject(modelIndex, async); @@ -396,11 +396,11 @@ void QQmlInstantiator::setModel(const QVariant &v) QQmlInstanceModel *prevModel = d->instanceModel; QObject *object = qvariant_cast(v); - QQmlInstanceModel *vim = 0; + QQmlInstanceModel *vim = nullptr; if (object && (vim = qobject_cast(object))) { if (d->ownModel) { delete d->instanceModel; - prevModel = 0; + prevModel = nullptr; d->ownModel = false; } d->instanceModel = vim; @@ -444,7 +444,7 @@ QObject *QQmlInstantiator::object() const Q_D(const QQmlInstantiator); if (d->objects.count()) return d->objects[0]; - return 0; + return nullptr; } /*! @@ -457,7 +457,7 @@ QObject *QQmlInstantiator::objectAt(int index) const Q_D(const QQmlInstantiator); if (index >= 0 && index < d->objects.count()) return d->objects[index]; - return 0; + return nullptr; } /*! diff --git a/src/qml/types/qqmlinstantiator_p.h b/src/qml/types/qqmlinstantiator_p.h index ee18daa48c..5727c4d1e1 100644 --- a/src/qml/types/qqmlinstantiator_p.h +++ b/src/qml/types/qqmlinstantiator_p.h @@ -71,7 +71,7 @@ class Q_AUTOTEST_EXPORT QQmlInstantiator : public QObject, public QQmlParserStat Q_CLASSINFO("DefaultProperty", "delegate") public: - QQmlInstantiator(QObject *parent = 0); + QQmlInstantiator(QObject *parent = nullptr); ~QQmlInstantiator(); bool isActive() const; diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 784368c504..d4fc02cd3e 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -100,7 +100,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(const QString &key, Role::Da if (node) { const Role &r = *node->value; if (type != r.type) - qmlWarning(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type)); + qmlWarning(nullptr) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type)); return r; } @@ -113,7 +113,7 @@ const ListLayout::Role &ListLayout::getRoleOrCreate(QV4::String *key, Role::Data if (node) { const Role &r = *node->value; if (type != r.type) - qmlWarning(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type)); + qmlWarning(nullptr) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(r.name).arg(roleTypeName(type)).arg(roleTypeName(r.type)); return r; } @@ -134,7 +134,7 @@ const ListLayout::Role &ListLayout::createRole(const QString &key, ListLayout::R if (type == Role::List) { r->subLayout = new ListLayout; } else { - r->subLayout = 0; + r->subLayout = nullptr; } int dataSize = dataSizes[type]; @@ -203,7 +203,7 @@ ListLayout::Role::Role(const Role *other) if (other->subLayout) subLayout = new ListLayout(other->subLayout); else - subLayout = 0; + subLayout = nullptr; } ListLayout::Role::~Role() @@ -236,8 +236,8 @@ const ListLayout::Role *ListLayout::getRoleOrCreate(const QString &key, const QV } if (type == Role::Invalid) { - qmlWarning(0) << "Can't create role for unsupported data type"; - return 0; + qmlWarning(nullptr) << "Can't create role for unsupported data type"; + return nullptr; } return &getRoleOrCreate(key, type); @@ -245,7 +245,7 @@ const ListLayout::Role *ListLayout::getRoleOrCreate(const QString &key, const QV const ListLayout::Role *ListLayout::getExistingRole(const QString &key) const { - Role *r = 0; + Role *r = nullptr; QStringHash::Node *node = roleHash.findNode(key); if (node) r = node->value; @@ -254,7 +254,7 @@ const ListLayout::Role *ListLayout::getExistingRole(const QString &key) const const ListLayout::Role *ListLayout::getExistingRole(QV4::String *key) const { - Role *r = 0; + Role *r = nullptr; QStringHash::Node *node = roleHash.findNode(key); if (node) r = node->value; @@ -264,7 +264,7 @@ const ListLayout::Role *ListLayout::getExistingRole(QV4::String *key) const QObject *ListModel::getOrCreateModelObject(QQmlListModel *model, int elementIndex) { ListElement *e = elements[elementIndex]; - if (e->m_objectCache == 0) { + if (e->m_objectCache == nullptr) { void *memory = operator new(sizeof(QObject) + sizeof(QQmlData)); void *ddataMemory = ((char *)memory) + sizeof(QObject); e->m_objectCache = new (memory) QObject; @@ -404,10 +404,10 @@ void ListModel::destroy() for (const auto &destroyer : remove(0, elements.count())) destroyer(); - m_layout = 0; + m_layout = nullptr; if (m_modelCache && m_modelCache->m_primary == false) delete m_modelCache; - m_modelCache = 0; + m_modelCache = nullptr; } int ListModel::appendElement() @@ -508,7 +508,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QVector *roles) roleIndex = e->setDoubleProperty(r, propertyValue->asDouble()); } else if (QV4::ArrayObject *a = propertyValue->as()) { const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::List); - ListModel *subModel = new ListModel(r.subLayout, 0); + ListModel *subModel = new ListModel(r.subLayout, nullptr); int arrayLength = a->getLength(); for (int j=0 ; j < arrayLength ; ++j) { @@ -589,7 +589,7 @@ void ListModel::set(int elementIndex, QV4::Object *object) } else if (QV4::ArrayObject *a = propertyValue->as()) { const ListLayout::Role &r = m_layout->getRoleOrCreate(propertyName, ListLayout::Role::List); if (r.type == ListLayout::Role::List) { - ListModel *subModel = new ListModel(r.subLayout, 0); + ListModel *subModel = new ListModel(r.subLayout, nullptr); int arrayLength = a->getLength(); for (int j=0 ; j < arrayLength ; ++j) { @@ -698,7 +698,7 @@ inline char *ListElement::getPropertyMemory(const ListLayout::Role &role) ListElement *e = this; int blockIndex = 0; while (blockIndex < role.blockIndex) { - if (e->next == 0) { + if (e->next == nullptr) { e->next = new ListElement; e->next->uid = uid; } @@ -713,7 +713,7 @@ inline char *ListElement::getPropertyMemory(const ListLayout::Role &role) ModelNodeMetaObject *ListElement::objectCache() { if (!m_objectCache) - return 0; + return nullptr; return ModelNodeMetaObject::get(m_objectCache); } @@ -721,7 +721,7 @@ QString *ListElement::getStringProperty(const ListLayout::Role &role) { char *mem = getPropertyMemory(role); QString *s = reinterpret_cast(mem); - return s->data_ptr() ? s : 0; + return s->data_ptr() ? s : nullptr; } QObject *ListElement::getQObjectProperty(const ListLayout::Role &role) @@ -733,7 +733,7 @@ QObject *ListElement::getQObjectProperty(const ListLayout::Role &role) QVariantMap *ListElement::getVariantMapProperty(const ListLayout::Role &role) { - QVariantMap *map = 0; + QVariantMap *map = nullptr; char *mem = getPropertyMemory(role); if (isMemoryUsed(mem)) @@ -744,7 +744,7 @@ QVariantMap *ListElement::getVariantMapProperty(const ListLayout::Role &role) QDateTime *ListElement::getDateTimeProperty(const ListLayout::Role &role) { - QDateTime *dt = 0; + QDateTime *dt = nullptr; char *mem = getPropertyMemory(role); if (isMemoryUsed(mem)) @@ -755,7 +755,7 @@ QDateTime *ListElement::getDateTimeProperty(const ListLayout::Role &role) QJSValue *ListElement::getFunctionProperty(const ListLayout::Role &role) { - QJSValue *f = 0; + QJSValue *f = nullptr; char *mem = getPropertyMemory(role); if (isMemoryUsed(mem)) @@ -776,7 +776,7 @@ QPointer *ListElement::getGuardProperty(const ListLayout::Role &role) } } - QPointer *o = 0; + QPointer *o = nullptr; if (existingGuard) o = reinterpret_cast *>(mem); @@ -807,7 +807,7 @@ QVariant ListElement::getProperty(const ListLayout::Role &role, const QQmlListMo case ListLayout::Role::String: { QString *value = reinterpret_cast(mem); - if (value->data_ptr() != 0) + if (value->data_ptr() != nullptr) data = *value; } break; @@ -823,7 +823,7 @@ QVariant ListElement::getProperty(const ListLayout::Role &role, const QQmlListMo ListModel *model = *value; if (model) { - if (model->m_modelCache == 0) { + if (model->m_modelCache == nullptr) { model->m_modelCache = new QQmlListModel(owner, model, eng); QQmlEngine::setContextForObject(model->m_modelCache, QQmlEngine::contextForObject(owner)); } @@ -880,7 +880,7 @@ int ListElement::setStringProperty(const ListLayout::Role &role, const QString & char *mem = getPropertyMemory(role); QString *c = reinterpret_cast(mem); bool changed; - if (c->data_ptr() == 0) { + if (c->data_ptr() == nullptr) { new (mem) QString(s); changed = true; } else { @@ -1114,16 +1114,16 @@ void ListElement::clearProperty(const ListLayout::Role &role) setBoolProperty(role, false); break; case ListLayout::Role::List: - setListProperty(role, 0); + setListProperty(role, nullptr); break; case ListLayout::Role::QObject: - setQObjectProperty(role, 0); + setQObjectProperty(role, nullptr); break; case ListLayout::Role::DateTime: setDateTimeProperty(role, QDateTime()); break; case ListLayout::Role::VariantMap: - setVariantMapProperty(role, (QVariantMap *)0); + setVariantMapProperty(role, (QVariantMap *)nullptr); break; case ListLayout::Role::Function: setFunctionProperty(role, QJSValue()); @@ -1135,17 +1135,17 @@ void ListElement::clearProperty(const ListLayout::Role &role) ListElement::ListElement() { - m_objectCache = 0; + m_objectCache = nullptr; uid = uidCounter.fetchAndAddOrdered(1); - next = 0; + next = nullptr; memset(data, 0, sizeof(data)); } ListElement::ListElement(int existingUid) { - m_objectCache = 0; + m_objectCache = nullptr; uid = existingUid; - next = 0; + next = nullptr; memset(data, 0, sizeof(data)); } @@ -1169,8 +1169,8 @@ QVector ListElement::sync(ListElement *src, ListLayout *srcLayout, ListElem ListModel *targetSubModel = target->getListProperty(targetRole); if (srcSubModel) { - if (targetSubModel == 0) { - targetSubModel = new ListModel(targetRole.subLayout, 0); + if (targetSubModel == nullptr) { + targetSubModel = new ListModel(targetRole.subLayout, nullptr); target->setListPropertyFast(targetRole, targetSubModel); } if (ListModel::sync(srcSubModel, targetSubModel)) @@ -1190,7 +1190,7 @@ QVector ListElement::sync(ListElement *src, ListLayout *srcLayout, ListElem case ListLayout::Role::DateTime: case ListLayout::Role::Function: { - QVariant v = src->getProperty(srcRole, 0, 0); + QVariant v = src->getProperty(srcRole, nullptr, nullptr); roleIndex = target->setVariantProperty(targetRole, v); } break; @@ -1271,7 +1271,7 @@ void ListElement::destroy(ListLayout *layout) } if (next) - next->destroy(0); + next->destroy(nullptr); uid = -1; } @@ -1329,7 +1329,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::Value &d QV4::Scope scope(a->engine()); QV4::ScopedObject o(scope); - ListModel *subModel = new ListModel(role.subLayout, 0); + ListModel *subModel = new ListModel(role.subLayout, nullptr); int arrayLength = a->getLength(); for (int j=0 ; j < arrayLength ; ++j) { o = a->getIndexed(j); @@ -1337,7 +1337,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::Value &d } roleIndex = setListProperty(role, subModel); } else { - qmlWarning(0) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List)); + qmlWarning(nullptr) << QStringLiteral("Can't assign to existing role '%1' of different type [%2 -> %3]").arg(role.name).arg(roleTypeName(role.type)).arg(roleTypeName(ListLayout::Role::List)); } } else if (d.isBoolean()) { roleIndex = setBoolProperty(role, d.booleanValue()); @@ -1516,7 +1516,7 @@ void ModelObject::advanceIterator(Managed *m, ObjectIterator *it, Value *name, u { ModelObject *that = static_cast(m); ExecutionEngine *v4 = that->engine(); - name->setM(0); + name->setM(nullptr); *index = UINT_MAX; if (it->arrayIndex < uint(that->d()->m_model->m_listModel->roleCount())) { Scope scope(that->engine()); @@ -1564,7 +1564,7 @@ QVector DynamicRoleModelNode::sync(DynamicRoleModelNode *src, DynamicRoleMo bool modelHasChanges = false; if (srcModel) { - if (targetModel == 0) + if (targetModel == nullptr) targetModel = QQmlListModel::createWithOwner(target->m_owner); modelHasChanges = QQmlListModel::sync(srcModel, targetModel); @@ -1787,13 +1787,13 @@ QQmlListModel::QQmlListModel(QObject *parent) { m_mainThread = true; m_primary = true; - m_agent = 0; + m_agent = nullptr; m_dynamicRoles = false; m_layout = new ListLayout; m_listModel = new ListModel(m_layout, this); - m_engine = 0; + m_engine = nullptr; } QQmlListModel::QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::ExecutionEngine *engine, QObject *parent) @@ -1805,7 +1805,7 @@ QQmlListModel::QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::E Q_ASSERT(owner->m_dynamicRoles == false); m_dynamicRoles = false; - m_layout = 0; + m_layout = nullptr; m_listModel = data; m_engine = engine; @@ -1827,7 +1827,7 @@ QQmlListModel::QQmlListModel(QQmlListModel *orig, QQmlListModelWorkerAgent *agen else ListModel::sync(orig->m_listModel, m_listModel); - m_engine = 0; + m_engine = nullptr; } QQmlListModel::~QQmlListModel() @@ -1844,10 +1844,10 @@ QQmlListModel::~QQmlListModel() } } - m_listModel = 0; + m_listModel = nullptr; delete m_layout; - m_layout = 0; + m_layout = nullptr; } QQmlListModel *QQmlListModel::createWithOwner(QQmlListModel *newOwner) @@ -1869,7 +1869,7 @@ QQmlListModel *QQmlListModel::createWithOwner(QQmlListModel *newOwner) QV4::ExecutionEngine *QQmlListModel::engine() const { - if (m_engine == 0) { + if (m_engine == nullptr) { m_engine = qmlEngine(this)->handle(); } @@ -1939,7 +1939,7 @@ bool QQmlListModel::sync(QQmlListModel *src, QQmlListModel *target) ElementSync &s = elementHash.find(element->getUid()).value(); Q_ASSERT(s.srcIndex >= 0); DynamicRoleModelNode *targetElement = s.target; - if (targetElement == 0) { + if (targetElement == nullptr) { targetElement = new DynamicRoleModelNode(target, element->getUid()); } s.changedRoles = DynamicRoleModelNode::sync(element, targetElement); @@ -2111,7 +2111,7 @@ QHash QQmlListModel::roleNames() const */ void QQmlListModel::setDynamicRoles(bool enableDynamicRoles) { - if (m_mainThread && m_agent == 0) { + if (m_mainThread && m_agent == nullptr) { if (enableDynamicRoles) { if (m_layout->roleCount()) qmlWarning(this) << tr("unable to enable dynamic roles as this model is not empty"); @@ -2605,15 +2605,15 @@ bool QQmlListModelParser::applyProperty(QV4::CompiledData::CompilationUnit *comp const quint32 targetObjectIndex = binding->value.objectIndex; const QV4::CompiledData::Object *target = qmlUnit->objectAt(targetObjectIndex); - ListModel *subModel = 0; + ListModel *subModel = nullptr; if (outterElementIndex == -1) { subModel = model; } else { const ListLayout::Role &role = model->getOrCreateListRole(elementName); if (role.type == ListLayout::Role::List) { subModel = model->getListProperty(outterElementIndex, role); - if (subModel == 0) { - subModel = new ListModel(role.subLayout, 0); + if (subModel == nullptr) { + subModel = new ListModel(role.subLayout, nullptr); QVariant vModel = QVariant::fromValue(subModel); model->setOrCreateProperty(outterElementIndex, elementName, vModel); } @@ -2640,7 +2640,7 @@ bool QQmlListModelParser::applyProperty(QV4::CompiledData::CompilationUnit *comp QString scriptStr = binding->valueAsScriptString(qmlUnit); if (definesEmptyList(scriptStr)) { const ListLayout::Role &role = model->getOrCreateListRole(elementName); - ListModel *emptyModel = new ListModel(role.subLayout, 0); + ListModel *emptyModel = new ListModel(role.subLayout, nullptr); value = QVariant::fromValue(emptyModel); } else if (binding->isFunctionExpression()) { QQmlBinding::Identifier id = binding->value.compiledScriptIndex; diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h index cbb12caa20..0c0859dc80 100644 --- a/src/qml/types/qqmllistmodel_p.h +++ b/src/qml/types/qqmllistmodel_p.h @@ -82,7 +82,7 @@ class Q_QML_PRIVATE_EXPORT QQmlListModel : public QAbstractListModel Q_PROPERTY(bool dynamicRoles READ dynamicRoles WRITE setDynamicRoles) public: - QQmlListModel(QObject *parent=0); + QQmlListModel(QObject *parent=nullptr); ~QQmlListModel(); QModelIndex index(int row, int column, const QModelIndex &parent) const override; @@ -125,7 +125,7 @@ private: // Constructs a flat list model for a worker agent QQmlListModel(QQmlListModel *orig, QQmlListModelWorkerAgent *agent); - QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::ExecutionEngine *engine, QObject *parent=0); + QQmlListModel(const QQmlListModel *owner, ListModel *data, QV4::ExecutionEngine *engine, QObject *parent=nullptr); QV4::ExecutionEngine *engine() const; diff --git a/src/qml/types/qqmllistmodelworkeragent.cpp b/src/qml/types/qqmllistmodelworkeragent.cpp index a2750c926a..fe3eaa3198 100644 --- a/src/qml/types/qqmllistmodelworkeragent.cpp +++ b/src/qml/types/qqmllistmodelworkeragent.cpp @@ -86,7 +86,7 @@ void QQmlListModelWorkerAgent::release() void QQmlListModelWorkerAgent::modelDestroyed() { - m_orig = 0; + m_orig = nullptr; } int QQmlListModelWorkerAgent::count() const diff --git a/src/qml/types/qqmllistmodelworkeragent_p.h b/src/qml/types/qqmllistmodelworkeragent_p.h index 761a467e89..2120f25744 100644 --- a/src/qml/types/qqmllistmodelworkeragent_p.h +++ b/src/qml/types/qqmllistmodelworkeragent_p.h @@ -91,7 +91,7 @@ public: struct VariantRef { - VariantRef() : a(0) {} + VariantRef() : a(nullptr) {} VariantRef(const VariantRef &r) : a(r.a) { if (a) a->addref(); } VariantRef(QQmlListModelWorkerAgent *_a) : a(_a) { if (a) a->addref(); } ~VariantRef() { if (a) a->release(); } diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp index 54da0867d4..08740b4a6f 100644 --- a/src/qml/types/qqmlobjectmodel.cpp +++ b/src/qml/types/qqmlobjectmodel.cpp @@ -287,7 +287,7 @@ QQmlInstanceModel::ReleaseFlags QQmlObjectModel::release(QObject *item) if (!d->children[idx].deref()) return QQmlInstanceModel::Referenced; } - return 0; + return nullptr; } QString QQmlObjectModel::stringValue(int index, const QString &name) @@ -337,7 +337,7 @@ QObject *QQmlObjectModel::get(int index) const { Q_D(const QQmlObjectModel); if (index < 0 || index >= d->children.count()) - return 0; + return nullptr; return d->children.at(index).item; } diff --git a/src/qml/types/qqmlobjectmodel_p.h b/src/qml/types/qqmlobjectmodel_p.h index b3cf45ca62..267828dcdd 100644 --- a/src/qml/types/qqmlobjectmodel_p.h +++ b/src/qml/types/qqmlobjectmodel_p.h @@ -92,7 +92,7 @@ Q_SIGNALS: void destroyingItem(QObject *object); protected: - QQmlInstanceModel(QObjectPrivate &dd, QObject *parent = 0) + QQmlInstanceModel(QObjectPrivate &dd, QObject *parent = nullptr) : QObject(dd, parent) {} private: @@ -110,7 +110,7 @@ class Q_QML_PRIVATE_EXPORT QQmlObjectModel : public QQmlInstanceModel Q_CLASSINFO("DefaultProperty", "children") public: - QQmlObjectModel(QObject *parent=0); + QQmlObjectModel(QObject *parent=nullptr); ~QQmlObjectModel() {} int count() const override; diff --git a/src/qml/types/qqmltimer_p.h b/src/qml/types/qqmltimer_p.h index 7739dad2a6..d597869994 100644 --- a/src/qml/types/qqmltimer_p.h +++ b/src/qml/types/qqmltimer_p.h @@ -72,7 +72,7 @@ class Q_QML_PRIVATE_EXPORT QQmlTimer : public QObject, public QQmlParserStatus Q_PROPERTY(QObject *parent READ parent CONSTANT) public: - QQmlTimer(QObject *parent=0); + QQmlTimer(QObject *parent=nullptr); void setInterval(int interval); int interval() const; diff --git a/src/qml/types/qquickpackage.cpp b/src/qml/types/qquickpackage.cpp index e0d1888f33..e8e897bab9 100644 --- a/src/qml/types/qquickpackage.cpp +++ b/src/qml/types/qquickpackage.cpp @@ -183,7 +183,7 @@ QObject *QQuickPackage::part(const QString &name) if (name == QLatin1String("default") && !d->dataList.isEmpty()) return d->dataList.at(0); - return 0; + return nullptr; } QQuickPackageAttached *QQuickPackage::qmlAttachedProperties(QObject *o) diff --git a/src/qml/types/qquickpackage_p.h b/src/qml/types/qquickpackage_p.h index ca383bfdcb..122c7fcb30 100644 --- a/src/qml/types/qquickpackage_p.h +++ b/src/qml/types/qquickpackage_p.h @@ -66,7 +66,7 @@ class Q_AUTOTEST_EXPORT QQuickPackage : public QObject Q_PROPERTY(QQmlListProperty data READ data) public: - QQuickPackage(QObject *parent=0); + QQuickPackage(QObject *parent=nullptr); virtual ~QQuickPackage(); QQmlListProperty data(); diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index 32c0c86ff6..80c2d3a4bc 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -203,7 +203,7 @@ private: QQuickWorkerScriptEnginePrivate::WorkerEngine::WorkerEngine(QQuickWorkerScriptEnginePrivate *parent) : QV8Engine(nullptr, new QV4::ExecutionEngine), p(parent) #if QT_CONFIG(qml_network) -, accessManager(0) +, accessManager(nullptr) #endif { m_v4Engine->v8Engine = this; @@ -290,7 +290,7 @@ QNetworkAccessManager *QQuickWorkerScriptEnginePrivate::WorkerEngine::networkAcc #endif QQuickWorkerScriptEnginePrivate::QQuickWorkerScriptEnginePrivate(QQmlEngine *engine) -: workerEngine(0), qmlengine(engine), m_nextId(0) +: workerEngine(nullptr), qmlengine(engine), m_nextId(0) { } @@ -507,7 +507,7 @@ QQuickWorkerScriptEngine::~QQuickWorkerScriptEngine() } QQuickWorkerScriptEnginePrivate::WorkerScript::WorkerScript() -: id(-1), initialized(false), owner(0) +: id(-1), initialized(false), owner(nullptr) { } @@ -534,7 +534,7 @@ void QQuickWorkerScriptEngine::removeWorkerScript(int id) { QQuickWorkerScriptEnginePrivate::WorkerScript* script = d->workers.value(id); if (script) { - script->owner = 0; + script->owner = nullptr; QCoreApplication::postEvent(d, new WorkerRemoveEvent(id)); } } @@ -565,7 +565,7 @@ void QQuickWorkerScriptEngine::run() qDeleteAll(d->workers); d->workers.clear(); - delete d->workerEngine; d->workerEngine = 0; + delete d->workerEngine; d->workerEngine = nullptr; } @@ -616,7 +616,7 @@ void QQuickWorkerScriptEngine::run() {Threaded ListModel Example} */ QQuickWorkerScript::QQuickWorkerScript(QObject *parent) -: QObject(parent), m_engine(0), m_scriptId(-1), m_componentComplete(true) +: QObject(parent), m_engine(nullptr), m_scriptId(-1), m_componentComplete(true) { } @@ -696,7 +696,7 @@ QQuickWorkerScriptEngine *QQuickWorkerScript::engine() QQmlEngine *engine = qmlEngine(this); if (!engine) { qWarning("QQuickWorkerScript: engine() called without qmlEngine() set"); - return 0; + return nullptr; } m_engine = QQmlEnginePrivate::get(engine)->getWorkerScriptEngine(); @@ -707,7 +707,7 @@ QQuickWorkerScriptEngine *QQuickWorkerScript::engine() return m_engine; } - return 0; + return nullptr; } void QQuickWorkerScript::componentComplete() diff --git a/src/qml/types/qquickworkerscript_p.h b/src/qml/types/qquickworkerscript_p.h index 8ea630c685..1a8d2ab076 100644 --- a/src/qml/types/qquickworkerscript_p.h +++ b/src/qml/types/qquickworkerscript_p.h @@ -67,7 +67,7 @@ class QQuickWorkerScriptEngine : public QThread { Q_OBJECT public: - QQuickWorkerScriptEngine(QQmlEngine *parent = 0); + QQuickWorkerScriptEngine(QQmlEngine *parent = nullptr); ~QQuickWorkerScriptEngine(); int registerWorkerScript(QQuickWorkerScript *); @@ -91,7 +91,7 @@ class Q_AUTOTEST_EXPORT QQuickWorkerScript : public QObject, public QQmlParserSt Q_INTERFACES(QQmlParserStatus) public: - QQuickWorkerScript(QObject *parent = 0); + QQuickWorkerScript(QObject *parent = nullptr); ~QQuickWorkerScript(); QUrl source() const; -- cgit v1.2.3