diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-03-25 04:44:35 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-03-25 23:18:02 (GMT) |
commit | 778e1fd21f5a6c94656dfbb99a7613656d0569a1 (patch) | |
tree | d941bb172f1c33a77377e625495f9e2c6b41c538 /src | |
parent | 7b42ee836b8cc1ae345d1d24d4419f0c6b77c97d (diff) | |
download | Qt-778e1fd21f5a6c94656dfbb99a7613656d0569a1.zip Qt-778e1fd21f5a6c94656dfbb99a7613656d0569a1.tar.gz Qt-778e1fd21f5a6c94656dfbb99a7613656d0569a1.tar.bz2 |
Fix where data() is called before xml is loaded. Also add status tests.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/util/qdeclarativexmllistmodel.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index e148469..3e08854 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -532,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; } @@ -541,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); } /*! @@ -728,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() { |