diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-09 16:25:58 +0200 |
---|---|---|
committer | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-05-10 11:53:47 +0200 |
commit | 66646dd8c37adb488a79ab274b2396a649674e6d (patch) | |
tree | b0f5ac752a52cec3de1d47692e09295197622dcd /src/imports | |
parent | da15ea0f3b5805db657f13060c21efa78f10cde2 (diff) | |
parent | d82a17b929dd88fe76258b0f801beaa1b2ee343e (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
.qmake.conf
src/plugins/accessible/quick/quick.pro
src/quick/items/qquickpincharea.cpp
src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
src/quick/scenegraph/qsgthreadedrenderloop.cpp
Manually adjusted for TestHTTPServer constructor change:
tests/auto/quick/qquickimage/tst_qquickimage.cpp
Change-Id: I5e58a7c08ea92d6fc5e3bce98571c54f7b2ce08f
Diffstat (limited to 'src/imports')
-rw-r--r-- | src/imports/folderlistmodel/qquickfolderlistmodel.cpp | 41 | ||||
-rw-r--r-- | src/imports/testlib/TestCase.qml | 2 | ||||
-rw-r--r-- | src/imports/xmllistmodel/qqmlxmllistmodel.cpp | 8 |
3 files changed, 24 insertions, 27 deletions
diff --git a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp index f8d43f0594..1f28d8009e 100644 --- a/src/imports/folderlistmodel/qquickfolderlistmodel.cpp +++ b/src/imports/folderlistmodel/qquickfolderlistmodel.cpp @@ -158,35 +158,28 @@ void QQuickFolderListModelPrivate::_q_directoryUpdated(const QString &directory, Q_UNUSED(directory); QModelIndex parent; - if (data.size() > list.size()) { - //File(s) removed. Since I do not know how many - //or where I need to update the whole list from the first item. - data = list; - q->beginRemoveRows(parent, fromIndex, toIndex); - q->endRemoveRows(); - if (list.size() > 0) { - q->beginInsertRows(parent, fromIndex, list.size()-1); - q->endInsertRows(); - } - emit q->rowCountChanged(); - } else if (data.size() < list.size()) { - //qDebug() << "File added. FromIndex: " << fromIndex << " toIndex: " << toIndex << " list size: " << list.size(); - //File(s) added. Calculate how many and insert - //from the first changed one. - toIndex = fromIndex + (list.size() - data.size()-1); - q->beginInsertRows(parent, fromIndex, toIndex); - q->endInsertRows(); - data = list; - emit q->rowCountChanged(); + if (data.size() == list.size()) { QModelIndex modelIndexFrom = q->createIndex(fromIndex, 0); QModelIndex modelIndexTo = q->createIndex(toIndex, 0); + data = list; emit q->dataChanged(modelIndexFrom, modelIndexTo); } else { - //qDebug() << "File has been updated"; - QModelIndex modelIndexFrom = q->createIndex(fromIndex, 0); - QModelIndex modelIndexTo = q->createIndex(toIndex, 0); + // File(s) inserted or removed. Since I do not know how many + // or where, I need to update the whole list from the first item. + // This is a little pessimistic, but optimizing it would require + // more information in the signal from FileInfoThread. + if (data.size() > 0) { + q->beginRemoveRows(parent, 0, data.size() - 1); + q->endRemoveRows(); + } data = list; - emit q->dataChanged(modelIndexFrom, modelIndexTo); + if (list.size() > 0) { + if (toIndex > list.size() - 1) + toIndex = list.size() - 1; + q->beginInsertRows(parent, 0, data.size() - 1); + q->endInsertRows(); + } + emit q->rowCountChanged(); } } diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index 71c87224d7..37addd1d7d 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -1323,10 +1323,10 @@ Item { } else { qtest_runFunction(prop, null, isBenchmark) } - qtest_results.finishTestFunction() // wait(0) will call processEvents() so objects marked for deletion // in the test function will be deleted. wait(0) + qtest_results.finishTestFunction() qtest_results.skipped = false } diff --git a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp index 0b9be3105b..d5be42c06d 100644 --- a/src/imports/xmllistmodel/qqmlxmllistmodel.cpp +++ b/src/imports/xmllistmodel/qqmlxmllistmodel.cpp @@ -132,13 +132,17 @@ typedef QPair<int, int> QQuickXmlListRange; For example, if there is an XML document like this: - \quotefile qml/xmlrole.qml + \quotefile qml/xmlrole.xml Here are some valid XPath expressions for XmlRole queries on this document: \snippet qml/xmlrole.qml 0 \dots 4 \snippet qml/xmlrole.qml 1 + Accessing the model data for the above roles from a delegate: + + \snippet qml/xmlrole.qml 2 + See the \l{http://www.w3.org/TR/xpath20/}{W3C XPath 2.0 specification} for more information. */ @@ -539,7 +543,7 @@ class QQuickXmlListModelPrivate : public QAbstractItemModelPrivate Q_DECLARE_PUBLIC(QQuickXmlListModel) public: QQuickXmlListModelPrivate() - : isComponentComplete(true), size(-1), highestRole(Qt::UserRole) + : isComponentComplete(true), size(0), highestRole(Qt::UserRole) , reply(0), status(QQuickXmlListModel::Null), progress(0.0) , queryId(-1), roleObjects(), redirectCount(0) {} |