[Qt-interest] QListView: Get indexes of visible items
Ingomar Wesp
ingomar at wesp.name
Wed Apr 29 21:57:11 CEST 2009
On Wednesday 29 April 2009 00:23:57 Malyushytsky, Alex wrote:
> According to my understanding, it is pretty simple, if you are willing
> modify QT source code:
>
> [snip]
>
> Now you have persistent list of visible indexes and the pain to maintain
> your version of QT. Too many times I wanted QT did not have so strong
> "private" implementation. Finally it is written for programmers and such
> implementation sometimes hides way too much when public interface does not
> provide sufficient information.
Thanks for sharing your solution. Unfortunately, hacking Qt itself is not an
option for me. I don't wish to start a rant, but I must say that as a Qt
newbie I was quite surprised that there really is no convenient way to get the
set of visible items.
I settled for my own solution that is limited to static, wrapped QListViews in
QListView::IconMode with a flow of QListView::LeftToRight so that it can
safely calculate the visible item indices (rows in the model) using the view's
grid size and spacing. For my use case, this limitation is acceptable,
although a general solution that does not require modification to Qt itself
would have been nicer.
Thanks again for all the effort,
Ingo
More information about the Qt-interest-old
mailing list