Important: Please read the Qt Code of Conduct -

Tree model with different "types" of items. (QAbstractItemModel implem, QTreeView)

  • Hi guys!
    I would like to ask some general question this time. In my project I have "tree like" structure. This structure contains very different types of item. In fact type of item depends on it level in the tree. So, is it a good idea to implement my own QAbstractItemModel subclass TreeModel which will provide interface to QTreeView in this case? I hesitate, because i don't have any experience with Tree Model implementation, and I am afraid of different obstacles related with the fact that my original data structure contains absolutely different types of items, which means that it will be impossible to provide some common interface for all types of items.
    Really hope to get any advice ; )

  • If you do not try you never would be able to discover how difficult or easy it is,
    By the way for tree like structures you may consider QStandardItemModel.

Log in to reply