PDA

View Full Version : Tree structure



ikm
7th August 2009, 19:02
Hi, I'm newish to Qt and I have a question about tree structures. I want to build a tree structure like in the model/view introduction on the Qt site:
http://doc.trolltech.com/4.5.1/images/modelview-treemodel.png

I want each row to have multiple items in it. I pretty much want the view to look like what is in the picture. However, when I try various methods to add child items (append and insert methods), it makes each child of an item appear below the parent in its own row like this:
http://doc.trolltech.com/4.5.1/images/treemodel-structure.png

edit: Or, some debug output says there are 3 columns, but only one child item is displayed.

I'm currently using a QAbstractItemModel with QStandardItems in a QTreeView. Any suggestions? Or is this not possible to show with a QTreeView?

franz
7th August 2009, 21:19
Take a look at the Editable Tree Model example (http://doc.trolltech.com/4.5/itemviews-editabletreemodel.html).