[Qt-interest] QListView: Get indexes of visible items
Ingomar Wesp
ingomar at wesp.name
Mon Apr 27 21:59:11 CEST 2009
Hello,
In the process of porting a Java/Swing application to Qt, I stumbled over the
following problem (I'm completely new to Qt, so please be lenient if this is
an easy one):
I need to get the model indices for all items that are currently visible in a
QListView (essentially the inverse of QAbstractItemView::
visualRegionForSelection). I know there's an indexAt function, but I'm not
comfortable with using it with the top left and bottom right viewport
coordinates because of spacing between items.
Although, because this is going to be called quite a lot, it needs to be
reasonably fast and the QListView will have to many items, iterating over all
of them is definitely not the way to go.
Anyone got any hints for me?
Best regards,
Ingomar Wesp
More information about the Qt-interest-old
mailing list