aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel.cpp99
-rw-r--r--src/imports/xmllistmodel/qqmlxmllistmodel_p.h16
-rw-r--r--src/qml/qml/qlistmodelinterface.cpp104
-rw-r--r--src/qml/qml/qlistmodelinterface_p.h83
-rw-r--r--src/qml/qml/qml.pri2
-rw-r--r--src/qml/qml/qquicklistmodel.cpp106
-rw-r--r--src/qml/qml/qquicklistmodel_p.h17
-rw-r--r--src/qml/qml/qquicklistmodel_p_p.h6
-rw-r--r--src/qml/qml/qquicklistmodelworkeragent.cpp29
-rw-r--r--src/qml/qml/qquicklistmodelworkeragent_p.h4
-rw-r--r--src/quick/items/qquickgridview.cpp1
-rw-r--r--src/quick/items/qquickitem.cpp1
-rw-r--r--src/quick/items/qquicklistview.cpp1
-rw-r--r--src/quick/items/qquickpathview.cpp1
-rw-r--r--src/quick/items/qquickrepeater.cpp1
-rw-r--r--src/quick/items/qquickvisualadaptormodel.cpp140
-rw-r--r--src/quick/items/qquickvisualadaptormodel_p.h8
-rw-r--r--src/quick/items/qquickvisualdatamodel.cpp8
-rw-r--r--src/quick/items/qquickvisualdatamodel_p.h4
19 files changed, 175 insertions, 456 deletions
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
index 5a06855f1e..6914861724 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp
@@ -57,7 +57,7 @@
#include <QTimer>
#include <QMutex>
-#include <private/qobject_p.h>
+#include <private/qabstractitemmodel_p.h>
Q_DECLARE_METATYPE(QQuickXmlQueryResult)
@@ -528,7 +528,7 @@ void QQuickXmlQueryEngine::doSubQueryJob(XmlQueryJob *currentJob, QQuickXmlQuery
}*/
}
-class QQuickXmlListModelPrivate : public QObjectPrivate
+class QQuickXmlListModelPrivate : public QAbstractItemModelPrivate
{
Q_DECLARE_PUBLIC(QQuickXmlListModel)
public:
@@ -712,7 +712,7 @@ void QQuickXmlListModelPrivate::clear_role(QQmlListProperty<QQuickXmlListModelRo
*/
QQuickXmlListModel::QQuickXmlListModel(QObject *parent)
- : QListModelInterface(*(new QQuickXmlListModelPrivate), parent)
+ : QAbstractListModel(*(new QQuickXmlListModelPrivate), parent)
{
}
@@ -734,48 +734,46 @@ QQmlListProperty<QQuickXmlListModelRole> QQuickXmlListModel::roleObjects()
return list;
}
-QHash<int,QVariant> QQuickXmlListModel::data(int index, const QList<int> &roles) const
+QModelIndex QQuickXmlListModel::index(int row, int column, const QModelIndex &parent) const
{
Q_D(const QQuickXmlListModel);
- QHash<int, QVariant> rv;
- for (int i = 0; i < roles.size(); ++i) {
- int role = roles.at(i);
- int roleIndex = d->roles.indexOf(role);
- rv.insert(role, roleIndex == -1 ? QVariant() : d->data.value(roleIndex).value(index));
- }
- return rv;
+ return !parent.isValid() && column == 0 && row >= 0 && row < d->size
+ ? createIndex(row, column)
+ : QModelIndex();
}
-QVariant QQuickXmlListModel::data(int index, int role) const
+int QQuickXmlListModel::rowCount(const QModelIndex &parent) const
{
Q_D(const QQuickXmlListModel);
- int roleIndex = d->roles.indexOf(role);
- return (roleIndex == -1) ? QVariant() : d->data.value(roleIndex).value(index);
+ return !parent.isValid() ? d->size : 0;
}
-/*!
- \qmlproperty int QtQuick.XmlListModel2::XmlListModel::count
- The number of data entries in the model.
-*/
-int QQuickXmlListModel::count() const
+QVariant QQuickXmlListModel::data(const QModelIndex &index, int role) const
{
Q_D(const QQuickXmlListModel);
- return d->size;
+ const int roleIndex = d->roles.indexOf(role);
+ return (roleIndex == -1 || !index.isValid())
+ ? QVariant()
+ : d->data.value(roleIndex).value(index.row());
}
-QList<int> QQuickXmlListModel::roles() const
+QHash<int, QByteArray> QQuickXmlListModel::roleNames() const
{
Q_D(const QQuickXmlListModel);
- return d->roles;
+ QHash<int,QByteArray> roleNames;
+ for (int i = 0; i < d->roles.count(); ++i)
+ roleNames.insert(d->roles.at(i), d->roleNames.at(i).toUtf8());
+ return roleNames;
}
-QString QQuickXmlListModel::toString(int role) const
+/*!
+ \qmlproperty int QtQuick.XmlListModel2::XmlListModel::count
+ The number of data entries in the model.
+*/
+int QQuickXmlListModel::count() const
{
Q_D(const QQuickXmlListModel);
- int index = d->roles.indexOf(role);
- if (index == -1)
- return QString();
- return d->roleNames.at(index);
+ return d->size;
}
/*!
@@ -1071,11 +1069,11 @@ void QQuickXmlListModel::requestFinished()
d->errorString = d->reply->errorString();
d->deleteReply();
- int count = this->count();
- d->data.clear();
- d->size = 0;
- if (count > 0) {
- emit itemsRemoved(0, count);
+ if (d->size > 0) {
+ beginRemoveRows(QModelIndex(), 0, d->size - 1);
+ d->data.clear();
+ d->size = 0;
+ endRemoveRows();
emit countChanged();
}
@@ -1157,21 +1155,34 @@ void QQuickXmlListModel::queryCompleted(const QQuickXmlQueryResult &result)
}
}
if (!hasKeys) {
- if (!(origCount == 0 && d->size == 0)) {
- emit itemsRemoved(0, origCount);
- emit itemsInserted(0, d->size);
- emit countChanged();
+ if (origCount > 0) {
+ beginRemoveRows(QModelIndex(), 0, origCount - 1);
+ endRemoveRows();
+ }
+ if (d->size > 0) {
+ beginInsertRows(QModelIndex(), 0, d->size - 1);
+ endInsertRows();
}
-
} else {
- for (int i=0; i<result.removed.count(); i++)
- emit itemsRemoved(result.removed[i].first, result.removed[i].second);
- for (int i=0; i<result.inserted.count(); i++)
- emit itemsInserted(result.inserted[i].first, result.inserted[i].second);
-
- if (sizeChanged)
- emit countChanged();
+ for (int i=0; i<result.removed.count(); i++) {
+ const int index = result.removed[i].first;
+ const int count = result.removed[i].second;
+ if (count > 0) {
+ beginRemoveRows(QModelIndex(), index, index + count - 1);
+ endRemoveRows();
+ }
+ }
+ for (int i=0; i<result.inserted.count(); i++) {
+ const int index = result.inserted[i].first;
+ const int count = result.inserted[i].second;
+ if (count > 0) {
+ beginInsertRows(QModelIndex(), index, index + count - 1);
+ endInsertRows();
+ }
+ }
}
+ if (sizeChanged)
+ emit countChanged();
emit statusChanged(d->status);
}
diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
index 5bc4c7b494..4a2ea6cfee 100644
--- a/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
+++ b/src/imports/xmllistmodel/qqmlxmllistmodel_p.h
@@ -47,8 +47,7 @@
#include <QtCore/qurl.h>
#include <QtCore/qstringlist.h>
-
-#include <private/qlistmodelinterface_p.h>
+#include <QtCore/qabstractitemmodel.h>
#include <private/qv8engine_p.h>
QT_BEGIN_HEADER
@@ -69,7 +68,7 @@ struct QQuickXmlQueryResult {
QStringList keyRoleResultsCache;
};
-class QQuickXmlListModel : public QListModelInterface, public QQmlParserStatus
+class QQuickXmlListModel : public QAbstractListModel, public QQmlParserStatus
{
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
@@ -89,11 +88,12 @@ public:
QQuickXmlListModel(QObject *parent = 0);
~QQuickXmlListModel();
- virtual QHash<int,QVariant> data(int index, const QList<int> &roles = (QList<int>())) const;
- virtual QVariant data(int index, int role) const;
- virtual int count() const;
- virtual QList<int> roles() const;
- virtual QString toString(int role) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const;
+ int rowCount(const QModelIndex &parent) const;
+ QVariant data(const QModelIndex &index, int role) const;
+ QHash<int, QByteArray> roleNames() const;
+
+ int count() const;
QQmlListProperty<QQuickXmlListModelRole> roleObjects();
diff --git a/src/qml/qml/qlistmodelinterface.cpp b/src/qml/qml/qlistmodelinterface.cpp
deleted file mode 100644
index 3ea0d3f155..0000000000
--- a/src/qml/qml/qlistmodelinterface.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtDeclaractive module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlistmodelinterface_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \internal
- \class QListModelInterface
- \brief The QListModelInterface class can be subclassed to provide C++ models to QQuickGraphics Views
-
- This class is comprised primarily of pure virtual functions which
- you must implement in a subclass. You can then use the subclass
- as a model for a QQuickGraphics view, such as a QQuickListView.
-*/
-
-/*! \fn QListModelInterface::QListModelInterface(QObject *parent)
- Constructs a QListModelInterface with the specified \a parent.
-*/
-
- /*! \fn QListModelInterface::QListModelInterface(QObjectPrivate &dd, QObject *parent)
-
- \internal
- */
-
-/*! \fn QListModelInterface::~QListModelInterface()
- The destructor is virtual.
- */
-
-/*! \fn int QListModelInterface::count() const
- Returns the number of data entries in the model.
-*/
-
-/*! \fn QVariant QListModelInterface::data(int index, int role) const
- Returns the data at the given \a index for the specified \a roles.
-*/
-
-/*! \fn QList<int> QListModelInterface::roles() const
- Returns the list of roles for which the list model interface
- provides data.
-*/
-
-/*! \fn QString QListModelInterface::toString(int role) const
- Returns a string description of the specified \a role.
-*/
-
-/*! \fn void QListModelInterface::itemsInserted(int index, int count)
- Emit this signal when \a count items are inserted at \a index.
- */
-
-/*! \fn void QListModelInterface::itemsRemoved(int index, int count)
- Emit this signal when \a count items are removed at \a index.
- */
-
-/*! \fn void QListModelInterface::itemsMoved(int from, int to, int count)
- Emit this signal when \a count items are moved from index \a from
- to index \a to.
- */
-
-/*! \fn void QListModelInterface::itemsChanged(int index, int count, const QList<int> &roles)
- Emit this signal when \a count items at \a index have had their
- \a roles changed.
- */
-
-QT_END_NAMESPACE
diff --git a/src/qml/qml/qlistmodelinterface_p.h b/src/qml/qml/qlistmodelinterface_p.h
deleted file mode 100644
index c644ce88e6..0000000000
--- a/src/qml/qml/qlistmodelinterface_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLISTMODELINTERFACE_H
-#define QLISTMODELINTERFACE_H
-
-#include <QtCore/QHash>
-#include <QtCore/QVariant>
-
-#include <private/qtqmlglobal_p.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-
-class Q_QML_PRIVATE_EXPORT QListModelInterface : public QObject
-{
- Q_OBJECT
- public:
- QListModelInterface(QObject *parent = 0) : QObject(parent) {}
- virtual ~QListModelInterface() {}
-
- virtual int count() const = 0;
- virtual QVariant data(int index, int role) const = 0;
-
- virtual QList<int> roles() const = 0;
- virtual QString toString(int role) const = 0;
-
- Q_SIGNALS:
- void itemsInserted(int index, int count);
- void itemsRemoved(int index, int count);
- void itemsMoved(int from, int to, int count);
- void itemsChanged(int index, int count, const QList<int> &roles);
-
- protected:
- QListModelInterface(QObjectPrivate &dd, QObject *parent)
- : QObject(dd, parent) {}
-};
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-#endif //QTREEMODELINTERFACE_H
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index fbbdc84539..e7286c25fb 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -45,7 +45,6 @@ SOURCES += \
$$PWD/qqmlimport.cpp \
$$PWD/qqmllist.cpp \
$$PWD/qqmllocale.cpp \
- $$PWD/qlistmodelinterface.cpp \
$$PWD/qqmlabstractexpression.cpp \
$$PWD/qqmljavascriptexpression.cpp \
$$PWD/qqmlabstractbinding.cpp \
@@ -119,7 +118,6 @@ HEADERS += \
$$PWD/qqmlnullablevalue_p_p.h \
$$PWD/qqmlscriptstring_p.h \
$$PWD/qqmllocale_p.h \
- $$PWD/qlistmodelinterface_p.h \
$$PWD/qqmlcomponentattached_p.h \
$$PWD/qqmlabstractexpression_p.h \
$$PWD/qqmljavascriptexpression_p.h \
diff --git a/src/qml/qml/qquicklistmodel.cpp b/src/qml/qml/qquicklistmodel.cpp
index e865d847a8..11aa372ee5 100644
--- a/src/qml/qml/qquicklistmodel.cpp
+++ b/src/qml/qml/qquicklistmodel.cpp
@@ -45,6 +45,7 @@
#include <private/qqmljsast_p.h>
#include <private/qqmljsengine_p.h>
+
#include <private/qqmlcustomparser_p.h>
#include <private/qqmlscript_p.h>
#include <private/qqmlengine_p.h>
@@ -55,8 +56,6 @@
#include <QtCore/qstack.h>
#include <QXmlStreamReader>
-Q_DECLARE_METATYPE(QListModelInterface *)
-
QT_BEGIN_NAMESPACE
// Set to 1024 as a debugging aid - easier to distinguish uids from indices of elements/models.
@@ -408,7 +407,7 @@ ListModel *ListModel::getListProperty(int elementIndex, const ListLayout::Role &
return e->getListProperty(role);
}
-void ListModel::set(int elementIndex, v8::Handle<v8::Object> object, QList<int> *roles, QV8Engine *eng)
+void ListModel::set(int elementIndex, v8::Handle<v8::Object> object, QVector<int> *roles, QV8Engine *eng)
{
ListElement *e = elements[elementIndex];
@@ -595,7 +594,7 @@ int ListModel::setOrCreateProperty(int elementIndex, const QString &key, const Q
roleIndex = e->setVariantProperty(*r, data);
if (roleIndex != -1 && e->m_objectCache) {
- QList<int> roles;
+ QVector<int> roles;
roles << roleIndex;
e->m_objectCache->updateValues(roles);
}
@@ -1226,7 +1225,7 @@ void ModelObject::updateValues()
}
}
-void ModelObject::updateValues(const QList<int> &roles)
+void ModelObject::updateValues(const QVector<int> &roles)
{
int roleCount = roles.count();
for (int i=0 ; i < roleCount ; ++i) {
@@ -1264,7 +1263,7 @@ void ModelNodeMetaObject::propertyWritten(int index)
int roleIndex = m_obj->m_model->m_listModel->setExistingProperty(m_obj->m_elementIndex, propName, v, eng);
if (roleIndex != -1) {
- QList<int> roles;
+ QVector<int> roles;
roles << roleIndex;
m_obj->m_model->emitItemsChanged(m_obj->m_elementIndex, 1, roles);
}
@@ -1278,7 +1277,7 @@ DynamicRoleModelNode::DynamicRoleModelNode(QQuickListModel *owner, int uid) : m_
DynamicRoleModelNode *DynamicRoleModelNode::create(const QVariantMap &obj, QQuickListModel *owner)
{
DynamicRoleModelNode *object = new DynamicRoleModelNode(owner, uidCounter.fetchAndAddOrdered(1));
- QList<int> roles;
+ QVector<int> roles;
object->updateValues(obj, roles);
return object;
}
@@ -1308,7 +1307,7 @@ void DynamicRoleModelNode::sync(DynamicRoleModelNode *src, DynamicRoleModelNode
}
}
-void DynamicRoleModelNode::updateValues(const QVariantMap &object, QList<int> &roles)
+void DynamicRoleModelNode::updateValues(const QVariantMap &object, QVector<int> &roles)
{
const QList<QString> &keys = object.keys();
@@ -1410,7 +1409,8 @@ void DynamicRoleModelNodeMetaObject::propertyWritten(int index)
int roleIndex = parentModel->m_roles.indexOf(QString::fromLatin1(name(index).constData()));
if (elementIndex != -1 && roleIndex != -1) {
- QList<int> roles;
+
+ QVector<int> roles;
roles << roleIndex;
parentModel->emitItemsChanged(elementIndex, 1, roles);
@@ -1515,7 +1515,7 @@ QQuickListModelParser::ListInstruction *QQuickListModelParser::ListModelData::in
*/
QQuickListModel::QQuickListModel(QObject *parent)
-: QListModelInterface(parent)
+: QAbstractListModel(parent)
{
m_mainThread = true;
m_primary = true;
@@ -1530,7 +1530,7 @@ QQuickListModel::QQuickListModel(QObject *parent)
}
QQuickListModel::QQuickListModel(const QQuickListModel *owner, ListModel *data, QV8Engine *eng, QObject *parent)
-: QListModelInterface(parent)
+: QAbstractListModel(parent)
{
m_mainThread = owner->m_mainThread;
m_primary = false;
@@ -1545,7 +1545,7 @@ QQuickListModel::QQuickListModel(const QQuickListModel *owner, ListModel *data,
}
QQuickListModel::QQuickListModel(QQuickListModel *orig, QQuickListModelWorkerAgent *agent)
-: QListModelInterface(agent)
+: QAbstractListModel(agent)
{
m_mainThread = false;
m_primary = true;
@@ -1671,10 +1671,13 @@ void QQuickListModel::sync(QQuickListModel *src, QQuickListModel *target, QHash<
}
}
-void QQuickListModel::emitItemsChanged(int index, int count, const QList<int> &roles)
+void QQuickListModel::emitItemsChanged(int index, int count, const QVector<int> &roles)
{
+ if (count <= 0)
+ return;
+
if (m_mainThread) {
- emit itemsChanged(index, count, roles);
+ emit dataChanged(createIndex(index, 0), createIndex(index + count - 1, 0), roles);;
} else {
int uid = m_dynamicRoles ? getUid() : m_listModel->getUid();
m_agent->data.changedChange(uid, index, count, roles);
@@ -1683,9 +1686,13 @@ void QQuickListModel::emitItemsChanged(int index, int count, const QList<int> &r
void QQuickListModel::emitItemsRemoved(int index, int count)
{
+ if (count <= 0)
+ return;
+
if (m_mainThread) {
- emit itemsRemoved(index, count);
- emit countChanged();
+ beginRemoveRows(QModelIndex(), index, index + count - 1);
+ endRemoveRows();
+ emit countChanged();
} else {
int uid = m_dynamicRoles ? getUid() : m_listModel->getUid();
if (index == 0 && count == this->count())
@@ -1696,8 +1703,12 @@ void QQuickListModel::emitItemsRemoved(int index, int count)
void QQuickListModel::emitItemsInserted(int index, int count)
{
+ if (count <= 0)
+ return;
+
if (m_mainThread) {
- emit itemsInserted(index, count);
+ beginInsertRows(QModelIndex(), index, index + count - 1);
+ endInsertRows();
emit countChanged();
} else {
int uid = m_dynamicRoles ? getUid() : m_listModel->getUid();
@@ -1707,8 +1718,12 @@ void QQuickListModel::emitItemsInserted(int index, int count)
void QQuickListModel::emitItemsMoved(int from, int to, int n)
{
+ if (n <= 0)
+ return;
+
if (m_mainThread) {
- emit itemsMoved(from, to, n);
+ beginMoveRows(QModelIndex(), from, from + n - 1, QModelIndex(), to > from ? to + n : to);
+ endMoveRows();
} else {
int uid = m_dynamicRoles ? getUid() : m_listModel->getUid();
m_agent->data.moveChange(uid, from, n, to);
@@ -1724,33 +1739,21 @@ QQuickListModelWorkerAgent *QQuickListModel::agent()
return m_agent;
}
-QList<int> QQuickListModel::roles() const
+QModelIndex QQuickListModel::index(int row, int column, const QModelIndex &parent) const
{
- QList<int> rolesArray;
-
- if (m_dynamicRoles) {
- for (int i=0 ; i < m_roles.count() ; ++i)
- rolesArray << i;
- } else {
- for (int i=0 ; i < m_listModel->roleCount() ; ++i)
- rolesArray << i;
- }
-
- return rolesArray;
+ return row >= 0 && row < count() && column == 0 && !parent.isValid()
+ ? createIndex(row, column)
+ : QModelIndex();
}
-QString QQuickListModel::toString(int role) const
+int QQuickListModel::rowCount(const QModelIndex &parent) const
{
- QString roleName;
-
- if (m_dynamicRoles) {
- roleName = m_roles[role];
- } else {
- const ListLayout::Role &r = m_listModel->getExistingRole(role);
- roleName = r.name;
- }
+ return !parent.isValid() ? count() : 0;
+}
- return roleName;
+QVariant QQuickListModel::data(const QModelIndex &index, int role) const
+{
+ return data(index.row(), role);
}
QVariant QQuickListModel::data(int index, int role) const
@@ -1768,6 +1771,23 @@ QVariant QQuickListModel::data(int index, int role) const
return v;
}
+QHash<int, QByteArray> QQuickListModel::roleNames() const
+{
+ QHash<int, QByteArray> roleNames;
+
+ if (m_dynamicRoles) {
+ for (int i = 0 ; i < m_roles.count() ; ++i)
+ roleNames.insert(i, m_roles.at(i).toUtf8());
+ } else {
+ for (int i = 0 ; i < m_listModel->roleCount() ; ++i) {
+ const ListLayout::Role &r = m_listModel->getExistingRole(i);
+ roleNames.insert(i, r.name.toUtf8());
+ }
+ }
+
+ return roleNames;
+}
+
/*!
\qmlproperty bool QtQuick2::ListModel::dynamicRoles
@@ -2147,7 +2167,7 @@ void QQuickListModel::set(int index, const QQmlV8Handle &handle)
emitItemsInserted(index, 1);
} else {
- QList<int> roles;
+ QVector<int> roles;
if (m_dynamicRoles) {
m_modelObjects[index]->updateValues(engine()->variantMapFromJS(object), roles);
@@ -2187,7 +2207,7 @@ void QQuickListModel::setProperty(int index, const QString& property, const QVar
m_roles.append(property);
}
if (m_modelObjects[index]->setValue(property.toUtf8(), value)) {
- QList<int> roles;
+ QVector<int> roles;
roles << roleIndex;
emitItemsChanged(index, 1, roles);
}
@@ -2195,7 +2215,7 @@ void QQuickListModel::setProperty(int index, const QString& property, const QVar
int roleIndex = m_listModel->setOrCreateProperty(index, property, value);
if (roleIndex != -1) {
- QList<int> roles;
+ QVector<int> roles;
roles << roleIndex;
emitItemsChanged(index, 1, roles);
diff --git a/src/qml/qml/qquicklistmodel_p.h b/src/qml/qml/qquicklistmodel_p.h
index 2941de9148..827831e11e 100644
--- a/src/qml/qml/qquicklistmodel_p.h
+++ b/src/qml/qml/qquicklistmodel_p.h
@@ -50,7 +50,7 @@
#include <QtCore/QHash>
#include <QtCore/QList>
#include <QtCore/QVariant>
-#include "qlistmodelinterface_p.h"
+#include <QtCore/qabstractitemmodel.h>
#include <private/qv8engine_p.h>
#include <private/qpodvector_p.h>
@@ -64,7 +64,7 @@ class QQuickListModelWorkerAgent;
class ListModel;
class ListLayout;
-class Q_QML_PRIVATE_EXPORT QQuickListModel : public QListModelInterface
+class Q_QML_PRIVATE_EXPORT QQuickListModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(int count READ count NOTIFY countChanged)
@@ -74,10 +74,13 @@ public:
QQuickListModel(QObject *parent=0);
~QQuickListModel();
- virtual QList<int> roles() const;
- virtual QString toString(int role) const;
- virtual int count() const;
- virtual QVariant data(int index, int role) const;
+ QModelIndex index(int row, int column, const QModelIndex &parent) const;
+ int rowCount(const QModelIndex &parent) const;
+ QVariant data(const QModelIndex &index, int role) const;
+ QHash<int,QByteArray> roleNames() const;
+
+ QVariant data(int index, int role) const;
+ int count() const;
Q_INVOKABLE void clear();
Q_INVOKABLE void remove(QQmlV8Function *args);
@@ -142,7 +145,7 @@ private:
static void sync(QQuickListModel *src, QQuickListModel *target, QHash<int, QQuickListModel *> *targetModelHash);
static QQuickListModel *createWithOwner(QQuickListModel *newOwner);
- void emitItemsChanged(int index, int count, const QList<int> &roles);
+ void emitItemsChanged(int index, int count, const QVector<int> &roles);
void emitItemsRemoved(int index, int count);
void emitItemsInserted(int index, int count);
void emitItemsMoved(int from, int to, int n);
diff --git a/src/qml/qml/qquicklistmodel_p_p.h b/src/qml/qml/qquicklistmodel_p_p.h
index a006721f9c..3214213bba 100644
--- a/src/qml/qml/qquicklistmodel_p_p.h
+++ b/src/qml/qml/qquicklistmodel_p_p.h
@@ -89,7 +89,7 @@ public:
static DynamicRoleModelNode *create(const QVariantMap &obj, QQuickListModel *owner);
- void updateValues(const QVariantMap &object, QList<int> &roles);
+ void updateValues(const QVariantMap &object, QVector<int> &roles);
QVariant getValue(const QString &name)
{
@@ -162,7 +162,7 @@ public:
}
void updateValues();
- void updateValues(const QList<int> &roles);
+ void updateValues(const QVector<int> &roles);
QQuickListModel *m_model;
int m_elementIndex;
@@ -329,7 +329,7 @@ public:
return elements.count();
}
- void set(int elementIndex, v8::Handle<v8::Object> object, QList<int> *roles, QV8Engine *eng);
+ void set(int elementIndex, v8::Handle<v8::Object> object, QVector<int> *roles, QV8Engine *eng);
void set(int elementIndex, v8::Handle<v8::Object> object, QV8Engine *eng);
int append(v8::Handle<v8::Object> object, QV8Engine *eng);
diff --git a/src/qml/qml/qquicklistmodelworkeragent.cpp b/src/qml/qml/qquicklistmodelworkeragent.cpp
index c50b348a4a..63c6bd49e7 100644
--- a/src/qml/qml/qquicklistmodelworkeragent.cpp
+++ b/src/qml/qml/qquicklistmodelworkeragent.cpp
@@ -65,23 +65,23 @@ void QQuickListModelWorkerAgent::Data::clearChange(int uid)
void QQuickListModelWorkerAgent::Data::insertChange(int uid, int index, int count)
{
- Change c = { uid, Change::Inserted, index, count, 0, QList<int>() };
+ Change c = { uid, Change::Inserted, index, count, 0, QVector<int>() };
changes << c;
}
void QQuickListModelWorkerAgent::Data::removeChange(int uid, int index, int count)
{
- Change c = { uid, Change::Removed, index, count, 0, QList<int>() };
+ Change c = { uid, Change::Removed, index, count, 0, QVector<int>() };
changes << c;
}
void QQuickListModelWorkerAgent::Data::moveChange(int uid, int index, int count, int to)
{
- Change c = { uid, Change::Moved, index, count, to, QList<int>() };
+ Change c = { uid, Change::Moved, index, count, to, QVector<int>() };
changes << c;
}
-void QQuickListModelWorkerAgent::Data::changedChange(int uid, int index, int count, const QList<int> &roles)
+void QQuickListModelWorkerAgent::Data::changedChange(int uid, int index, int count, const QVector<int> &roles)
{
Change c = { uid, Change::Changed, index, count, 0, roles };
changes << c;
@@ -215,16 +215,29 @@ bool QQuickListModelWorkerAgent::event(QEvent *e)
if (model) {
switch (change.type) {
case Change::Inserted:
- emit model->itemsInserted(change.index, change.count);
+ model->beginInsertRows(
+ QModelIndex(), change.index, change.index + change.count - 1);
+ model->endInsertRows();
break;
case Change::Removed:
- emit model->itemsRemoved(change.index, change.count);
+ model->beginRemoveRows(
+ QModelIndex(), change.index, change.index + change.count - 1);
+ model->endRemoveRows();
break;
case Change::Moved:
- emit model->itemsMoved(change.index, change.to, change.count);
+ model->beginMoveRows(
+ QModelIndex(),
+ change.index,
+ change.index + change.count - 1,
+ QModelIndex(),
+ change.to > change.index ? change.to + change.count : change.to);
+ model->endMoveRows();
break;
case Change::Changed:
- emit model->itemsChanged(change.index, change.count, change.roles);
+ emit model->dataChanged(
+ model->createIndex(change.index, 0),
+ model->createIndex(change.index + change.count - 1, 0),
+ change.roles);
break;
}
}
diff --git a/src/qml/qml/qquicklistmodelworkeragent_p.h b/src/qml/qml/qquicklistmodelworkeragent_p.h
index 24198b020c..bd805daced 100644
--- a/src/qml/qml/qquicklistmodelworkeragent_p.h
+++ b/src/qml/qml/qquicklistmodelworkeragent_p.h
@@ -122,7 +122,7 @@ private:
int index; // Inserted/Removed/Moved/Changed
int count; // Inserted/Removed/Moved/Changed
int to; // Moved
- QList<int> roles;
+ QVector<int> roles;
};
struct Data
@@ -133,7 +133,7 @@ private:
void insertChange(int uid, int index, int count);
void removeChange(int uid, int index, int count);
void moveChange(int uid, int index, int count, int to);
- void changedChange(int uid, int index, int count, const QList<int> &roles);
+ void changedChange(int uid, int index, int count, const QVector<int> &roles);
};
Data data;
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 7ca22b9f52..8f330b9031 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -45,7 +45,6 @@
#include "qquickitemview_p_p.h"
#include <private/qquicksmoothedanimation_p_p.h>
-#include <private/qlistmodelinterface_p.h>
#include <QtGui/qevent.h>
#include <QtCore/qmath.h>
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index d4eea2b227..fefddad4b6 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -64,7 +64,6 @@
#include <QtQuick/private/qquickstategroup_p.h>
#include <private/qqmlopenmetaobject_p.h>
#include <QtQuick/private/qquickstate_p.h>
-#include <private/qlistmodelinterface_p.h>
#include <private/qquickitem_p.h>
#include <private/qqmlaccessors_p.h>
#include <QtQuick/private/qquickaccessibleattached_p.h>
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 547b033400..18b994733e 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -51,7 +51,6 @@
#include <QtCore/qcoreapplication.h>
#include <private/qquicksmoothedanimation_p_p.h>
-#include <private/qlistmodelinterface_p.h>
#include "qplatformdefs.h"
QT_BEGIN_NAMESPACE
diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp
index c4ee8bca6e..b5304c3361 100644
--- a/src/quick/items/qquickpathview.cpp
+++ b/src/quick/items/qquickpathview.cpp
@@ -46,7 +46,6 @@
#include <QtQuick/private/qquickstate_p.h>
#include <private/qqmlglobal_p.h>
#include <private/qqmlopenmetaobject_p.h>
-#include <private/qlistmodelinterface_p.h>
#include <private/qquickchangeset_p.h>
#include <QtGui/qevent.h>
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 8ebdccf7d9..61b1392a91 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -45,7 +45,6 @@
#include <private/qqmlglobal_p.h>
#include <private/qquicklistaccessor_p.h>
-#include <private/qlistmodelinterface_p.h>
#include <private/qquickchangeset_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quick/items/qquickvisualadaptormodel.cpp b/src/quick/items/qquickvisualadaptormodel.cpp
index f7cd3e2764..b17ab26373 100644
--- a/src/quick/items/qquickvisualadaptormodel.cpp
+++ b/src/quick/items/qquickvisualadaptormodel.cpp
@@ -153,7 +153,7 @@ public:
const QList<QQuickVisualDataModelItem *> &items,
int index,
int count,
- const QList<int> &roles) const
+ const QVector<int> &roles) const
{
bool changed = roles.isEmpty() && !watchedRoles.isEmpty();
if (!changed && !watchedRoles.isEmpty() && watchedRoleIds.isEmpty()) {
@@ -461,8 +461,8 @@ public:
vdm, SLOT(_q_rowsInserted(QModelIndex,int,int)));
QObject::disconnect(aim, SIGNAL(rowsRemoved(QModelIndex,int,int)),
vdm, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
- QObject::disconnect(aim, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- vdm, SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
+ QObject::disconnect(aim, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
+ vdm, SLOT(_q_dataChanged(QModelIndex,QModelIndex,QVector<int>)));
QObject::disconnect(aim, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
vdm, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)));
QObject::disconnect(aim, SIGNAL(modelReset()),
@@ -553,123 +553,6 @@ public:
};
//-----------------------------------------------------------------
-// QListModelInterface
-//-----------------------------------------------------------------
-
-class QQuickVDMListModelInterfaceData : public QQuickVDMCachedModelData
-{
-public:
- QQuickVDMListModelInterfaceData(QQuickVisualDataModelItemMetaType *metaType, VDMModelDelegateDataType *dataType, int index)
- : QQuickVDMCachedModelData(metaType, dataType, index)
- {
- }
-
- QVariant value(int role) const
- {
- return type->model->lmi()->data(index, role);
- }
-
- void setValue(int, const QVariant &) {}
-
- v8::Handle<v8::Value> get()
- {
- if (type->constructor.IsEmpty()) {
- v8::HandleScope handleScope;
- v8::Context::Scope contextScope(engine->context());
- type->initializeConstructor(engineData(engine));
- }
- v8::Local<v8::Object> data = type->constructor->NewInstance();
- data->SetExternalResource(this);
- ++scriptRef;
- return data;
- }
-};
-
-class VDMListModelInterfaceDataType : public VDMModelDelegateDataType
-{
-public:
- VDMListModelInterfaceDataType(QQuickVisualAdaptorModel *model)
- : VDMModelDelegateDataType(model)
- {
- }
-
- int count(const QQuickVisualAdaptorModel &model) const
- {
- return model.lmi()->count();
- }
-
- void cleanup(QQuickVisualAdaptorModel &model, QQuickVisualDataModel *vdm) const
- {
- QListModelInterface *lmi = model.lmi();
- if (lmi && vdm) {
- QObject::disconnect(lmi, SIGNAL(itemsChanged(int,int,QList<int>)),
- vdm, SLOT(_q_itemsChanged(int,int,QList<int>)));
- QObject::disconnect(lmi, SIGNAL(itemsInserted(int,int)),
- vdm, SLOT(_q_itemsInserted(int,int)));
- QObject::disconnect(lmi, SIGNAL(itemsRemoved(int,int)),
- vdm, SLOT(_q_itemsRemoved(int,int)));
- QObject::disconnect(lmi, SIGNAL(itemsMoved(int,int,int)),
- vdm, SLOT(_q_itemsMoved(int,int,int)));
- }
- const_cast<VDMListModelInterfaceDataType *>(this)->release();
- }
-
- QVariant value(const QQuickVisualAdaptorModel &model, int index, const QString &role) const
- {
- QHash<QByteArray, int>::const_iterator it = roleNames.find(role.toUtf8());
- return it != roleNames.end() && model
- ? model.lmi()->data(index, *it)
- : QVariant();
- }
-
- QQuickVisualDataModelItem *createItem(
- QQuickVisualAdaptorModel &model,
- QQuickVisualDataModelItemMetaType *metaType,
- QQmlEngine *engine,
- int index) const
- {
- VDMListModelInterfaceDataType *dataType = const_cast<VDMListModelInterfaceDataType *>(this);
- if (!metaObject)
- dataType->initializeMetaType(model, engine);
- return new QQuickVDMListModelInterfaceData(metaType, dataType, index);
- }
-
- void initializeMetaType(QQuickVisualAdaptorModel &model, QQmlEngine *engine)
- {
- QMetaObjectBuilder builder;
- setModelDataType<QQuickVDMListModelInterfaceData>(&builder, this);
-
- const QByteArray propertyType = QByteArrayLiteral("QVariant");
-
- const QListModelInterface * const listModelInterface = model.lmi();
- const QList<int> roles = listModelInterface->roles();
- for (int propertyId = 0; propertyId < roles.count(); ++propertyId) {
- const int role = roles.at(propertyId);
- const QString roleName = listModelInterface->toString(role);
- const QByteArray propertyName = roleName.toUtf8();
-
- propertyRoles.append(role);
- roleNames.insert(propertyName, role);
- addProperty(&builder, propertyId, propertyName, propertyType);
-
- }
- if (propertyRoles.count() == 1) {
- hasModelData = true;
- const int role = roles.first();
- const QByteArray propertyName = QByteArrayLiteral("modelData");
-
- propertyRoles.append(role);
- roleNames.insert(propertyName, role);
- addProperty(&builder, 1, propertyName, propertyType);
- }
-
- metaObject = builder.toMetaObject();
- *static_cast<QMetaObject *>(this) = *metaObject;
- propertyCache = new QQmlPropertyCache(engine, metaObject);
- }
-};
-
-//-----------------------------------------------------------------
// QQuickListAccessor
//-----------------------------------------------------------------
@@ -1015,25 +898,14 @@ void QQuickVisualAdaptorModel::setModel(const QVariant &variant, QQuickVisualDat
vdm, QQuickVisualDataModel, SLOT(_q_rowsInserted(QModelIndex,int,int)));
qmlobject_connect(model, QAbstractItemModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
vdm, QQuickVisualDataModel, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
- qmlobject_connect(model, QAbstractItemModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
- vdm, QQuickVisualDataModel, SLOT(_q_dataChanged(QModelIndex,QModelIndex)));
+ qmlobject_connect(model, QAbstractItemModel, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
+ vdm, QQuickVisualDataModel, SLOT(_q_dataChanged(QModelIndex,QModelIndex,QVector<int>)));
qmlobject_connect(model, QAbstractItemModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
vdm, QQuickVisualDataModel, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)));
qmlobject_connect(model, QAbstractItemModel, SIGNAL(modelReset()),
vdm, QQuickVisualDataModel, SLOT(_q_modelReset()));
qmlobject_connect(model, QAbstractItemModel, SIGNAL(layoutChanged()),
vdm, QQuickVisualDataModel, SLOT(_q_layoutChanged()));
- } else if (QListModelInterface *model = qobject_cast<QListModelInterface *>(object)) {
- accessors = new VDMListModelInterfaceDataType(this);
-
- qmlobject_connect(model, QListModelInterface, SIGNAL(itemsChanged(int,int,QList<int>)),
- vdm, QQuickVisualDataModel, SLOT(_q_itemsChanged(int,int,QList<int>)));
- qmlobject_connect(model, QListModelInterface, SIGNAL(itemsInserted(int,int)),
- vdm, QQuickVisualDataModel, SLOT(_q_itemsInserted(int,int)));
- qmlobject_connect(model, QListModelInterface, SIGNAL(itemsRemoved(int,int)),
- vdm, QQuickVisualDataModel, SLOT(_q_itemsRemoved(int,int)));
- qmlobject_connect(model, QListModelInterface, SIGNAL(itemsMoved(int,int,int)),
- vdm, QQuickVisualDataModel, SLOT(_q_itemsMoved(int,int,int)));
} else {
accessors = new VDMObjectDelegateDataType;
}
@@ -1080,6 +952,4 @@ QQuickVisualAdaptorModelEngineData::~QQuickVisualAdaptorModelEngineData()
QT_END_NAMESPACE
-QML_DECLARE_TYPE(QListModelInterface)
-
#include <qquickvisualadaptormodel.moc>
diff --git a/src/quick/items/qquickvisualadaptormodel_p.h b/src/quick/items/qquickvisualadaptormodel_p.h
index 5176921a51..d1b66a9963 100644
--- a/src/quick/items/qquickvisualadaptormodel_p.h
+++ b/src/quick/items/qquickvisualadaptormodel_p.h
@@ -44,7 +44,6 @@
#include <QtCore/qabstractitemmodel.h>
-#include "private/qlistmodelinterface_p.h"
#include "private/qquicklistaccessor_p.h"
#include <private/qqmlguard_p.h>
@@ -83,7 +82,7 @@ public:
const QList<QQuickVisualDataModelItem *> &,
int,
int,
- const QList<int> &) const { return false; }
+ const QVector<int> &) const { return false; }
virtual void replaceWatchedRoles(
QQuickVisualAdaptorModel &,
const QList<QByteArray> &,
@@ -109,9 +108,6 @@ public:
inline QAbstractItemModel *aim() { return static_cast<QAbstractItemModel *>(object()); }
inline const QAbstractItemModel *aim() const { return static_cast<const QAbstractItemModel *>(object()); }
- inline QListModelInterface *lmi() { return static_cast<QListModelInterface *>(object()); }
- inline const QListModelInterface *lmi() const { return static_cast<const QListModelInterface *>(object()); }
-
inline int count() const { return qMax(0, accessors->count(*this)); }
inline QVariant value(int index, const QString &role) const {
return accessors->value(*this, index, role); }
@@ -124,7 +120,7 @@ public:
const QList<QQuickVisualDataModelItem *> &items,
int index,
int count,
- const QList<int> &roles) const {
+ const QVector<int> &roles) const {
return accessors->notify(*this, items, index, count, roles); }
inline void replaceWatchedRoles(
const QList<QByteArray> &oldRoles, const QList<QByteArray> &newRoles) {
diff --git a/src/quick/items/qquickvisualdatamodel.cpp b/src/quick/items/qquickvisualdatamodel.cpp
index 728240d712..63b4d58b6d 100644
--- a/src/quick/items/qquickvisualdatamodel.cpp
+++ b/src/quick/items/qquickvisualdatamodel.cpp
@@ -1060,7 +1060,7 @@ void QQuickVisualDataModelPrivate::itemsChanged(const QVector<Compositor::Change
QQuickVisualDataGroupPrivate::get(m_groups[i])->changeSet.apply(translatedChanges.at(i));
}
-void QQuickVisualDataModel::_q_itemsChanged(int index, int count, const QList<int> &roles)
+void QQuickVisualDataModel::_q_itemsChanged(int index, int count, const QVector<int> &roles)
{
Q_D(QQuickVisualDataModel);
if (count <= 0 || !d->m_complete)
@@ -1454,17 +1454,17 @@ void QQuickVisualDataModel::_q_rowsMoved(
}
}
-void QQuickVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end)
+void QQuickVisualDataModel::_q_dataChanged(const QModelIndex &begin, const QModelIndex &end, const QVector<int> &roles)
{
Q_D(QQuickVisualDataModel);
if (begin.parent() == d->m_adaptorModel.rootIndex)
- _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, QList<int>());
+ _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, roles);
}
void QQuickVisualDataModel::_q_layoutChanged()
{
Q_D(QQuickVisualDataModel);
- _q_itemsChanged(0, d->m_count, QList<int>());
+ _q_itemsChanged(0, d->m_count, QVector<int>());
}
QQuickVisualDataModelAttached *QQuickVisualDataModel::qmlAttachedProperties(QObject *obj)
diff --git a/src/quick/items/qquickvisualdatamodel_p.h b/src/quick/items/qquickvisualdatamodel_p.h
index 38939b64ab..fc29336d6c 100644
--- a/src/quick/items/qquickvisualdatamodel_p.h
+++ b/src/quick/items/qquickvisualdatamodel_p.h
@@ -131,7 +131,7 @@ Q_SIGNALS:
void rootIndexChanged();
private Q_SLOTS:
- void _q_itemsChanged(int index, int count, const QList<int> &roles);
+ void _q_itemsChanged(int index, int count, const QVector<int> &roles);
void _q_itemsInserted(int index, int count);
void _q_itemsRemoved(int index, int count);
void _q_itemsMoved(int from, int to, int count);
@@ -139,7 +139,7 @@ private Q_SLOTS:
void _q_rowsInserted(const QModelIndex &,int,int);
void _q_rowsRemoved(const QModelIndex &,int,int);
void _q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int);
- void _q_dataChanged(const QModelIndex&,const QModelIndex&);
+ void _q_dataChanged(const QModelIndex&,const QModelIndex&,const QVector<int> &);
void _q_layoutChanged();
private: