Merge lp:~mzanetti/kubuntu-packaging/qtdeclarative-opensource-src into lp:~kubuntu-packagers/kubuntu-packaging/qtdeclarative-opensource-src

Proposed by Robert Bruce Park
Status: Merged
Merged at revision: 159
Proposed branch: lp:~mzanetti/kubuntu-packaging/qtdeclarative-opensource-src
Merge into: lp:~kubuntu-packagers/kubuntu-packaging/qtdeclarative-opensource-src
Diff against target: 208 lines (+169/-1)
4 files modified
debian/changelog (+8/-0)
debian/libqt5qml5.symbols (+2/-1)
debian/patches/Implement-proper-support-for-layoutChange-in-QQmlDel.patch (+158/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~mzanetti/kubuntu-packaging/qtdeclarative-opensource-src
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Kubuntu Packagers Pending
Review via email: mp+224517@code.launchpad.net

Commit message

Fix a performance hit when editing sorted lists (LP: #1303746)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
159. By Michael Zanetti

* debian/patches/Implement-proper-support-for-layoutChange-in-QQmlDel.patch:
  - Fix a performance hit when editing sorted lists (LP: #1303746)
  - update symbols

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-06-19 19:14:47 +0000
3+++ debian/changelog 2014-06-26 09:47:31 +0000
4@@ -1,3 +1,11 @@
5+qtdeclarative-opensource-src (5.3.0-3ubuntu5) utopic; urgency=medium
6+
7+ * debian/patches/Implement-proper-support-for-layoutChange-in-QQmlDel.patch:
8+ - Fix a performance hit when editing sorted lists (LP: #1303746)
9+ - update symbols
10+
11+ -- Michael Zanetti <michael.zanetti@canonical.com> Wed, 25 Jun 2014 19:27:13 +0200
12+
13 qtdeclarative-opensource-src (5.3.0-3ubuntu4) utopic; urgency=medium
14
15 [ Ricardo Salveti de Araujo ]
16
17=== modified file 'debian/libqt5qml5.symbols'
18--- debian/libqt5qml5.symbols 2014-05-21 15:17:21 +0000
19+++ debian/libqt5qml5.symbols 2014-06-26 09:47:31 +0000
20@@ -580,7 +580,7 @@
21 _ZN17QQmlDelegateModel15_q_rowsInsertedERK11QModelIndexii@Base 5.1.0 1
22 _ZN17QQmlDelegateModel15setWatchedRolesE5QListI10QByteArrayE@Base 5.1.0 1
23 _ZN17QQmlDelegateModel16_q_itemsInsertedEii@Base 5.1.0 1
24- _ZN17QQmlDelegateModel16_q_layoutChangedEv@Base 5.3.0 1
25+ _ZN17QQmlDelegateModel16_q_layoutChangedERK5QListI21QPersistentModelIndexEN18QAbstractItemModel16LayoutChangeHintE@Base 5.3.0 1
26 _ZN17QQmlDelegateModel16resetFilterGroupEv@Base 5.1.0 1
27 _ZN17QQmlDelegateModel16rootIndexChangedEv@Base 5.1.0 1
28 _ZN17QQmlDelegateModel16staticMetaObjectE@Base 5.1.0 1
29@@ -589,6 +589,7 @@
30 _ZN17QQmlDelegateModel20defaultGroupsChangedEv@Base 5.1.0 1
31 _ZN17QQmlDelegateModel21qmlAttachedPropertiesEP7QObject@Base 5.1.0 1
32 _ZN17QQmlDelegateModel23_q_rowsAboutToBeRemovedERK11QModelIndexii@Base 5.1.0 1
33+ _ZN17QQmlDelegateModel25_q_layoutAboutToBeChangedERK5QListI21QPersistentModelIndexEN18QAbstractItemModel16LayoutChangeHintE@Base 5.3.0 1
34 _ZN17QQmlDelegateModel5eventEP6QEvent@Base 5.1.0 1
35 _ZN17QQmlDelegateModel5itemsEv@Base 5.1.0 1
36 _ZN17QQmlDelegateModel5partsEv@Base 5.1.0 1
37
38=== added file 'debian/patches/Implement-proper-support-for-layoutChange-in-QQmlDel.patch'
39--- debian/patches/Implement-proper-support-for-layoutChange-in-QQmlDel.patch 1970-01-01 00:00:00 +0000
40+++ debian/patches/Implement-proper-support-for-layoutChange-in-QQmlDel.patch 2014-06-26 09:47:31 +0000
41@@ -0,0 +1,158 @@
42+From 4d4bd2ac531f0456135a1077f5fceea3517cd3cd Mon Sep 17 00:00:00 2001
43+From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dan@progdan.cz>
44+Date: Wed, 16 Apr 2014 18:33:24 +0200
45+Subject: [PATCH] Implement proper support for layoutChange in
46+ QQmlDelegateModel
47+
48+Current implementation is treating model layoutChange the same way as modelReset,
49+which causes problems when using ListView on top of a QSortFilterProxyModel. The
50+model emits layoutChanged whenever a data within sorting column change. Treating
51+it as modelReset leads to poor performance on large models and caused UI issues,
52+because the scrolling position is reset every time.
53+
54+This patch implements proper handling for layoutChanged signals by first handling
55+all items moves and then simulating dataChange for all items.
56+
57+This fixes regression from Qt 5.1 introduced by Change I16b859d9
58+
59+Task-number: QTBUG-37983
60+Task-number: QTBUG-34391
61+Change-Id: I6d3873b7b87e7f0e8fc0c1ed5dc80c6f8fdf6c22
62+---
63+ src/qml/types/qqmldelegatemodel.cpp | 59 +++++++++++++++++++++++++++++++++--
64+ src/qml/types/qqmldelegatemodel_p.h | 3 +-
65+ src/qml/types/qqmldelegatemodel_p_p.h | 2 ++
66+ src/qml/util/qqmladaptormodel.cpp | 12 ++++---
67+ 4 files changed, 69 insertions(+), 7 deletions(-)
68+
69+diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
70+index be479ee..4591d42 100644
71+--- a/src/qml/types/qqmldelegatemodel.cpp
72++++ b/src/qml/types/qqmldelegatemodel.cpp
73+@@ -1521,9 +1521,64 @@ void QQmlDelegateModel::_q_dataChanged(const QModelIndex &begin, const QModelInd
74+ _q_itemsChanged(begin.row(), end.row() - begin.row() + 1, roles);
75+ }
76+
77+-void QQmlDelegateModel::_q_layoutChanged()
78++void QQmlDelegateModel::_q_layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint)
79+ {
80+- _q_modelReset();
81++ Q_D(QQmlDelegateModel);
82++ if (!d->m_complete)
83++ return;
84++
85++ if (hint == QAbstractItemModel::VerticalSortHint) {
86++ d->m_storedPersistentIndexes.clear();
87++ if (!parents.contains(d->m_adaptorModel.rootIndex))
88++ return;
89++
90++ for (int i = 0; i < d->m_count; ++i) {
91++ const QModelIndex index = d->m_adaptorModel.aim()->index(i, 0, d->m_adaptorModel.rootIndex);
92++ d->m_storedPersistentIndexes.append(index);
93++ }
94++ } else if (hint == QAbstractItemModel::HorizontalSortHint) {
95++ // Ignored
96++ } else {
97++ // Triggers model reset, no preparations for that are needed
98++ }
99++}
100++
101++void QQmlDelegateModel::_q_layoutChanged(const QList<QPersistentModelIndex> &parents, QAbstractItemModel::LayoutChangeHint hint)
102++{
103++ Q_D(QQmlDelegateModel);
104++ if (!d->m_complete)
105++ return;
106++
107++ if (hint == QAbstractItemModel::VerticalSortHint) {
108++ if (!parents.contains(d->m_adaptorModel.rootIndex))
109++ return;
110++
111++ for (int i = 0, c = d->m_storedPersistentIndexes.count(); i < c; ++i) {
112++ const QPersistentModelIndex &index = d->m_storedPersistentIndexes.at(i);
113++ if (i == index.row())
114++ continue;
115++
116++ QVector<Compositor::Insert> inserts;
117++ QVector<Compositor::Remove> removes;
118++ d->m_compositor.listItemsMoved(&d->m_adaptorModel, i, index.row(), 1, &removes, &inserts);
119++ if (!removes.isEmpty() || !inserts.isEmpty()) {
120++ d->itemsMoved(removes, inserts);
121++ }
122++ }
123++
124++ d->m_storedPersistentIndexes.clear();
125++
126++ // layoutUpdate does not necessarily have any move changes, but it can
127++ // also mean data changes. We can't detect what exactly has changed, so
128++ // just emit it for all items
129++ _q_itemsChanged(0, d->m_count, QVector<int>());
130++
131++ } else if (hint == QAbstractItemModel::HorizontalSortHint) {
132++ // Ignored
133++ } else {
134++ // We don't know what's going on, so reset the model
135++ _q_modelReset();
136++ }
137+ }
138+
139+ QQmlDelegateModelAttached *QQmlDelegateModel::qmlAttachedProperties(QObject *obj)
140+diff --git a/src/qml/types/qqmldelegatemodel_p.h b/src/qml/types/qqmldelegatemodel_p.h
141+index 51f846e..0b67179 100644
142+--- a/src/qml/types/qqmldelegatemodel_p.h
143++++ b/src/qml/types/qqmldelegatemodel_p.h
144+@@ -139,7 +139,8 @@ private Q_SLOTS:
145+ void _q_rowsRemoved(const QModelIndex &,int,int);
146+ void _q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int);
147+ void _q_dataChanged(const QModelIndex&,const QModelIndex&,const QVector<int> &);
148+- void _q_layoutChanged();
149++ void _q_layoutAboutToBeChanged(const QList<QPersistentModelIndex>&, QAbstractItemModel::LayoutChangeHint);
150++ void _q_layoutChanged(const QList<QPersistentModelIndex>&, QAbstractItemModel::LayoutChangeHint);
151+
152+ private:
153+ Q_DISABLE_COPY(QQmlDelegateModel)
154+diff --git a/src/qml/types/qqmldelegatemodel_p_p.h b/src/qml/types/qqmldelegatemodel_p_p.h
155+index 32b1154..67deb4f 100644
156+--- a/src/qml/types/qqmldelegatemodel_p_p.h
157++++ b/src/qml/types/qqmldelegatemodel_p_p.h
158+@@ -331,6 +331,8 @@ public:
159+ };
160+ QQmlDelegateModelGroup *m_groups[Compositor::MaximumGroupCount];
161+ };
162++
163++ QList<QPersistentModelIndex> m_storedPersistentIndexes;
164+ };
165+
166+ class QQmlPartsModel : public QQmlInstanceModel, public QQmlDelegateModelGroupEmitter
167+diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
168+index d38e5ac..c1c8bfa 100644
169+--- a/src/qml/util/qqmladaptormodel.cpp
170++++ b/src/qml/util/qqmladaptormodel.cpp
171+@@ -467,8 +467,10 @@ public:
172+ vdm, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)));
173+ QObject::disconnect(aim, SIGNAL(modelReset()),
174+ vdm, SLOT(_q_modelReset()));
175+- QObject::disconnect(aim, SIGNAL(layoutChanged()),
176+- vdm, SLOT(_q_layoutChanged()));
177++ QObject::disconnect(aim, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
178++ vdm, SLOT(_q_layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
179++ QObject::disconnect(aim, SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
180++ vdm, SLOT(_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
181+ }
182+
183+ const_cast<VDMAbstractItemModelDataType *>(this)->release();
184+@@ -920,8 +922,10 @@ void QQmlAdaptorModel::setModel(const QVariant &variant, QQmlDelegateModel *vdm,
185+ vdm, QQmlDelegateModel, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)));
186+ qmlobject_connect(model, QAbstractItemModel, SIGNAL(modelReset()),
187+ vdm, QQmlDelegateModel, SLOT(_q_modelReset()));
188+- qmlobject_connect(model, QAbstractItemModel, SIGNAL(layoutChanged()),
189+- vdm, QQmlDelegateModel, SLOT(_q_layoutChanged()));
190++ qmlobject_connect(model, QAbstractItemModel, SIGNAL(layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
191++ vdm, QQmlDelegateModel, SLOT(_q_layoutAboutToBeChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
192++ qmlobject_connect(model, QAbstractItemModel, SIGNAL(layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)),
193++ vdm, QQmlDelegateModel, SLOT(_q_layoutChanged(QList<QPersistentModelIndex>,QAbstractItemModel::LayoutChangeHint)));
194+ } else {
195+ accessors = new VDMObjectDelegateDataType;
196+ }
197+--
198+1.9.1
199+
200
201=== modified file 'debian/patches/series'
202--- debian/patches/series 2014-06-18 08:15:27 +0000
203+++ debian/patches/series 2014-06-26 09:47:31 +0000
204@@ -5,3 +5,4 @@
205 Make-ItemViews-displayMargin-work-correctly-when-set.patch
206 v4_yarr_jit_push_pop_addressTempRegister.patch
207 fix_qqmlobjectcreator.patch
208+Implement-proper-support-for-layoutChange-in-QQmlDel.patch

Subscribers

People subscribed via source and target branches