PDA

View Full Version : How to use "Simple Tree Model" Example?



Markus
28th January 2014, 01:49
Hello All,

I have not worked with an QAbstractItemModel before and I am using the Simple Tree Model http://qt-project.org/doc/qt-4.8/itemviews-simpletreemodel.html.
It runs fine but I am not sure how to make that TreeView show any changes I apply to the data of the tree.
The example creates all tree items in the constructor of the model but when I add them outside the constructor the view does not get updated.
Can someone fill in the gaps?

Thanks
Markus

ChrisW67
28th January 2014, 01:53
"The Simple Tree Model example shows how to create a basic, read-only hierarchical model to use with Qt's standard view classes."

The example does not provide the necessary mechanisms to modify data in the tree (setData(), insertRows(), insertColumns(), flags()) or advise views of changes/insertions/deletions (numerous signals).

Markus
28th January 2014, 02:37
Ahh, makes sense. So the "Editable Tree Model Example" would be of more help then?