PDA

View Full Version : Is there a way to capture each & every element in tree/table view like model::data()



prasad_N
10th January 2016, 05:23
Is there a way to capure each & every element in tree/table view which are currently shown.

i have requirement like if my tree item meets certain requirement ex: if item data = 0000 expand It.

So like in model where in data function we can capture all the elements which are currently in view, similarly I need a way in view also so that i can Expand my item..

My use case: i am doing lazy population of tree. When i do this I am loading & showing only top 100 items in view & now if user expands some items in top 100 & he now scroll to end of the tree (or by press on end key he scroll to end of the tree) now i am re populating tree with last 100 items &now user press home & now i get top 100 items & repopulating a tree but here i am loosing expanded items.. now if I have model::data() like function i can expand few the items by storing expanded items unique values in my case they are database indexes.


Thanks in advance.

anda_skoa
10th January 2016, 10:07
Maybe keep a list of expanded items?

Cheers,
_

prasad_N
11th January 2016, 17:50
Maybe keep a list of expanded items?

Cheers,
_

Of course but I need this feature for other purposes Also
For ex: there is a bug in Qt, i.e canFetchMore() & fetchMore() will get called only for top level items they will not get called for non top level items (level 2,3,4......) during scroll.

So in this case also If I would be able to recognise each & every element I can load children's dynamically. So basically I am looking for this unique feature rather than doing some workarounds each time I run into this kind of situation..

Any suggestions for doing this or better place/function in view.. I tried connecting scroll bar moved signal to some slot & get leftmost bottom element but it did not workout.

prasad_N
17th January 2016, 18:06
I am still looking for this, Any hint or idea to implement this ???