PDA

View Full Version : Debugging QTreeView Selections



edice
13th February 2010, 02:42
Hi,

I have finally managed to build a working custom item model for a treeview.
The data is updated in bulk, so I've managed to write code that correctly calls the beginInsertRows / beginRemoveRows and the related methods.

I've tested my model with ModelTest (the QTLabs project), and it appears to work correctly...

EXCEPT

If I select a scattering of rows and then update the model so that some other rows in a different subtree are removed, then SOMETIMES, only SOME of the selected rows become unselected. Often two selected rows side by side (with the same parent) will end up as only one selected row.

Any ideas on how to debug this? Is there some sort of ModelTests-style tester? Are there any known bugs in QTreeView and QSelectionModel ? (I looked in the nokia bug tracker but didn't see anything related)

Thanks,
Paul

franz
13th February 2010, 07:28
Could it be that some of the model indexes become invalid after you remove those rows?

edice
13th February 2010, 13:30
I had problems with invalid indexes before, but they seemed to have been all detected by ModelTest, and I've since fixed them. So, no, I don't think there are any model indexes that are invalid.

edice
13th February 2010, 13:52
Actually, I've just managed to find a way to make ModelTest assert, so I guess there are still problems in my code.

Its annoying that its so hard to get a model built right !!! Its just a freaking tree... how embarrassing.