diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-07-02 03:52:22 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-07-02 03:52:22 (GMT) |
commit | b211fc5f1b96a85d970227c57d0215eb813d3362 (patch) | |
tree | 079dc900e79d385ddf54cc5e1c298775fb47a616 | |
parent | 42676c094bf685db73c8fe69374090bc7b7c153b (diff) | |
download | Qt-b211fc5f1b96a85d970227c57d0215eb813d3362.zip Qt-b211fc5f1b96a85d970227c57d0215eb813d3362.tar.gz Qt-b211fc5f1b96a85d970227c57d0215eb813d3362.tar.bz2 |
We should wait for component completion before trying to load XmlListModel data.
This gets rid of the meaningless "empty src" warning when the demos
using XmlListModel are first started.
-rw-r--r-- | src/declarative/extra/qmlxmllistmodel.cpp | 16 | ||||
-rw-r--r-- | src/declarative/extra/qmlxmllistmodel.h | 3 |
2 files changed, 13 insertions, 6 deletions
diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp index 48949b3..95c3de6 100644 --- a/src/declarative/extra/qmlxmllistmodel.cpp +++ b/src/declarative/extra/qmlxmllistmodel.cpp @@ -289,11 +289,11 @@ class QmlXmlListModelPrivate : public QObjectPrivate Q_DECLARE_PUBLIC(QmlXmlListModel) public: QmlXmlListModelPrivate() - : isClassComplete(false), size(-1), highestRole(Qt::UserRole) + : isComponentComplete(true), size(-1), highestRole(Qt::UserRole) , reply(0), status(QmlXmlListModel::Idle), progress(0.0) , queryId(-1), roleObjects(this) {} - bool isClassComplete; + bool isComponentComplete; QUrl src; QString query; QString namespaces; @@ -549,10 +549,16 @@ qreal QmlXmlListModel::progress() const return d->progress; } -void QmlXmlListModel::classComplete() +void QmlXmlListModel::classBegin() { Q_D(QmlXmlListModel); - d->isClassComplete = true; + d->isComponentComplete = false; +} + +void QmlXmlListModel::componentComplete() +{ + Q_D(QmlXmlListModel); + d->isComponentComplete = true; reload(); } @@ -566,7 +572,7 @@ void QmlXmlListModel::reload() { Q_D(QmlXmlListModel); - if (!d->isClassComplete) + if (!d->isComponentComplete) return; d->qmlXmlQuery.abort(); diff --git a/src/declarative/extra/qmlxmllistmodel.h b/src/declarative/extra/qmlxmllistmodel.h index 804f13f..d9871ab 100644 --- a/src/declarative/extra/qmlxmllistmodel.h +++ b/src/declarative/extra/qmlxmllistmodel.h @@ -124,7 +124,8 @@ public: Status status() const; qreal progress() const; - virtual void classComplete(); + virtual void classBegin(); + virtual void componentComplete(); signals: void statusChanged(Status); |