summaryrefslogtreecommitdiffstats
path: root/src/declarative/util
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-21 06:29:13 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-21 06:29:13 (GMT)
commit9b8fcaa5e9b6fe348df40683e4c8a72e4ba95c89 (patch)
tree49f6a311faf226e665e5f0f6167784a958ada5fa /src/declarative/util
parent1c4846bc35613f388fda28841e19c3a9cbc8c11f (diff)
parentaeadd5ae059b182b5bc3da1537b3193bf725c243 (diff)
downloadQt-9b8fcaa5e9b6fe348df40683e4c8a72e4ba95c89.zip
Qt-9b8fcaa5e9b6fe348df40683e4c8a72e4ba95c89.tar.gz
Qt-9b8fcaa5e9b6fe348df40683e4c8a72e4ba95c89.tar.bz2
Merge branch 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration: Make dynamicscene example embeddeable in another graphics scene Some minor example fixes Update docs with correct property name Fix incorrect merge Work around rendering bug in Rectangle. Remove warnings. Test e75088323ae15604139ddfd66b85cc3b8d43abeb Add XmlListModel::errorString() Fix dynamicscene example Update old keyword in docs
Diffstat (limited to 'src/declarative/util')
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp1
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp2
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp28
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel_p.h2
4 files changed, 29 insertions, 4 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index 1365cd7..de1c0cb 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -2543,7 +2543,6 @@ void QDeclarativeParentAnimation::transition(QDeclarativeStateActions &actions,
QDeclarativeAction &yAction = pc->yIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
QDeclarativeAction &sAction = pc->scaleIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
QDeclarativeAction &rAction = pc->rotationIsSet() && i < actions.size()-1 ? actions[++i] : dummyAction;
- bool forward = (direction == QDeclarativeAbstractAnimation::Forward);
QDeclarativeItem *target = pc->object();
QDeclarativeItem *targetParent = action.reverseEvent ? pc->originalParent() : pc->parent();
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 9a5c9de..7518eb7 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -162,7 +162,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM
spacing: 5
Text { text: "Attributes:" }
Repeater {
- dataSource: attributes
+ model: attributes
Component { Text { text: description } }
}
}
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 4a374a5..cae1d3a 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -423,6 +423,7 @@ public:
int highestRole;
QNetworkReply *reply;
QDeclarativeXmlListModel::Status status;
+ QString errorString;
qreal progress;
int queryId;
QStringList keyRoleResultsCache;
@@ -495,10 +496,11 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
</rss>
\endcode
- Then it could be used to create the following model:
+ A XmlListModel could create a model from this data, like this:
\qml
XmlListModel {
+ id: xmlModel
source: "http://www.mysite.com/feed.xml"
query: "/rss/channel/item"
XmlRole { name: "title"; query: "title/string()" }
@@ -511,6 +513,16 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
model item attributes; here, each model item will have \c title and \c pubDate
attributes that match the \c title and \c pubDate values of its corresponding \c <item>.
+ The model could be used in a ListView, like this:
+
+ \qml
+ ListView {
+ width: 180; height: 300
+ model: xmlModel
+ delegate: Text { title + " (" + pubDate + ")" }
+ }
+ \endqml
+
\section2 Using key XML roles
@@ -722,7 +734,8 @@ void QDeclarativeXmlListModel::setNamespaceDeclarations(const QString &declarati
\o XmlListModel.Null - No XML data has been set for this model.
\o XmlListModel.Ready - The XML data has been loaded into the model.
\o XmlListModel.Loading - The model is in the process of reading and loading XML data.
- \o XmlListModel.Error - An error occurred while the model was loading.
+ \o XmlListModel.Error - An error occurred while the model was loading. See errorString() for details
+ about the error.
\endlist
\sa progress
@@ -755,6 +768,12 @@ qreal QDeclarativeXmlListModel::progress() const
return d->progress;
}
+QString QDeclarativeXmlListModel::errorString() const
+{
+ Q_D(const QDeclarativeXmlListModel);
+ return d->errorString;
+}
+
void QDeclarativeXmlListModel::classBegin()
{
Q_D(QDeclarativeXmlListModel);
@@ -807,6 +826,7 @@ void QDeclarativeXmlListModel::reload()
d->queryId = globalXmlQuery()->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects, d->keyRoleResultsCache);
d->progress = 1.0;
d->status = Loading;
+ d->errorString.clear();
emit progressChanged(d->progress);
emit statusChanged(d->status);
return;
@@ -816,6 +836,7 @@ void QDeclarativeXmlListModel::reload()
d->queryId = XMLLISTMODEL_CLEAR_ID;
d->progress = 1.0;
d->status = Loading;
+ d->errorString.clear();
emit progressChanged(d->progress);
emit statusChanged(d->status);
QTimer::singleShot(0, this, SLOT(dataCleared()));
@@ -824,6 +845,7 @@ void QDeclarativeXmlListModel::reload()
d->progress = 0.0;
d->status = Loading;
+ d->errorString.clear();
emit progressChanged(d->progress);
emit statusChanged(d->status);
@@ -854,6 +876,7 @@ void QDeclarativeXmlListModel::requestFinished()
d->redirectCount = 0;
if (d->reply->error() != QNetworkReply::NoError) {
+ d->errorString = d->reply->errorString();
disconnect(d->reply, 0, this, 0);
d->reply->deleteLater();
d->reply = 0;
@@ -919,6 +942,7 @@ void QDeclarativeXmlListModel::queryCompleted(const QDeclarativeXmlQueryResult &
d->data = result.data;
d->keyRoleResultsCache = result.keyRoleResultsCache;
d->status = Ready;
+ d->errorString.clear();
d->queryId = -1;
bool hasKeys = false;
diff --git a/src/declarative/util/qdeclarativexmllistmodel_p.h b/src/declarative/util/qdeclarativexmllistmodel_p.h
index 7b85476..7101c57 100644
--- a/src/declarative/util/qdeclarativexmllistmodel_p.h
+++ b/src/declarative/util/qdeclarativexmllistmodel_p.h
@@ -113,6 +113,8 @@ public:
Status status() const;
qreal progress() const;
+ Q_INVOKABLE QString errorString() const;
+
virtual void classBegin();
virtual void componentComplete();