Custom Model for TableView or QStandardItemModel

孤者浪人 提交于 2019-12-25 18:20:38

问题


I want to create a TableView with two columns:

  • The first one for a parameter name
  • The second one with the parameter value, which could be a float, bool, int or a string

The second column should be editable, and a bool should be represented by a checkbox. For this model, should I subclass QAbstractItemModel or would the QStandardItemModel be fitting? Also, should one item have the two properties name and value, or should this be better seperated into two items?


回答1:


It depends on your subject field. If you have big number of parameters then you should subclass QAbstractItemModel, because in the other case time of data view will be significant, if not QStandardItemModel is quite simple for this purpose.



来源:https://stackoverflow.com/questions/49389489/custom-model-for-tableview-or-qstandarditemmodel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!