I don't think you should subclass QStandardItem. If you want to add the "isOnline" thing, it will be simpler to add a "OnlineRole" role to the model and just use setData(..., OnlineRole)
I don't think you should subclass QStandardItem. If you want to add the "isOnline" thing, it will be simpler to add a "OnlineRole" role to the model and just use setData(..., OnlineRole)
If you need it (do you?) you can treat it a little bit like a copy constructor. It can't be a copy constructor as QStandardItem subclass might want to inherit QObject, so you need a factory method that acts in a simmilar way. Just create an item using operator new and give it the properties of the other item.
aLiNuSh (5th April 2007)
I don't know for sure
The thing is I'm trying to set up a tree view with Groups and Users and I can't find an easy way to set up the model in order to make it easier to move user to groups, delete groups, delete users, drag and drop users, sort the tree and other tasks. So I thought one solution would be subclassing QStandardItem and make a User class and a Group class. I'm gonna think on other solutions as I don't see this one working either.
Thanks for your answer.
Bookmarks