QTreeView or QTreeWidget

后端 未结 1 1472
萌比男神i
萌比男神i 2021-02-20 17:27

I want to implement in my program a tree with nested sub-levels, and I\'m looking for which of those two kind(View/Widget) is best suited for my goal.

I have a list of d

相关标签:
1条回答
  • 2021-02-20 18:23

    If your data is stored in a database model or if you want to have a single data model and show it in some views in different ways, then you are definitely better to go with QTreeView.

    But QTreeWidget has it's internal model in some way along with the methods to deal with model in context of indexes. In general if you just want something that is simple to work, you can use the widget way.

    But the Model/View approach is more general and flexible IMO. You can create your own subclasses of model and view which enables you to do whatever you like.

    0 讨论(0)
提交回复
热议问题