PDA

View Full Version : QTreeView, QSortFilterProxyModel and item expansions



benacler
20th May 2008, 15:59
Hi all,

I'm facing a weird behaviour and would like some suggestions. I've implemented a softfilterproxymodel to do my custom sorting/filtering in a treeview. The strange thing is that if I expand an item and then recollpase it, after changing the sorting column, the collapsed item may repop in expanded status. Anyone ever faced a similar problem ?

Keep in mind that if I don't expand any item at application start, I never get an autoexpanded item using the sort. It's like there's some kind of internal memory of the expanded item, but I'm going nut atm....

Thanks for your support.

wysota
20th May 2008, 18:11
Can we see some code?

benacler
21st May 2008, 15:36
Code reflects exactly the TreeView model example in the qt documentation.

A few more hints I just discovered, hope someone is able to show me the light:

1) The problem isn't in the proxy model, I tried to remove my custom filter/sorting routines and use the base class ones and the problem still persist

2) The problem happens only if I collapse an item while one of its childs is selected !!!! If I deselect the child and collapse the item, that item never gets auto-expanded again...

Any hint ?

wysota
21st May 2008, 20:30
Code reflects exactly the TreeView model example in the qt documentation.

Well... obviously the example works fine, so the difference between "reflects" and "is identical" is your problem. I'd really suggest posting some code, otherwise there is not much we can do.