Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the advantages of QAbstractItemModel over QStandardItemModel?

I want to store custom data using a model. For that , am a bit confused as which item model to choose for subclassing. I need some clarification as, which is the best model to subclassing ? And also i need the advantages of QAbstractItemModel over QStandardItemModel ?

Thanks!

like image 651
Dev Avatar asked May 09 '12 06:05

Dev


1 Answers

It depends on your needs. Use QStandardItemModel if you just want to store custom data and don't want to write your own model logic. This one is generic, you can use it for custom data without subclassing.

On the other way, if you wish to write your own model logic, then choose QAbstractItemModel. It is abstract class. It means, it has no behavior implemented, it is just an 'interface'. It tells you which methods your model should implement, so it can be used as ano other ItemModel class in Qt.

like image 112
Kousalik Avatar answered Nov 09 '22 13:11

Kousalik