qt - How can I get the first visible item/index from a ListView? -
how can first item
/index
visible in listview
? looked inside documentation , searched lot on internet couldn't find anything. know how that?
thank you!
you should use that:
listview { id: contacts model: usersmodel oncontentychanged: { var currentindexattop = indexat(1, contenty) var currentpropfrommodel = usersmodel.get(currentindexattop).name } }
if indexat return -1 means not found, check if need! contenty - property of listview, return current position top y-coord of viewlist window on flickable grid listview.
see documentation more details http://doc.qt.io/qt-5/qml-qtquick-listview.html#indexat-method
Comments
Post a Comment