问题
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