aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-08-07 11:31:23 +0200
committerGunnar Sletta <gunnar.sletta@jollamobile.com>2014-08-07 11:31:23 +0200
commit9737b35ac0638dd301b670e940f4e424aab4b4f3 (patch)
tree2f0225f0f2b05d8422126b2b91a7f0fc73e93700 /src/qml
parent0a43c561891a46477c4e78f6a6d05fd9731ebb04 (diff)
parent3f5141e5b7227630ca89329a92b6ebddbcb1b7a5 (diff)
Merge branch '5.3' into dev
Conflicts: src/quick/items/context2d/qquickcontext2d.cpp src/quick/items/context2d/qquickcontext2dtexture.cpp Change-Id: I1a9b911b3a92333a5dddbaf43275f71bad2006f0
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/qqmlcomponent.cpp1
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp25
-rw-r--r--src/qml/types/qqmldelegatemodel_p.h2
3 files changed, 19 insertions, 9 deletions
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 616f54d174..e087785901 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1542,7 +1542,6 @@ void QmlIncubatorObject::statusChanged(QQmlIncubator::Status s)
callData->args[0] = QV4::Primitive::fromUInt32(s);
f->call(callData);
if (scope.hasException()) {
- ctx->catchException();
QQmlError error = QV4::ExecutionEngine::catchExceptionAsQmlError(ctx);
QQmlEnginePrivate::warning(QQmlEnginePrivate::get(d()->v8->engine()), error);
}
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index e2f1cffb16..91ddcf57e5 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -1526,6 +1526,18 @@ void QQmlDelegateModel::_q_dataChanged(const QModelIndex &begin, const QModelInd
_q_itemsChanged(begin.row(), end.row() - begin.row() + 1, roles);
}
+bool QQmlDelegateModel::isDescendantOf(const QPersistentModelIndex& desc, const QList< QPersistentModelIndex >& parents) const
+{
+ for (int i = 0, c = parents.count(); i < c; ++i) {
+ for (QPersistentModelIndex parent = desc; parent.isValid(); parent = parent.parent()) {
+ if (parent == parents[i])
+ return true;
+ }
+ }
+
+ return false;
+}
+
void QQmlDelegateModel::_q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint)
{
Q_D(QQmlDelegateModel);
@@ -1534,8 +1546,9 @@ void QQmlDelegateModel::_q_layoutAboutToBeChanged(const QList<QPersistentModelIn
if (hint == QAbstractItemModel::VerticalSortHint) {
d->m_storedPersistentIndexes.clear();
- if (!parents.contains(d->m_adaptorModel.rootIndex))
+ if (!parents.isEmpty() && d->m_adaptorModel.rootIndex.isValid() && !isDescendantOf(d->m_adaptorModel.rootIndex, parents)) {
return;
+ }
for (int i = 0; i < d->m_count; ++i) {
const QModelIndex index = d->m_adaptorModel.aim()->index(i, 0, d->m_adaptorModel.rootIndex);
@@ -1555,20 +1568,16 @@ void QQmlDelegateModel::_q_layoutChanged(const QList<QPersistentModelIndex> &par
return;
if (hint == QAbstractItemModel::VerticalSortHint) {
- if (!parents.contains(d->m_adaptorModel.rootIndex))
+ if (!parents.isEmpty() && d->m_adaptorModel.rootIndex.isValid() && !isDescendantOf(d->m_adaptorModel.rootIndex, parents)) {
return;
+ }
for (int i = 0, c = d->m_storedPersistentIndexes.count(); i < c; ++i) {
const QPersistentModelIndex &index = d->m_storedPersistentIndexes.at(i);
if (i == index.row())
continue;
- QVector<Compositor::Insert> inserts;
- QVector<Compositor::Remove> removes;
- d->m_compositor.listItemsMoved(&d->m_adaptorModel, i, index.row(), 1, &removes, &inserts);
- if (!removes.isEmpty() || !inserts.isEmpty()) {
- d->itemsMoved(removes, inserts);
- }
+ _q_itemsMoved(i, index.row(), 1);
}
d->m_storedPersistentIndexes.clear();
diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h
index 0b67179163..53cc94bbdf 100644
--- a/src/qml/types/qqmldelegatemodel_p.h
+++ b/src/qml/types/qqmldelegatemodel_p.h
@@ -143,6 +143,8 @@ private Q_SLOTS:
void _q_layoutChanged(const QList<QPersistentModelIndex>&, QAbstractItemModel::LayoutChangeHint);
private:
+ bool isDescendantOf(const QPersistentModelIndex &desc, const QList<QPersistentModelIndex> &parents) const;
+
Q_DISABLE_COPY(QQmlDelegateModel)
};