aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickgridview.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-28 07:34:06 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-08-28 07:34:06 +0200
commitf6ab93a9f96b163cb82f4a2c0971d4fd5cc81fb4 (patch)
treea4f77a581a2ac38ff1617d046c8c37abc741a117 /src/quick/items/qquickgridview.cpp
parent0ae01dec7aa0ffbb59e6e947bfa2e73ae030346a (diff)
parent8577f12bf4dfd9adfe8c5b85a3712bf1cc5ba0c3 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src/quick/items/qquickgridview.cpp')
-rw-r--r--src/quick/items/qquickgridview.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index fecfa5fd2d..e69e9cff46 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -1761,7 +1761,7 @@ void QQuickGridView::setSnapMode(SnapMode mode)
\list
\li The view is first created
- \li The view's \l model changes
+ \li The view's \l model changes in such a way that the visible delegates are completely replaced
\li The view's \l model is \l {QAbstractItemModel::reset()}{reset}, if the model is a QAbstractItemModel subclass
\endlist
@@ -1779,6 +1779,28 @@ void QQuickGridView::setSnapMode(SnapMode mode)
When the view is initialized, the view will create all the necessary items for the view,
then animate them to their correct positions within the view over one second.
+ However when scrolling the view later, the populate transition does not
+ run, even though delegates are being instantiated as they become visible.
+ When the model changes in a way that new delegates become visible, the
+ \l add transition is the one that runs. So you should not depend on the
+ \c populate transition to initialize properties in the delegate, because it
+ does not apply to every delegate. If your animation sets the \c to value of
+ a property, the property should initially have the \c to value, and the
+ animation should set the \c from value in case it is animated:
+
+ \code
+ GridView {
+ ...
+ delegate: Rectangle {
+ opacity: 1 // not necessary because it's the default; but don't set 0
+ ...
+ }
+ populate: Transition {
+ NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 1000 }
+ }
+ }
+ \endcode
+
For more details and examples on how to use view transitions, see the ViewTransition
documentation.