diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2017-07-03 13:14:57 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2017-07-07 09:16:26 +0000 |
commit | cca6e8e3bd80824ff5aa3e17995a5b46ad48be28 (patch) | |
tree | 67664d7115c9c153700accab3972d70d44478efb /src/quickcontrols2/qquicktumblerview_p.h | |
parent | 23482c09b812c0254ba5357e070441a6d847d7b2 (diff) |
Tumbler: fix regression with currentIndex and currentItem
2c4b2d48 made Tumbler's wrap property follow its count by default,
but did so using updatePolish() to account for the use case where a
items are appended to the model in a for loop, as is done in
TumblerDatePicker.qml in Tumbler's auto tests. This (appending items
one at a time in a for loop) is not a good idea, but it should work.
The problem with the solution is that the delay means that the use
cases mentioned in the referenced bug report were broken.
This patch removes the delay. The recursion guards are necessary due to
the complex nature of TumblerView (and its non-standard use of the Qt
Quick views), as they prevent a memory leak in
QQuickListView::createHighlight() from being introuduced.
We now call deleteLater() to ensure we do not interfere with the views'
internal operations, and hence we also perform a few extra operations
at the same time as insurance (although it appears that simply
unparenting the internal view from QQuickTumblerView is enough to get
the tests to pass).
Task-number: QTBUG-61374
Change-Id: Ifef9e99522ea183b282ac862f346beaed12d0c09
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quickcontrols2/qquicktumblerview_p.h')
-rw-r--r-- | src/quickcontrols2/qquicktumblerview_p.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quickcontrols2/qquicktumblerview_p.h b/src/quickcontrols2/qquicktumblerview_p.h index e83a8bd2..0ab0c3a9 100644 --- a/src/quickcontrols2/qquicktumblerview_p.h +++ b/src/quickcontrols2/qquicktumblerview_p.h @@ -87,12 +87,12 @@ protected: void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; void componentComplete() override; void itemChange(ItemChange change, const ItemChangeData &data) override; - void updatePolish() override; private: QQuickItem *view(); void createView(); void updateView(); + void updateModel(); void wrapChange(); |