aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2018-01-16 15:22:40 +0100
committerMitch Curtis <mitch.curtis@qt.io>2018-01-17 14:22:18 +0000
commitda7d894deb4cc36155ade5e6a1ebecc3262363f8 (patch)
tree9b8337edd90dbdf2e4601a025cd2c72161e15a44 /src/quickcontrols2
parentd61567f3cfa100aeab865bd6b436de87970575f5 (diff)
Make Tumbler compatible with deferred execution
Now that the contentItem is created at a different stage, we have to shuffle some code around and add some null checks. Task-number: QTBUG-50992 Change-Id: I34d3a9ea9cb9ab54008a1015b37b1666538c085e Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/quickcontrols2')
-rw-r--r--src/quickcontrols2/qquicktumblerview.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/quickcontrols2/qquicktumblerview.cpp b/src/quickcontrols2/qquicktumblerview.cpp
index e8f0c364..4469810c 100644
--- a/src/quickcontrols2/qquicktumblerview.cpp
+++ b/src/quickcontrols2/qquicktumblerview.cpp
@@ -173,14 +173,19 @@ void QQuickTumblerView::createView()
m_listView->setParentItem(this);
m_listView->setSnapMode(QQuickListView::SnapToItem);
m_listView->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange);
- m_listView->setHighlightMoveDuration(1000);
m_listView->setClip(true);
- m_listView->setDelegate(m_delegate);
// Give the view a size.
updateView();
// Set the model.
updateModel();
+
+ // Set these after the model is set so that the currentItem animation
+ // happens instantly on startup/after switching models. If we set them too early,
+ // the view animates any potential currentIndex change over one second,
+ // which we don't want when the contentItem has just been created.
+ m_listView->setDelegate(m_delegate);
+ m_listView->setHighlightMoveDuration(1000);
}
}
}