diff options
Diffstat (limited to 'src/qml/types')
-rw-r--r-- | src/qml/types/qqmlbind_p.h | 6 | ||||
-rw-r--r-- | src/qml/types/qqmlconnections.cpp | 2 | ||||
-rw-r--r-- | src/qml/types/qqmlconnections_p.h | 8 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 18 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel_p.h | 24 | ||||
-rw-r--r-- | src/qml/types/qqmldelegatemodel_p_p.h | 36 | ||||
-rw-r--r-- | src/qml/types/qqmlinstantiator.cpp | 6 | ||||
-rw-r--r-- | src/qml/types/qqmlinstantiator_p.h | 6 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel.cpp | 61 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel_p.h | 12 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodel_p_p.h | 20 | ||||
-rw-r--r-- | src/qml/types/qqmllistmodelworkeragent_p.h | 2 | ||||
-rw-r--r-- | src/qml/types/qqmlobjectmodel.cpp | 2 | ||||
-rw-r--r-- | src/qml/types/qqmlobjectmodel_p.h | 16 | ||||
-rw-r--r-- | src/qml/types/qqmltimer.cpp | 4 | ||||
-rw-r--r-- | src/qml/types/qqmltimer_p.h | 6 | ||||
-rw-r--r-- | src/qml/types/qquickworkerscript.cpp | 4 | ||||
-rw-r--r-- | src/qml/types/qquickworkerscript_p.h | 12 |
18 files changed, 113 insertions, 132 deletions
diff --git a/src/qml/types/qqmlbind_p.h b/src/qml/types/qqmlbind_p.h index 77939a40bc..c9dd14b58a 100644 --- a/src/qml/types/qqmlbind_p.h +++ b/src/qml/types/qqmlbind_p.h @@ -90,9 +90,9 @@ public: void setDelayed(bool); protected: - virtual void setTarget(const QQmlProperty &); - virtual void classBegin(); - virtual void componentComplete(); + void setTarget(const QQmlProperty &) override; + void classBegin() override; + void componentComplete() override; private: void prepareEval(); diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp index 755345cc1b..2aed4d9972 100644 --- a/src/qml/types/qqmlconnections.cpp +++ b/src/qml/types/qqmlconnections.cpp @@ -204,7 +204,7 @@ void QQmlConnections::setEnabled(bool enabled) d->enabled = enabled; - foreach (QQmlBoundSignal *s, d->boundsignals) + for (QQmlBoundSignal *s : qAsConst(d->boundsignals)) s->setEnabled(d->enabled); emit enabledChanged(); diff --git a/src/qml/types/qqmlconnections_p.h b/src/qml/types/qqmlconnections_p.h index d454affba8..580b6522de 100644 --- a/src/qml/types/qqmlconnections_p.h +++ b/src/qml/types/qqmlconnections_p.h @@ -91,15 +91,15 @@ Q_SIGNALS: private: void connectSignals(); - void classBegin(); - void componentComplete(); + void classBegin() override; + void componentComplete() override; }; class QQmlConnectionsParser : public QQmlCustomParser { public: - virtual void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props); - virtual void applyBindings(QObject *object, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings); + void verifyBindings(const QV4::CompiledData::Unit *qmlUnit, const QList<const QV4::CompiledData::Binding *> &props) override; + void applyBindings(QObject *object, QV4::CompiledData::CompilationUnit *compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) override; }; diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index d9a8b1d179..be10b270ae 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -1133,7 +1133,7 @@ void QQmlDelegateModelPrivate::itemsChanged(const QVector<Compositor::Change> &c QVarLengthArray<QVector<QQmlChangeSet::Change>, Compositor::MaximumGroupCount> translatedChanges(m_groupCount); - foreach (const Compositor::Change &change, changes) { + for (const Compositor::Change &change : changes) { for (int i = 1; i < m_groupCount; ++i) { if (change.inGroup(i)) { translatedChanges[i].append(QQmlChangeSet::Change(change.index[i], change.count)); @@ -1182,7 +1182,7 @@ void QQmlDelegateModelPrivate::itemsInserted( for (int i = 1; i < m_groupCount; ++i) inserted[i] = 0; - foreach (const Compositor::Insert &insert, inserts) { + for (const Compositor::Insert &insert : inserts) { for (; cacheIndex < insert.cacheIndex; ++cacheIndex) incrementIndexes(m_cache.at(cacheIndex), m_groupCount, inserted); @@ -1274,7 +1274,7 @@ void QQmlDelegateModelPrivate::itemsRemoved( for (int i = 1; i < m_groupCount; ++i) removed[i] = 0; - foreach (const Compositor::Remove &remove, removes) { + for (const Compositor::Remove &remove : removes) { for (; cacheIndex < remove.cacheIndex; ++cacheIndex) incrementIndexes(m_cache.at(cacheIndex), m_groupCount, removed); @@ -1645,7 +1645,7 @@ bool QQmlDelegateModelPrivate::insert(Compositor::insert_iterator &before, const cacheItem->groups = groups | Compositor::UnresolvedFlag | Compositor::CacheFlag; // Must be before the new object is inserted into the cache or its indexes will be adjusted too. - itemsInserted(QVector<Compositor::Insert>() << Compositor::Insert(before, 1, cacheItem->groups & ~Compositor::CacheFlag)); + itemsInserted(QVector<Compositor::Insert>(1, Compositor::Insert(before, 1, cacheItem->groups & ~Compositor::CacheFlag))); before = m_compositor.insert(before, 0, 0, 1, cacheItem->groups); m_cache.insert(before.cacheIndex, cacheItem); @@ -1756,7 +1756,7 @@ void QQmlDelegateModelItemMetaType::initializePrototype() int QQmlDelegateModelItemMetaType::parseGroups(const QStringList &groups) const { int groupFlags = 0; - foreach (const QString &groupName, groups) { + for (const QString &groupName : groups) { int index = groupNames.indexOf(groupName); if (index != -1) groupFlags |= 2 << index; @@ -2735,12 +2735,12 @@ void QQmlDelegateModelGroup::resolve(QQmlV4Function *args) from += 1; model->itemsMoved( - QVector<Compositor::Remove>() << Compositor::Remove(fromIt, 1, unresolvedFlags, 0), - QVector<Compositor::Insert>() << Compositor::Insert(toIt, 1, unresolvedFlags, 0)); + QVector<Compositor::Remove>(1, Compositor::Remove(fromIt, 1, unresolvedFlags, 0)), + QVector<Compositor::Insert>(1, Compositor::Insert(toIt, 1, unresolvedFlags, 0))); model->itemsInserted( - QVector<Compositor::Insert>() << Compositor::Insert(toIt, 1, (resolvedFlags & ~unresolvedFlags) | Compositor::CacheFlag)); + QVector<Compositor::Insert>(1, Compositor::Insert(toIt, 1, (resolvedFlags & ~unresolvedFlags) | Compositor::CacheFlag))); toIt.incrementIndexes(1, resolvedFlags | unresolvedFlags); - model->itemsRemoved(QVector<Compositor::Remove>() << Compositor::Remove(toIt, 1, resolvedFlags)); + model->itemsRemoved(QVector<Compositor::Remove>(1, Compositor::Remove(toIt, 1, resolvedFlags))); model->m_compositor.setFlags(toGroup, to, 1, unresolvedFlags & ~Compositor::UnresolvedFlag); model->m_compositor.clearFlags(fromGroup, from, 1, unresolvedFlags); diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h index 2986ec7ce5..186144d107 100644 --- a/src/qml/types/qqmldelegatemodel_p.h +++ b/src/qml/types/qqmldelegatemodel_p.h @@ -90,10 +90,10 @@ class Q_QML_PRIVATE_EXPORT QQmlDelegateModel : public QQmlInstanceModel, public public: QQmlDelegateModel(); QQmlDelegateModel(QQmlContext *, QObject *parent=0); - virtual ~QQmlDelegateModel(); + ~QQmlDelegateModel(); - void classBegin(); - void componentComplete(); + void classBegin() override; + void componentComplete() override; QVariant model() const; void setModel(const QVariant &); @@ -107,15 +107,15 @@ public: Q_INVOKABLE QVariant modelIndex(int idx) const; Q_INVOKABLE QVariant parentModelIndex() const; - int count() const; - bool isValid() const { return delegate() != 0; } - QObject *object(int index, bool asynchronous=false); - ReleaseFlags release(QObject *object); - void cancel(int index); - virtual QString stringValue(int index, const QString &role); - virtual void setWatchedRoles(const QList<QByteArray> &roles); + int count() const override; + bool isValid() const override { return delegate() != 0; } + QObject *object(int index, bool asynchronous = false) override; + ReleaseFlags release(QObject *object) override; + void cancel(int index) override; + QString stringValue(int index, const QString &role) override; + void setWatchedRoles(const QList<QByteArray> &roles) override; - int indexOf(QObject *object, QObject *objectContext) const; + int indexOf(QObject *object, QObject *objectContext) const override; QString filterGroup() const; void setFilterGroup(const QString &group); @@ -126,7 +126,7 @@ public: QQmlListProperty<QQmlDelegateModelGroup> groups(); QObject *parts(); - bool event(QEvent *); + bool event(QEvent *) override; static QQmlDelegateModelAttached *qmlAttachedProperties(QObject *obj); diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h index 7d97358b3d..4c2841b8ba 100644 --- a/src/qml/types/qqmldelegatemodel_p_p.h +++ b/src/qml/types/qqmldelegatemodel_p_p.h @@ -190,8 +190,8 @@ public: , incubating(0) , vdm(l) {} - virtual void statusChanged(Status); - virtual void setInitialState(QObject *); + void statusChanged(Status) override; + void setInitialState(QObject *) override; QQmlDelegateModelItem *incubating; QQmlDelegateModelPrivate *vdm; @@ -294,7 +294,7 @@ public: const QVector<Compositor::Remove> &removes, const QVector<Compositor::Insert> &inserts); void itemsChanged(const QVector<Compositor::Change> &changes); void emitChanges(); - void emitModelUpdated(const QQmlChangeSet &changeSet, bool reset); + void emitModelUpdated(const QQmlChangeSet &changeSet, bool reset) override; bool insert(Compositor::insert_iterator &before, const QV4::Value &object, int groups); @@ -355,21 +355,21 @@ public: void updateFilterGroup(); void updateFilterGroup(Compositor::Group group, const QQmlChangeSet &changeSet); - int count() const; - bool isValid() const; - QObject *object(int index, bool asynchronous=false); - ReleaseFlags release(QObject *item); - QString stringValue(int index, const QString &role); + int count() const override; + bool isValid() const override; + QObject *object(int index, bool asynchronous = false) override; + ReleaseFlags release(QObject *item) override; + QString stringValue(int index, const QString &role) override; QList<QByteArray> watchedRoles() const { return m_watchedRoles; } - void setWatchedRoles(const QList<QByteArray> &roles); + void setWatchedRoles(const QList<QByteArray> &roles) override; - int indexOf(QObject *item, QObject *objectContext) const; + int indexOf(QObject *item, QObject *objectContext) const override; - void emitModelUpdated(const QQmlChangeSet &changeSet, bool reset); + void emitModelUpdated(const QQmlChangeSet &changeSet, bool reset) override; - void createdPackage(int index, QQuickPackage *package); - void initPackage(int index, QQuickPackage *package); - void destroyingPackage(QQuickPackage *package); + void createdPackage(int index, QQuickPackage *package) override; + void initPackage(int index, QQuickPackage *package) override; + void destroyingPackage(QQuickPackage *package) override; Q_SIGNALS: void filterGroupChanged(); @@ -392,8 +392,8 @@ public: QQmlDelegateModelPartsMetaObject(QObject *parent) : QQmlOpenMetaObject(parent) {} - virtual void propertyCreated(int, QMetaPropertyBuilder &); - virtual QVariant initialValue(int); + void propertyCreated(int, QMetaPropertyBuilder &) override; + QVariant initialValue(int) override; }; class QQmlDelegateModelParts : public QObject @@ -413,8 +413,8 @@ public: QQmlDelegateModelItemMetaType *metaType, QMetaObject *metaObject); ~QQmlDelegateModelAttachedMetaObject(); - void objectDestroyed(QObject *); - int metaCall(QObject *, QMetaObject::Call, int _id, void **); + void objectDestroyed(QObject *) override; + int metaCall(QObject *, QMetaObject::Call, int _id, void **) override; private: QQmlDelegateModelItemMetaType * const metaType; diff --git a/src/qml/types/qqmlinstantiator.cpp b/src/qml/types/qqmlinstantiator.cpp index 0cec39790d..2de5875deb 100644 --- a/src/qml/types/qqmlinstantiator.cpp +++ b/src/qml/types/qqmlinstantiator.cpp @@ -155,7 +155,8 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo int difference = 0; QHash<int, QVector<QPointer<QObject> > > moved; - foreach (const QQmlChangeSet::Change &remove, changeSet.removes()) { + const QVector<QQmlChangeSet::Change> &removes = changeSet.removes(); + for (const QQmlChangeSet::Change &remove : removes) { int index = qMin(remove.index, objects.count()); int count = qMin(remove.index + remove.count, objects.count()) - index; if (remove.isMove()) { @@ -174,7 +175,8 @@ void QQmlInstantiatorPrivate::_q_modelUpdated(const QQmlChangeSet &changeSet, bo difference -= remove.count; } - foreach (const QQmlChangeSet::Change &insert, changeSet.inserts()) { + const QVector<QQmlChangeSet::Change> &inserts = changeSet.inserts(); + for (const QQmlChangeSet::Change &insert : inserts) { int index = qMin(insert.index, objects.count()); if (insert.isMove()) { QVector<QPointer<QObject> > movedObjects = moved.value(insert.moveId); diff --git a/src/qml/types/qqmlinstantiator_p.h b/src/qml/types/qqmlinstantiator_p.h index dff69ee6b3..ee18daa48c 100644 --- a/src/qml/types/qqmlinstantiator_p.h +++ b/src/qml/types/qqmlinstantiator_p.h @@ -72,7 +72,7 @@ class Q_AUTOTEST_EXPORT QQmlInstantiator : public QObject, public QQmlParserStat public: QQmlInstantiator(QObject *parent = 0); - virtual ~QQmlInstantiator(); + ~QQmlInstantiator(); bool isActive() const; void setActive(bool newVal); @@ -92,8 +92,8 @@ public: Q_INVOKABLE QObject *objectAt(int index) const; - void classBegin(); - void componentComplete(); + void classBegin() override; + void componentComplete() override; Q_SIGNALS: void modelChanged(); diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 8574a4784c..1a2e4c7f6f 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -233,7 +233,7 @@ const ListLayout::Role *ListLayout::getRoleOrCreate(const QString &key, const QV return &getRoleOrCreate(key, type); } -const ListLayout::Role *ListLayout::getExistingRole(const QString &key) +const ListLayout::Role *ListLayout::getExistingRole(const QString &key) const { Role *r = 0; QStringHash<Role *>::Node *node = roleHash.findNode(key); @@ -242,7 +242,7 @@ const ListLayout::Role *ListLayout::getExistingRole(const QString &key) return r; } -const ListLayout::Role *ListLayout::getExistingRole(QV4::String *key) +const ListLayout::Role *ListLayout::getExistingRole(QV4::String *key) const { Role *r = 0; QStringHash<Role *>::Node *node = roleHash.findNode(key); @@ -603,11 +603,8 @@ int ListModel::setOrCreateProperty(int elementIndex, const QString &key, const Q ModelNodeMetaObject *cache = e->objectCache(); - if (roleIndex != -1 && cache) { - QVector<int> roles; - roles << roleIndex; - cache->updateValues(roles); - } + if (roleIndex != -1 && cache) + cache->updateValues(QVector<int>(1, roleIndex)); } } @@ -1312,11 +1309,8 @@ void ModelNodeMetaObject::propertyWritten(int index) QV4::ScopedValue v(scope, scope.engine->fromVariant(value)); int roleIndex = m_model->m_listModel->setExistingProperty(m_elementIndex, propName, v, scope.engine); - if (roleIndex != -1) { - QVector<int> roles; - roles << roleIndex; - m_model->emitItemsChanged(m_elementIndex, 1, roles); - } + if (roleIndex != -1) + m_model->emitItemsChanged(m_elementIndex, 1, QVector<int>(1, roleIndex)); } // Does the emission of the notifiers when we haven't created the meta-object yet @@ -1345,11 +1339,8 @@ void ModelObject::put(Managed *m, String *name, const Value &value) const int elementIndex = that->d()->m_elementIndex; const QString propName = name->toQString(); int roleIndex = that->d()->m_model->m_listModel->setExistingProperty(elementIndex, propName, value, eng); - if (roleIndex != -1) { - QVector<int> roles; - roles << roleIndex; - that->d()->m_model->emitItemsChanged(elementIndex, 1, roles); - } + if (roleIndex != -1) + that->d()->m_model->emitItemsChanged(elementIndex, 1, QVector<int>(1, roleIndex)); ModelNodeMetaObject *mo = ModelNodeMetaObject::get(that->object()); if (mo->initialized()) @@ -1543,14 +1534,10 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index) } int elementIndex = parentModel->m_modelObjects.indexOf(m_owner); - int roleIndex = parentModel->m_roles.indexOf(QString::fromLatin1(name(index).constData())); - - if (elementIndex != -1 && roleIndex != -1) { - - QVector<int> roles; - roles << roleIndex; - - parentModel->emitItemsChanged(elementIndex, 1, roles); + if (elementIndex != -1) { + int roleIndex = parentModel->m_roles.indexOf(QString::fromLatin1(name(index).constData())); + if (roleIndex != -1) + parentModel->emitItemsChanged(elementIndex, 1, QVector<int>(1, roleIndex)); } } @@ -1919,14 +1906,14 @@ bool QQmlListModel::setData(const QModelIndex &index, const QVariant &value, int if (m_dynamicRoles) { const QByteArray property = m_roles.at(role).toUtf8(); if (m_modelObjects[row]->setValue(property, value)) { - emitItemsChanged(row, 1, QVector<int>() << role); + emitItemsChanged(row, 1, QVector<int>(1, role)); return true; } } else { const ListLayout::Role &r = m_listModel->getExistingRole(role); const int roleIndex = m_listModel->setOrCreateProperty(row, r.name, value); if (roleIndex != -1) { - emitItemsChanged(row, 1, QVector<int>() << role); + emitItemsChanged(row, 1, QVector<int>(1, role)); return true; } } @@ -2394,20 +2381,12 @@ void QQmlListModel::setProperty(int index, const QString& property, const QVaria roleIndex = m_roles.count(); m_roles.append(property); } - if (m_modelObjects[index]->setValue(property.toUtf8(), value)) { - QVector<int> roles; - roles << roleIndex; - emitItemsChanged(index, 1, roles); - } + if (m_modelObjects[index]->setValue(property.toUtf8(), value)) + emitItemsChanged(index, 1, QVector<int>(1, roleIndex)); } else { int roleIndex = m_listModel->setOrCreateProperty(index, property, value); - if (roleIndex != -1) { - - QVector<int> roles; - roles << roleIndex; - - emitItemsChanged(index, 1, roles); - } + if (roleIndex != -1) + emitItemsChanged(index, 1, QVector<int>(1, roleIndex)); } } @@ -2536,7 +2515,7 @@ void QQmlListModelParser::verifyBindings(const QV4::CompiledData::Unit *qmlUnit, { listElementTypeName = QString(); // unknown - foreach (const QV4::CompiledData::Binding *binding, bindings) { + for (const QV4::CompiledData::Binding *binding : bindings) { QString propName = qmlUnit->stringAt(binding->propertyNameIndex); if (!propName.isEmpty()) { // isn't default property error(binding, QQmlListModel::tr("ListModel: undefined property '%1'").arg(propName)); @@ -2557,7 +2536,7 @@ void QQmlListModelParser::applyBindings(QObject *obj, QV4::CompiledData::Compila bool setRoles = false; - foreach (const QV4::CompiledData::Binding *binding, bindings) { + for (const QV4::CompiledData::Binding *binding : bindings) { if (binding->type != QV4::CompiledData::Binding::Type_Object) continue; setRoles |= applyProperty(qmlUnit, binding, rv->m_listModel, /*outter element index*/-1); diff --git a/src/qml/types/qqmllistmodel_p.h b/src/qml/types/qqmllistmodel_p.h index 220b0e54b5..b750d30676 100644 --- a/src/qml/types/qqmllistmodel_p.h +++ b/src/qml/types/qqmllistmodel_p.h @@ -85,11 +85,11 @@ public: QQmlListModel(QObject *parent=0); ~QQmlListModel(); - QModelIndex index(int row, int column, const QModelIndex &parent) const; - int rowCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &index, int role) const; - bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); - QHash<int,QByteArray> roleNames() const; + QModelIndex index(int row, int column, const QModelIndex &parent) const override; + int rowCount(const QModelIndex &parent) const override; + QVariant data(const QModelIndex &index, int role) const override; + bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; + QHash<int,QByteArray> roleNames() const override; QVariant data(int index, int role) const; int count() const; @@ -195,7 +195,7 @@ private: // returns true if a role was set bool applyProperty(const QV4::CompiledData::Unit *qmlUnit, const QV4::CompiledData::Binding *binding, ListModel *model, int outterElementIndex); - bool definesEmptyList(const QString &); + static bool definesEmptyList(const QString &); QString listElementTypeName; }; diff --git a/src/qml/types/qqmllistmodel_p_p.h b/src/qml/types/qqmllistmodel_p_p.h index 5ff8b9671f..cdce78e542 100644 --- a/src/qml/types/qqmllistmodel_p_p.h +++ b/src/qml/types/qqmllistmodel_p_p.h @@ -71,8 +71,8 @@ public: bool m_enabled; protected: - void propertyWrite(int index); - void propertyWritten(int index); + void propertyWrite(int index) override; + void propertyWritten(int index) override; private: DynamicRoleModelNode *m_owner; @@ -88,7 +88,7 @@ public: void updateValues(const QVariantMap &object, QVector<int> &roles); - QVariant getValue(const QString &name) + QVariant getValue(const QString &name) const { return m_meta->value(name.toUtf8()); } @@ -124,7 +124,7 @@ public: ModelNodeMetaObject(QObject *object, QQmlListModel *model, int elementIndex); ~ModelNodeMetaObject(); - virtual QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *object); + QAbstractDynamicMetaObject *toDynamicMetaObject(QObject *object) override; static ModelNodeMetaObject *get(QObject *obj); @@ -138,7 +138,7 @@ public: bool initialized() const { return m_initialized; } protected: - void propertyWritten(int index); + void propertyWritten(int index) override; private: using QQmlOpenMetaObject::setValue; @@ -232,9 +232,9 @@ public: const Role &getRoleOrCreate(QV4::String *key, Role::DataType type); const Role &getRoleOrCreate(const QString &key, Role::DataType type); - const Role &getExistingRole(int index) { return *roles.at(index); } - const Role *getExistingRole(const QString &key); - const Role *getExistingRole(QV4::String *key); + const Role &getExistingRole(int index) const { return *roles.at(index); } + const Role *getExistingRole(const QString &key) const; + const Role *getExistingRole(QV4::String *key) const; int roleCount() const { return roles.count(); } @@ -340,12 +340,12 @@ public: return m_layout->roleCount(); } - const ListLayout::Role &getExistingRole(int index) + const ListLayout::Role &getExistingRole(int index) const { return m_layout->getExistingRole(index); } - const ListLayout::Role *getExistingRole(QV4::String *key) + const ListLayout::Role *getExistingRole(QV4::String *key) const { return m_layout->getExistingRole(key); } diff --git a/src/qml/types/qqmllistmodelworkeragent_p.h b/src/qml/types/qqmllistmodelworkeragent_p.h index 1a891c0f25..5a39651bf7 100644 --- a/src/qml/types/qqmllistmodelworkeragent_p.h +++ b/src/qml/types/qqmllistmodelworkeragent_p.h @@ -108,7 +108,7 @@ public: void modelDestroyed(); protected: - virtual bool event(QEvent *); + bool event(QEvent *) override; private: friend class QQuickWorkerScriptEnginePrivate; diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp index 8c8005fb69..695043b592 100644 --- a/src/qml/types/qqmlobjectmodel.cpp +++ b/src/qml/types/qqmlobjectmodel.cpp @@ -154,7 +154,7 @@ public: void clear() { Q_Q(QQmlObjectModel); - foreach (const Item &child, children) + for (const Item &child : qAsConst(children)) emit q->destroyingItem(child.item); remove(0, children.count()); } diff --git a/src/qml/types/qqmlobjectmodel_p.h b/src/qml/types/qqmlobjectmodel_p.h index 97a56344d4..fc4c03874f 100644 --- a/src/qml/types/qqmlobjectmodel_p.h +++ b/src/qml/types/qqmlobjectmodel_p.h @@ -109,16 +109,16 @@ class Q_QML_PRIVATE_EXPORT QQmlObjectModel : public QQmlInstanceModel public: QQmlObjectModel(QObject *parent=0); - virtual ~QQmlObjectModel() {} + ~QQmlObjectModel() {} - virtual int count() const; - virtual bool isValid() const; - virtual QObject *object(int index, bool asynchronous=false); - virtual ReleaseFlags release(QObject *object); - virtual QString stringValue(int index, const QString &role); - virtual void setWatchedRoles(const QList<QByteArray> &) {} + int count() const override; + bool isValid() const override; + QObject *object(int index, bool asynchronous = false) override; + ReleaseFlags release(QObject *object) override; + QString stringValue(int index, const QString &role) override; + void setWatchedRoles(const QList<QByteArray> &) override {} - virtual int indexOf(QObject *object, QObject *objectContext) const; + int indexOf(QObject *object, QObject *objectContext) const override; QQmlListProperty<QObject> children(); diff --git a/src/qml/types/qqmltimer.cpp b/src/qml/types/qqmltimer.cpp index 889274b43e..7efdac4c22 100644 --- a/src/qml/types/qqmltimer.cpp +++ b/src/qml/types/qqmltimer.cpp @@ -60,8 +60,8 @@ public: : interval(1000), running(false), repeating(false), triggeredOnStart(false) , classBegun(false), componentComplete(false), firstTick(true), awaitingTick(false) {} - virtual void animationFinished(QAbstractAnimationJob *); - virtual void animationCurrentLoopChanged(QAbstractAnimationJob *) { maybeTick(); } + void animationFinished(QAbstractAnimationJob *) override; + void animationCurrentLoopChanged(QAbstractAnimationJob *) override { maybeTick(); } void maybeTick() { Q_Q(QQmlTimer); diff --git a/src/qml/types/qqmltimer_p.h b/src/qml/types/qqmltimer_p.h index 7ea2f098bf..7739dad2a6 100644 --- a/src/qml/types/qqmltimer_p.h +++ b/src/qml/types/qqmltimer_p.h @@ -87,10 +87,10 @@ public: void setTriggeredOnStart(bool triggeredOnStart); protected: - void classBegin(); - void componentComplete(); + void classBegin() override; + void componentComplete() override; - bool event(QEvent *); + bool event(QEvent *) override; public Q_SLOTS: void start(); diff --git a/src/qml/types/qquickworkerscript.cpp b/src/qml/types/qquickworkerscript.cpp index e095eabce8..5f716da17a 100644 --- a/src/qml/types/qquickworkerscript.cpp +++ b/src/qml/types/qquickworkerscript.cpp @@ -144,7 +144,7 @@ public: void init(); #if QT_CONFIG(qml_network) - virtual QNetworkAccessManager *networkAccessManager(); + QNetworkAccessManager *networkAccessManager() override; #endif QQuickWorkerScriptEnginePrivate *p; @@ -191,7 +191,7 @@ signals: void stopThread(); protected: - virtual bool event(QEvent *); + bool event(QEvent *) override; private: void processMessage(int, const QByteArray &); diff --git a/src/qml/types/qquickworkerscript_p.h b/src/qml/types/qquickworkerscript_p.h index de6f3dc324..dce3acc3e1 100644 --- a/src/qml/types/qquickworkerscript_p.h +++ b/src/qml/types/qquickworkerscript_p.h @@ -68,7 +68,7 @@ class QQuickWorkerScriptEngine : public QThread Q_OBJECT public: QQuickWorkerScriptEngine(QQmlEngine *parent = 0); - virtual ~QQuickWorkerScriptEngine(); + ~QQuickWorkerScriptEngine(); int registerWorkerScript(QQuickWorkerScript *); void removeWorkerScript(int); @@ -76,7 +76,7 @@ public: void sendMessage(int, const QByteArray &); protected: - virtual void run(); + void run() override; private: QQuickWorkerScriptEnginePrivate *d; @@ -92,7 +92,7 @@ class Q_AUTOTEST_EXPORT QQuickWorkerScript : public QObject, public QQmlParserSt Q_INTERFACES(QQmlParserStatus) public: QQuickWorkerScript(QObject *parent = 0); - virtual ~QQuickWorkerScript(); + ~QQuickWorkerScript(); QUrl source() const; void setSource(const QUrl &); @@ -105,9 +105,9 @@ Q_SIGNALS: void message(const QQmlV4Handle &messageObject); protected: - virtual void classBegin(); - virtual void componentComplete(); - virtual bool event(QEvent *); + void classBegin() override; + void componentComplete() override; + bool event(QEvent *) override; private: QQuickWorkerScriptEngine *engine(); |