1 Attachment(s)
About TreeModel and TreeItem?
I want to my programme works as:
http://www.qtcentre.org/forum/attach...1&d=1250211726
My programme has one or more root nodes.
Each node has no or one or more nodes 、leaf.
Each node and leaf have own property ,such as name、icon、ID. Some property will display(such as name),some will not display(such as ID).
I inherit my TreeItem form QStandardItem and inherit my TreeModel from QStandardItemModel. Is it suitable?
I cannot completely understand QStandardItem.Could you give me more helps?Thanks a lot.
Re: About TreeModel and TreeItem?
I think you should try one of the two!
You could use model/view programming or directly use QTreeWidget.
Re: About TreeModel and TreeItem?
Quote:
Originally Posted by
calmspeaker
I think you should try one of the two!
You could use model/view programming or directly use QTreeWidget.
That's not really an answer to OP's question, is it? Or did OP edit the contents of the post?
Quote:
Originally Posted by
yangyunzhao
I want to my programme works as:
[IMG]I inherit my TreeItem form QStandardItem and inherit my TreeModel from QStandardItemModel. Is it suitable?
Yeah it is.
Quote:
Originally Posted by
yangyunzhao
I cannot completely understand QStandardItem.Could you give me more helps?
We can give more help, yes. However, it would be useful for all of us if you could specify what exactly you don't understand.
In general: QStandardItem helps you represent your tree structure in your code and knows how to access one specific piece of data. It will help you keep your actual model implementation simple, because you leave most of the work to the QStandardItem. It has a somewhat similar interface to models.