From 4e1512baf6d1220c9e89c8a36f16de400bb1b519 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 5 Dec 2017 10:45:14 +0100 Subject: Convert more builtin functions to use the new calling convention Convert most of the methods used QML objects to the new calling convention. Converted IndexedBuiltinFunction to do the same. Change-Id: I41b26042c2f56f24988485b06e8ccd214e2573c0 Reviewed-by: Simon Hausmann --- src/qml/util/qqmladaptormodel.cpp | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/qml/util') diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index d5b38f6d3e..7afafec1fe 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -61,10 +61,10 @@ public: V4_DEFINE_EXTENSION(QQmlAdaptorModelEngineData, engineData) -static QV4::ReturnedValue get_index(const QV4::BuiltinFunction *f, QV4::CallData *callData) +static QV4::ReturnedValue get_index(const QV4::FunctionObject *f, const QV4::Value *thisObject, const QV4::Value *, int) { QV4::Scope scope(f); - QV4::Scoped o(scope, callData->thisObject.as()); + QV4::Scoped o(scope, thisObject->as()); if (!o) RETURN_RESULT(scope.engine->throwTypeError(QStringLiteral("Not a valid VisualData object"))); @@ -106,8 +106,8 @@ public: void setValue(const QString &role, const QVariant &value) override; bool resolveIndex(const QQmlAdaptorModel &model, int idx) override; - static QV4::ReturnedValue get_property(const QV4::BuiltinFunction *, QV4::CallData *); - static QV4::ReturnedValue set_property(const QV4::BuiltinFunction *, QV4::CallData *); + static QV4::ReturnedValue get_property(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc); + static QV4::ReturnedValue set_property(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc); VDMModelDelegateDataType *type; QVector cachedData; @@ -195,10 +195,10 @@ public: dataType->watchedRoles += newRoles; } - static QV4::ReturnedValue get_hasModelChildren(const QV4::BuiltinFunction *b, QV4::CallData *callData) + static QV4::ReturnedValue get_hasModelChildren(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) { QV4::Scope scope(b); - QV4::Scoped o(scope, callData->thisObject.as()); + QV4::Scoped o(scope, thisObject->as()); if (!o) RETURN_RESULT(scope.engine->throwTypeError(QStringLiteral("Not a valid VisualData object"))); @@ -343,10 +343,10 @@ bool QQmlDMCachedModelData::resolveIndex(const QQmlAdaptorModel &, int idx) } } -QV4::ReturnedValue QQmlDMCachedModelData::get_property(const QV4::BuiltinFunction *b, QV4::CallData *callData) +QV4::ReturnedValue QQmlDMCachedModelData::get_property(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) { QV4::Scope scope(b); - QV4::Scoped o(scope, callData->thisObject.as()); + QV4::Scoped o(scope, thisObject->as()); if (!o) return scope.engine->throwTypeError(QStringLiteral("Not a valid VisualData object")); @@ -365,13 +365,13 @@ QV4::ReturnedValue QQmlDMCachedModelData::get_property(const QV4::BuiltinFunctio return QV4::Encode::undefined(); } -QV4::ReturnedValue QQmlDMCachedModelData::set_property(const QV4::BuiltinFunction *b, QV4::CallData *callData) +QV4::ReturnedValue QQmlDMCachedModelData::set_property(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) { QV4::Scope scope(b); - QV4::Scoped o(scope, callData->thisObject.as()); + QV4::Scoped o(scope, thisObject->as()); if (!o) return scope.engine->throwTypeError(QStringLiteral("Not a valid VisualData object")); - if (!callData->argc()) + if (!argc) return scope.engine->throwTypeError(); uint propertyId = static_cast(b)->d()->index; @@ -380,10 +380,10 @@ QV4::ReturnedValue QQmlDMCachedModelData::set_property(const QV4::BuiltinFunctio QQmlDMCachedModelData *modelData = static_cast(o->d()->item); if (!modelData->cachedData.isEmpty()) { if (modelData->cachedData.count() > 1) { - modelData->cachedData[propertyId] = scope.engine->toVariant(callData->args[0], QVariant::Invalid); + modelData->cachedData[propertyId] = scope.engine->toVariant(argv[0], QVariant::Invalid); QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, 0); } else if (modelData->cachedData.count() == 1) { - modelData->cachedData[0] = scope.engine->toVariant(callData->args[0], QVariant::Invalid); + modelData->cachedData[0] = scope.engine->toVariant(argv[0], QVariant::Invalid); QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, 0); QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, 0); } @@ -586,26 +586,26 @@ public: } } - static QV4::ReturnedValue get_modelData(const QV4::BuiltinFunction *b, QV4::CallData *callData) + static QV4::ReturnedValue get_modelData(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *, int) { QV4::ExecutionEngine *v4 = b->engine(); - QQmlDelegateModelItemObject *o = callData->thisObject.as(); + const QQmlDelegateModelItemObject *o = thisObject->as(); if (!o) return v4->throwTypeError(QStringLiteral("Not a valid VisualData object")); return v4->fromVariant(static_cast(o->d()->item)->cachedData); } - static QV4::ReturnedValue set_modelData(const QV4::BuiltinFunction *b, QV4::CallData *callData) + static QV4::ReturnedValue set_modelData(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc) { QV4::ExecutionEngine *v4 = b->engine(); - QQmlDelegateModelItemObject *o = callData->thisObject.as(); + const QQmlDelegateModelItemObject *o = thisObject->as(); if (!o) return v4->throwTypeError(QStringLiteral("Not a valid VisualData object")); - if (!callData->argc()) + if (!argc) return v4->throwTypeError(); - static_cast(o->d()->item)->setModelData(v4->toVariant(callData->args[0], QVariant::Invalid)); + static_cast(o->d()->item)->setModelData(v4->toVariant(argv[0], QVariant::Invalid)); return QV4::Encode::undefined(); } -- cgit v1.2.3 From 47cd9da96371ccd495f6caabe1c6853258210ebb Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 5 Feb 2018 11:21:32 +0100 Subject: doc: Fix qdoc warnings for templates and statics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Several \fn commands needed template parameters added, and several static functions that were not accessible were documented but should not have been documented. The template texts were added and the qdoc comments of the static functions were changed to non-qdoc comments. Change-Id: Icc44e243fbec2023865f47b7c73dc15d241d5b4d Reviewed-by: Topi Reiniƶ --- src/qml/util/qqmlpropertymap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/util') diff --git a/src/qml/util/qqmlpropertymap.cpp b/src/qml/util/qqmlpropertymap.cpp index b54e8d901a..578c05086f 100644 --- a/src/qml/util/qqmlpropertymap.cpp +++ b/src/qml/util/qqmlpropertymap.cpp @@ -355,7 +355,7 @@ QQmlPropertyMap::QQmlPropertyMap(const QMetaObject *staticMetaObject, QObject *p */ /*! - \fn QQmlPropertyMap::QQmlPropertyMap(DerivedType *derived, QObject *parent) + \fn template QQmlPropertyMap::QQmlPropertyMap(DerivedType *derived, QObject *parent) Constructs a bindable map with parent object \a parent. Use this constructor in classes derived from QQmlPropertyMap. -- cgit v1.2.3 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/util/qqmladaptormodel.cpp | 40 ++++++++++++++++++------------------- src/qml/util/qqmladaptormodel_p.h | 4 ++-- src/qml/util/qqmlchangeset.cpp | 2 +- src/qml/util/qqmlchangeset_p.h | 2 +- src/qml/util/qqmllistaccessor.cpp | 2 +- src/qml/util/qqmllistaccessor_p.h | 2 +- src/qml/util/qqmllistcompositor.cpp | 2 +- src/qml/util/qqmllistcompositor_p.h | 36 ++++++++++++++++----------------- 8 files changed, 45 insertions(+), 45 deletions(-) (limited to 'src/qml/util') diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index 7afafec1fe..b4bebb9d5d 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -121,8 +121,8 @@ class VDMModelDelegateDataType public: VDMModelDelegateDataType(QQmlAdaptorModel *model) : model(model) - , metaObject(0) - , propertyCache(0) + , metaObject(nullptr) + , propertyCache(nullptr) , propertyOffset(0) , signalOffset(0) , hasModelData(false) @@ -176,7 +176,7 @@ public: const int idx = item->modelIndex(); if (idx >= index && idx < index + count) { for (int i = 0; i < signalIndexes.count(); ++i) - QMetaObject::activate(item, signalIndexes.at(i), 0); + QMetaObject::activate(item, signalIndexes.at(i), nullptr); } } return changed; @@ -217,8 +217,8 @@ public: QV4::ExecutionEngine *v4 = data->v4; QV4::Scope scope(v4); QV4::ScopedObject proto(scope, v4->newObject()); - proto->defineAccessorProperty(QStringLiteral("index"), get_index, 0); - proto->defineAccessorProperty(QStringLiteral("hasModelChildren"), get_hasModelChildren, 0); + proto->defineAccessorProperty(QStringLiteral("index"), get_index, nullptr); + proto->defineAccessorProperty(QStringLiteral("hasModelChildren"), get_hasModelChildren, nullptr); QV4::ScopedProperty p(scope); typedef QHash::const_iterator iterator; @@ -298,11 +298,11 @@ int QQmlDMCachedModelData::metaCall(QMetaObject::Call call, int id, void **argum const QMetaObject *meta = metaObject(); if (cachedData.count() > 1) { cachedData[propertyIndex] = *static_cast(arguments[0]); - QMetaObject::activate(this, meta, propertyIndex, 0); + QMetaObject::activate(this, meta, propertyIndex, nullptr); } else if (cachedData.count() == 1) { cachedData[0] = *static_cast(arguments[0]); - QMetaObject::activate(this, meta, 0, 0); - QMetaObject::activate(this, meta, 1, 0); + QMetaObject::activate(this, meta, 0, nullptr); + QMetaObject::activate(this, meta, 1, nullptr); } } else if (*type->model) { setValue(type->propertyRoles.at(propertyIndex), *static_cast(arguments[0])); @@ -336,7 +336,7 @@ bool QQmlDMCachedModelData::resolveIndex(const QQmlAdaptorModel &, int idx) const QMetaObject *meta = metaObject(); const int propertyCount = type->propertyRoles.count(); for (int i = 0; i < propertyCount; ++i) - QMetaObject::activate(this, meta, i, 0); + QMetaObject::activate(this, meta, i, nullptr); return true; } else { return false; @@ -381,11 +381,11 @@ QV4::ReturnedValue QQmlDMCachedModelData::set_property(const QV4::FunctionObject if (!modelData->cachedData.isEmpty()) { if (modelData->cachedData.count() > 1) { modelData->cachedData[propertyId] = scope.engine->toVariant(argv[0], QVariant::Invalid); - QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, 0); + QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), propertyId, nullptr); } else if (modelData->cachedData.count() == 1) { modelData->cachedData[0] = scope.engine->toVariant(argv[0], QVariant::Invalid); - QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, 0); - QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, 0); + QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 0, nullptr); + QMetaObject::activate(o->d()->item, o->d()->item->metaObject(), 1, nullptr); } } } @@ -710,7 +710,7 @@ public: QMetaObjectBuilder builder; VDMObjectDelegateDataType() - : metaObject(0) + : metaObject(nullptr) , propertyOffset(0) , signalOffset(0) , shared(true) @@ -720,7 +720,7 @@ public: VDMObjectDelegateDataType(const VDMObjectDelegateDataType &type) : QQmlRefCount() , QQmlAdaptorModel::Accessors() - , metaObject(0) + , metaObject(nullptr) , propertyOffset(type.propertyOffset) , signalOffset(type.signalOffset) , shared(false) @@ -759,7 +759,7 @@ public: dataType->initializeMetaType(model); return index >= 0 && index < model.list.count() ? new QQmlDMObjectData(metaType, dataType, index, qvariant_cast(model.list.at(index))) - : 0; + : nullptr; } void initializeMetaType(QQmlAdaptorModel &) @@ -807,7 +807,7 @@ public: QMetaObject::metacall(m_data->object, call, id - m_type->propertyOffset + objectPropertyOffset, arguments); return -1; } else if (id >= m_type->signalOffset && call == QMetaObject::InvokeMetaMethod) { - QMetaObject::activate(m_data, this, id - m_type->signalOffset, 0); + QMetaObject::activate(m_data, this, id - m_type->signalOffset, nullptr); return -1; } else { return m_data->qt_metacall(call, id, arguments); @@ -937,10 +937,10 @@ void QQmlAdaptorModel::setModel(const QVariant &variant, QQmlDelegateModel *vdm, accessors = new VDMObjectDelegateDataType; } else if (list.type() != QQmlListAccessor::Invalid && list.type() != QQmlListAccessor::Instance) { // Null QObject - setObject(0); + setObject(nullptr); accessors = &qt_vdm_list_accessors; } else { - setObject(0); + setObject(nullptr); accessors = &qt_vdm_null_accessors; } } @@ -960,7 +960,7 @@ bool QQmlAdaptorModel::isValid() const void QQmlAdaptorModel::objectDestroyed(QObject *) { - setModel(QVariant(), 0, 0); + setModel(QVariant(), nullptr, nullptr); } QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4) @@ -968,7 +968,7 @@ QQmlAdaptorModelEngineData::QQmlAdaptorModelEngineData(QV4::ExecutionEngine *v4) { QV4::Scope scope(v4); QV4::ScopedObject proto(scope, v4->newObject()); - proto->defineAccessorProperty(QStringLiteral("index"), get_index, 0); + proto->defineAccessorProperty(QStringLiteral("index"), get_index, nullptr); proto->defineAccessorProperty(QStringLiteral("modelData"), QQmlDMListAccessorData::get_modelData, QQmlDMListAccessorData::set_modelData); listItemProto.set(v4, proto); diff --git a/src/qml/util/qqmladaptormodel_p.h b/src/qml/util/qqmladaptormodel_p.h index 7bbddcff07..8f773efa20 100644 --- a/src/qml/util/qqmladaptormodel_p.h +++ b/src/qml/util/qqmladaptormodel_p.h @@ -74,7 +74,7 @@ public: inline Accessors() {} virtual ~Accessors(); virtual int count(const QQmlAdaptorModel &) const { return 0; } - virtual void cleanup(QQmlAdaptorModel &, QQmlDelegateModel * = 0) const {} + virtual void cleanup(QQmlAdaptorModel &, QQmlDelegateModel * = nullptr) const {} virtual QVariant value(const QQmlAdaptorModel &, int, const QString &) const { return QVariant(); } @@ -82,7 +82,7 @@ public: virtual QQmlDelegateModelItem *createItem( QQmlAdaptorModel &, QQmlDelegateModelItemMetaType *, - int) const { return 0; } + int) const { return nullptr; } virtual bool notify( const QQmlAdaptorModel &, diff --git a/src/qml/util/qqmlchangeset.cpp b/src/qml/util/qqmlchangeset.cpp index 79e3332331..ba876b42e2 100644 --- a/src/qml/util/qqmlchangeset.cpp +++ b/src/qml/util/qqmlchangeset.cpp @@ -120,7 +120,7 @@ void QQmlChangeSet::remove(int index, int count) { QVector removes; removes.append(Change(index, count)); - remove(&removes, 0); + remove(&removes, nullptr); } /*! diff --git a/src/qml/util/qqmlchangeset_p.h b/src/qml/util/qqmlchangeset_p.h index 8e1fa3f9f2..8bc13f1b67 100644 --- a/src/qml/util/qqmlchangeset_p.h +++ b/src/qml/util/qqmlchangeset_p.h @@ -119,7 +119,7 @@ public: void change(int index, int count); void insert(const QVector &inserts); - void remove(const QVector &removes, QVector *inserts = 0); + void remove(const QVector &removes, QVector *inserts = nullptr); void move(const QVector &removes, const QVector &inserts); void change(const QVector &changes); void apply(const QQmlChangeSet &changeSet); diff --git a/src/qml/util/qqmllistaccessor.cpp b/src/qml/util/qqmllistaccessor.cpp index 356584abdc..ad55519ad3 100644 --- a/src/qml/util/qqmllistaccessor.cpp +++ b/src/qml/util/qqmllistaccessor.cpp @@ -72,7 +72,7 @@ void QQmlListAccessor::setList(const QVariant &v, QQmlEngine *engine) if (d.userType() == qMetaTypeId()) d = d.value().toVariant(); - QQmlEnginePrivate *enginePrivate = engine?QQmlEnginePrivate::get(engine):0; + QQmlEnginePrivate *enginePrivate = engine?QQmlEnginePrivate::get(engine):nullptr; if (!d.isValid()) { m_type = Invalid; diff --git a/src/qml/util/qqmllistaccessor_p.h b/src/qml/util/qqmllistaccessor_p.h index bad5a5803c..bcd079adef 100644 --- a/src/qml/util/qqmllistaccessor_p.h +++ b/src/qml/util/qqmllistaccessor_p.h @@ -63,7 +63,7 @@ public: ~QQmlListAccessor(); QVariant list() const; - void setList(const QVariant &, QQmlEngine * = 0); + void setList(const QVariant &, QQmlEngine * = nullptr); bool isValid() const; diff --git a/src/qml/util/qqmllistcompositor.cpp b/src/qml/util/qqmllistcompositor.cpp index 05a4eaac39..8b0b8f48f0 100644 --- a/src/qml/util/qqmllistcompositor.cpp +++ b/src/qml/util/qqmllistcompositor.cpp @@ -1253,7 +1253,7 @@ void QQmlListCompositor::listItemsRemoved( QVector removals; removals.append(QQmlChangeSet::Change(index, count)); - listItemsRemoved(translatedRemovals, list, &removals, 0, 0); + listItemsRemoved(translatedRemovals, list, &removals, nullptr, nullptr); } /*! diff --git a/src/qml/util/qqmllistcompositor_p.h b/src/qml/util/qqmllistcompositor_p.h index 6ae9c47df3..d5723889e1 100644 --- a/src/qml/util/qqmllistcompositor_p.h +++ b/src/qml/util/qqmllistcompositor_p.h @@ -87,7 +87,7 @@ public: class Range { public: - Range() : next(this), previous(this), list(0), index(0), count(0), flags(0) {} + Range() : next(this), previous(this), list(nullptr), index(0), count(0), flags(0) {} Range(Range *next, void *list, int index, int count, uint flags) : next(next), previous(next->previous), list(list), index(index), count(count), flags(flags) { next->previous = this; previous->next = this; } @@ -222,22 +222,22 @@ public: const iterator &end() { return m_end; } - void append(void *list, int index, int count, uint flags, QVector *inserts = 0); - void insert(Group group, int before, void *list, int index, int count, uint flags, QVector *inserts = 0); - iterator insert(iterator before, void *list, int index, int count, uint flags, QVector *inserts = 0); + void append(void *list, int index, int count, uint flags, QVector *inserts = nullptr); + void insert(Group group, int before, void *list, int index, int count, uint flags, QVector *inserts = nullptr); + iterator insert(iterator before, void *list, int index, int count, uint flags, QVector *inserts = nullptr); - void setFlags(Group fromGroup, int from, int count, Group group, int flags, QVector *inserts = 0); - void setFlags(iterator from, int count, Group group, uint flags, QVector *inserts = 0); - void setFlags(Group fromGroup, int from, int count, uint flags, QVector *inserts = 0) { + void setFlags(Group fromGroup, int from, int count, Group group, int flags, QVector *inserts = nullptr); + void setFlags(iterator from, int count, Group group, uint flags, QVector *inserts = nullptr); + void setFlags(Group fromGroup, int from, int count, uint flags, QVector *inserts = nullptr) { setFlags(fromGroup, from, count, fromGroup, flags, inserts); } - void setFlags(const iterator from, int count, uint flags, QVector *inserts = 0) { + void setFlags(const iterator from, int count, uint flags, QVector *inserts = nullptr) { setFlags(from, count, from.group, flags, inserts); } - void clearFlags(Group fromGroup, int from, int count, Group group, uint flags, QVector *removals = 0); - void clearFlags(iterator from, int count, Group group, uint flags, QVector *removals = 0); - void clearFlags(Group fromGroup, int from, int count, uint flags, QVector *removals = 0) { + void clearFlags(Group fromGroup, int from, int count, Group group, uint flags, QVector *removals = nullptr); + void clearFlags(iterator from, int count, Group group, uint flags, QVector *removals = nullptr); + void clearFlags(Group fromGroup, int from, int count, uint flags, QVector *removals = nullptr) { clearFlags(fromGroup, from, count, fromGroup, flags, removals); } - void clearFlags(const iterator &from, int count, uint flags, QVector *removals = 0) { + void clearFlags(const iterator &from, int count, uint flags, QVector *removals = nullptr) { clearFlags(from, count, from.group, flags, removals); } bool verifyMoveTo(Group fromGroup, int from, Group toGroup, int to, int count, Group group) const; @@ -249,8 +249,8 @@ public: int to, int count, Group group, - QVector *removals = 0, - QVector *inserts = 0); + QVector *removals = nullptr, + QVector *inserts = nullptr); void clear(); void listItemsInserted(void *list, int index, int count, QVector *inserts); @@ -289,13 +289,13 @@ private: QVector *translatedRemovals, void *list, QVector *removals, - QVector *insertions = 0, - QVector *movedFlags = 0); + QVector *insertions = nullptr, + QVector *movedFlags = nullptr); void listItemsInserted( QVector *translatedInsertions, void *list, const QVector &insertions, - const QVector *movedFlags = 0); + const QVector *movedFlags = nullptr); void listItemsChanged( QVector *translatedChanges, void *list, @@ -309,7 +309,7 @@ Q_DECLARE_TYPEINFO(QQmlListCompositor::Remove, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QQmlListCompositor::Insert, Q_PRIMITIVE_TYPE); inline QQmlListCompositor::iterator::iterator() - : range(0), offset(0), group(Default), groupCount(0) {} + : range(nullptr), offset(0), group(Default), groupCount(0) {} inline QQmlListCompositor::iterator::iterator(const iterator &it) : range(it.range) , offset(it.offset) -- cgit v1.2.3 From 06e962f263a86c4b66e1c6195b3d2615695fea1e Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 21 Feb 2018 11:52:59 +0100 Subject: init variables where they are declared when possible (clang-tidy) clang-tidy -p compile_commands.json $file -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' -header-filter='qtdeclarative' -fix Change-Id: I705f3235ff129ba68b0d8dad54a083e29fcead5f Reviewed-by: Johan Helsing --- src/qml/util/qqmlchangeset_p.h | 6 +++--- src/qml/util/qqmllistcompositor_p.h | 21 ++++++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'src/qml/util') diff --git a/src/qml/util/qqmlchangeset_p.h b/src/qml/util/qqmlchangeset_p.h index 8bc13f1b67..8347a3ff19 100644 --- a/src/qml/util/qqmlchangeset_p.h +++ b/src/qml/util/qqmlchangeset_p.h @@ -62,10 +62,10 @@ class Q_QML_PRIVATE_EXPORT QQmlChangeSet public: struct MoveKey { - MoveKey() : moveId(-1), offset(0) {} + MoveKey() {} MoveKey(int moveId, int offset) : moveId(moveId), offset(offset) {} - int moveId; - int offset; + int moveId = -1; + int offset = 0; }; // The storrage for Change (below). This struct is trivial, which it has to be in order to store diff --git a/src/qml/util/qqmllistcompositor_p.h b/src/qml/util/qqmllistcompositor_p.h index d5723889e1..172040559c 100644 --- a/src/qml/util/qqmllistcompositor_p.h +++ b/src/qml/util/qqmllistcompositor_p.h @@ -87,17 +87,17 @@ public: class Range { public: - Range() : next(this), previous(this), list(nullptr), index(0), count(0), flags(0) {} + Range() : next(this), previous(this) {} Range(Range *next, void *list, int index, int count, uint flags) : next(next), previous(next->previous), list(list), index(index), count(count), flags(flags) { next->previous = this; previous->next = this; } Range *next; Range *previous; - void *list; - int index; - int count; - uint flags; + void *list = nullptr; + int index = 0; + int count = 0; + uint flags = 0; inline int start() const { return index; } inline int end() const { return index + count; } @@ -145,11 +145,11 @@ public: void setGroup(Group g) { group = g; groupFlag = 1 << g; } - Range *range; - int offset; - Group group; + Range *range = nullptr; + int offset = 0; + Group group = Default; int groupFlag; - int groupCount; + int groupCount = 0; union { struct { int cacheIndex; @@ -308,8 +308,7 @@ Q_DECLARE_TYPEINFO(QQmlListCompositor::Change, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QQmlListCompositor::Remove, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(QQmlListCompositor::Insert, Q_PRIMITIVE_TYPE); -inline QQmlListCompositor::iterator::iterator() - : range(nullptr), offset(0), group(Default), groupCount(0) {} +inline QQmlListCompositor::iterator::iterator() {} inline QQmlListCompositor::iterator::iterator(const iterator &it) : range(it.range) , offset(it.offset) -- cgit v1.2.3 From e17c89f4ce74e5699ed50dc2187a39d8990316c4 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 26 Feb 2018 17:34:27 +0100 Subject: use the override keyword consistently and correctly (clang-tidy) Change-Id: If9e28d143f8cba3df3c757476b4f2265e2eb8b2a Reviewed-by: Johan Helsing --- src/qml/util/qqmlpropertymap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/qml/util') diff --git a/src/qml/util/qqmlpropertymap.h b/src/qml/util/qqmlpropertymap.h index 3930ac00a8..cb7ada3d79 100644 --- a/src/qml/util/qqmlpropertymap.h +++ b/src/qml/util/qqmlpropertymap.h @@ -56,7 +56,7 @@ class Q_QML_EXPORT QQmlPropertyMap : public QObject Q_OBJECT public: explicit QQmlPropertyMap(QObject *parent = nullptr); - virtual ~QQmlPropertyMap(); + ~QQmlPropertyMap() override; QVariant value(const QString &key) const; void insert(const QString &key, const QVariant &value); -- cgit v1.2.3