diff options
author | Paolo Angelelli <paolo.angelelli@qt.io> | 2019-01-11 15:33:58 +0100 |
---|---|---|
committer | Paolo Angelelli <paolo.angelelli@qt.io> | 2019-01-17 14:53:31 +0000 |
commit | 6536076b1f1368d3c21b286a065915663d8a1946 (patch) | |
tree | e3549ee3293d61c901fc29807172ab30840e5087 /src/quick/items/qquicklistview.cpp | |
parent | 77e275a6f88956a95922b4c746e4235c5a62c47c (diff) |
Add itemAtIndex to quick views
This patch adds itemAtIndex method to ItemView-derived views and
to PathView.
[ChangeLog][QtQuick][QQuickItemView] Added itemAtIndex() to
GridView, ListView and PathView to fetch a visible delegate by index.
Change-Id: Id8475d06c1481036984fe5109bb52cf2729b1c21
Fixes: QTBUG-72961
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquicklistview.cpp')
-rw-r--r-- | src/quick/items/qquicklistview.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp index 62cbfcef2b..2a59e50304 100644 --- a/src/quick/items/qquicklistview.cpp +++ b/src/quick/items/qquicklistview.cpp @@ -3513,6 +3513,20 @@ void QQuickListViewPrivate::translateAndTransitionItemsAfter(int afterModelIndex */ /*! + \qmlmethod Item QtQuick::ListView::itemAtIndex(int index) + + Returns the item for \a index. If there is no item for that index, for example + because it has not been created yet, or because it has been panned out of + the visible area and removed from the cache, null is returned. + + \b Note: this method should only be called after the Component has completed. + The returned value should also not be stored since it can turn to null + as soon as control goes out of the calling scope, if the view releases that item. + + \since 5.13 +*/ + +/*! \qmlmethod QtQuick::ListView::forceLayout() Responding to changes in the model is usually batched to happen only once |