PDA

View Full Version : TreeView and selection updating



Tepi
26th March 2010, 13:29
Hi everyone,

Can someone give me a hint about updating selections in QTreeView. The problem is that when I insert a new node to the model and the TreeView gets updated, the selection in the view doesn't follow the node that was selected. Instead it will stick in the same row as it was before and the node in that row is usually already a different one.

So how to get the selection to follow the actual node?

-Tepi

Tepi
29th March 2010, 09:07
As there's no suggestions on this one, I made a temporary fix for this... For now I'm inserting new nodes only to the bottom of the model/list. So the selection will always be in the right place since the order of nodes isn't changing.

I think that I could create a new variable for keeping track of the selection and use it whenever the model/view gets updated, but I actually I wanted to know if there's some built-in "Qt's model/view" way of doing this...