PDA

View Full Version : Updating QTreeView when data has changed



salcin
29th August 2013, 16:43
Hi,

I have made a custom model to display a tree-like data structure. When the user modify one node in the data structure the change will affect all its parents. To calculate the change the node is calling the calculate() method on its parent, the change is traversed upward in the tree. The calculation is done when the root node is reached. During calculation the setData() in the model is not used and thus dataChanged() is not emitted.

What options do I have to solve this?

Is there a way to create an Index from column number, row number and pointer to the node? I could use this index to emit the dataChanged signal from the nodes (maybe via the model).

Santosh Reddy
29th August 2013, 21:24
Is there a way to create an Index from column number, row number and pointer to the node? I could use this index to emit the dataChanged signal from the nodes (maybe via the model).
You need come up with a mechanism to map between the node and mode index, to help on this there is an option of creating index with some custom information in it, i.e. internal pointer or id in the index. The trick is to embedded some node/parent node information in the index while creating it.