diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-25 23:13:30 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-25 23:13:30 (GMT) |
commit | c08941ea0780779e6600e03ab0c62ce3461e2660 (patch) | |
tree | 391139f6f55c50aede50a93165c17fa205d51a2b /src | |
parent | de85d147d38acb1d9dd3feacf968c72cb74490e8 (diff) | |
parent | 778e1fd21f5a6c94656dfbb99a7613656d0569a1 (diff) | |
download | Qt-c08941ea0780779e6600e03ab0c62ce3461e2660.zip Qt-c08941ea0780779e6600e03ab0c62ce3461e2660.tar.gz Qt-c08941ea0780779e6600e03ab0c62ce3461e2660.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src')
4 files changed, 9 insertions, 27 deletions
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 3e25234..3904458 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -365,7 +365,7 @@ void QDeclarativeListModel::clear() if (!m_isWorkerCopy) { emit itemsRemoved(0, cleared); - emit countChanged(0); + emit countChanged(); } } @@ -390,7 +390,7 @@ void QDeclarativeListModel::remove(int index) if (!m_isWorkerCopy) { emit itemsRemoved(index, 1); - emit countChanged(this->count()); + emit countChanged(); } } @@ -424,7 +424,7 @@ void QDeclarativeListModel::insert(int index, const QScriptValue& valuemap) bool ok = m_flat ? m_flat->insert(index, valuemap) : m_nested->insert(index, valuemap); if (ok && !m_isWorkerCopy) { emit itemsInserted(index, 1); - emit countChanged(this->count()); + emit countChanged(); } } diff --git a/src/declarative/util/qdeclarativelistmodel_p.h b/src/declarative/util/qdeclarativelistmodel_p.h index 6a0426b..d09062e 100644 --- a/src/declarative/util/qdeclarativelistmodel_p.h +++ b/src/declarative/util/qdeclarativelistmodel_p.h @@ -91,7 +91,7 @@ public: QDeclarativeListModelWorkerAgent *agent(); Q_SIGNALS: - void countChanged(int); + void countChanged(); private: friend class QDeclarativeListModelParser; diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp index 2951262..0e38632 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp @@ -229,7 +229,7 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e) } if (cc) - emit m_orig->countChanged(m_copy->count()); + emit m_orig->countChanged(); } } diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index f7beeaa..3e08854 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -173,22 +173,6 @@ public: return job.queryId; } - QList<QList<QVariant> > modelData() { - QMutexLocker locker(&m_mutex); - return m_modelData; - } - - QList<QDeclarativeXmlListRange> insertedItemRanges() { - QMutexLocker locker(&m_mutex); - return m_insertedItemRanges; - } - - QList<QDeclarativeXmlListRange> removedItemRanges() { - QMutexLocker locker(&m_mutex); - return m_removedItemRanges; - } - - Q_SIGNALS: void queryCompleted(const QDeclarativeXmlQueryResult &); @@ -254,13 +238,10 @@ void QDeclarativeXmlQuery::doQueryJob() query.setQuery(job.namespaces + job.query); query.evaluateTo(&r); - //qDebug() << r; - //always need a single root element QByteArray xml = "<dummy:items xmlns:dummy=\"http://qtsotware.com/dummy\">\n" + r.toUtf8() + "</dummy:items>"; QBuffer b(&xml); b.open(QIODevice::ReadOnly); - //qDebug() << xml; QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + job.namespaces; QString prefix = QLatin1String("doc($inputDocument)/dummy:items") + @@ -278,7 +259,6 @@ void QDeclarativeXmlQuery::doQueryJob() if (item.isAtomicValue()) count = item.toAtomicValue().toInt(); } - //qDebug() << count; job.data = xml; m_prefix = namespaces + prefix + QLatin1Char('/'); @@ -552,7 +532,7 @@ QHash<int,QVariant> QDeclarativeXmlListModel::data(int index, const QList<int> & 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.at(roleIndex).at(index)); + rv.insert(role, roleIndex == -1 ? QVariant() : d->data.value(roleIndex).value(index)); } return rv; } @@ -561,7 +541,7 @@ QVariant QDeclarativeXmlListModel::data(int index, int role) const { Q_D(const QDeclarativeXmlListModel); int roleIndex = d->roles.indexOf(role); - return (roleIndex == -1) ? QVariant() : d->data.at(roleIndex).at(index); + return (roleIndex == -1) ? QVariant() : d->data.value(roleIndex).value(index); } /*! @@ -748,6 +728,8 @@ void QDeclarativeXmlListModel::componentComplete() Otherwise, items are only added if the model does not already contain items with matching key role values. + + \sa XmlRole::isKey */ void QDeclarativeXmlListModel::reload() { |