diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-08-31 03:51:00 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-08-31 03:51:00 (GMT) |
commit | ef1356dba047467ab1c8ae3de389117383cacbbc (patch) | |
tree | 282338baa980a44425d6a30cc4698fc33df50737 | |
parent | 11214b3cfbf890df00de5a90c143b61477a0a8c6 (diff) | |
download | Qt-ef1356dba047467ab1c8ae3de389117383cacbbc.zip Qt-ef1356dba047467ab1c8ae3de389117383cacbbc.tar.gz Qt-ef1356dba047467ab1c8ae3de389117383cacbbc.tar.bz2 |
Update XmlListModel status to be in line with other QML objects that
load from the network.
-rw-r--r-- | demos/declarative/flickr/flickr-desktop.qml | 2 | ||||
-rw-r--r-- | demos/declarative/flickr/flickr-mobile.qml | 2 | ||||
-rw-r--r-- | src/declarative/extra/qmlxmllistmodel.cpp | 9 | ||||
-rw-r--r-- | src/declarative/extra/qmlxmllistmodel.h | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/demos/declarative/flickr/flickr-desktop.qml b/demos/declarative/flickr/flickr-desktop.qml index 5effc42..fca7e31 100644 --- a/demos/declarative/flickr/flickr-desktop.qml +++ b/demos/declarative/flickr/flickr-desktop.qml @@ -106,7 +106,7 @@ Item { Image { source: "common/pics/background.png"; anchors.fill: parent } RssModel { id: RssModel; tags : TagsEdit.text } - Loading { anchors.centerIn: parent; visible: RssModel.status } + Loading { anchors.centerIn: parent; visible: RssModel.status == 2 } GridView { id: PhotoGridView; model: RssModel; delegate: PhotoDelegate; cacheBuffer: 100 diff --git a/demos/declarative/flickr/flickr-mobile.qml b/demos/declarative/flickr/flickr-mobile.qml index a4692a3..47aea32 100644 --- a/demos/declarative/flickr/flickr-mobile.qml +++ b/demos/declarative/flickr/flickr-mobile.qml @@ -13,7 +13,7 @@ Item { Image { source: "mobile/images/stripes.png"; fillMode: "Tile"; anchors.fill: parent; opacity: 0.3 } Common.RssModel { id: RssModel } - Common.Loading { anchors.centerIn: parent; visible: RssModel.status } + Common.Loading { anchors.centerIn: parent; visible: RssModel.status == 2 } Item { id: Views diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp index 60a28b4..4b67074 100644 --- a/src/declarative/extra/qmlxmllistmodel.cpp +++ b/src/declarative/extra/qmlxmllistmodel.cpp @@ -288,7 +288,7 @@ class QmlXmlListModelPrivate : public QObjectPrivate public: QmlXmlListModelPrivate() : isComponentComplete(true), size(-1), highestRole(Qt::UserRole) - , reply(0), status(QmlXmlListModel::Idle), progress(0.0) + , reply(0), status(QmlXmlListModel::Null), progress(0.0) , queryId(-1), roleObjects(this) {} bool isComponentComplete; @@ -547,7 +547,8 @@ void QmlXmlListModel::setNamespaceDeclarations(const QString &declarations) This property holds the status of data source loading. It can be one of: \list - \o Idle - no data source has been set, or the data source has been loaded + \o Null - no data source has been set + \o Ready - nthe data source has been loaded \o Loading - the data source is currently being loaded \o Error - an error occurred while loading the data source \endlist @@ -623,7 +624,7 @@ void QmlXmlListModel::reload() if (!d->xml.isEmpty()) { d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects); d->progress = 1.0; - d->status = Idle; + d->status = Ready; emit progressChanged(d->progress); emit statusChanged(d->status); return; @@ -650,7 +651,7 @@ void QmlXmlListModel::requestFinished() d->reply = 0; d->status = Error; } else { - d->status = Idle; + d->status = Ready; QByteArray data = d->reply->readAll(); d->queryId = d->qmlXmlQuery.doQuery(d->query, d->namespaces, data, &d->roleObjects); disconnect(d->reply, 0, this, 0); diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h index fbf95db..5f7c831 100644 --- a/src/declarative/extra/qmlxmllistmodel.h +++ b/src/declarative/extra/qmlxmllistmodel.h @@ -125,7 +125,7 @@ public: QString namespaceDeclarations() const; void setNamespaceDeclarations(const QString&); - enum Status { Idle, Loading, Error }; // ### should include Null for consistency? + enum Status { Null, Ready, Loading, Error }; Status status() const; qreal progress() const; |