QStandardItem subclassing?
-
You normally should not need to subclass QStandardItemModel itself, you should be able to use it without subclassing.
Anyway, your call to setItemPrototype should work. However, did you think to reimplement the QStandardItem::clone() method to return an instance of your own class?
-
Are you sure about that space between operator < ?
And yes, thanks to polymorphism, your own function should be called if it actually is an object of your own type. How do you actually set your items? The prototype is just for editing and things like that. How do you fill your model?
-
So, extract the relevant sections yourself, or create a small, self-contained example that shows the problem. Also, when posting code, please use @ tags around your code section (I already updated your post in this case) to improve readability.
Your code, as far as I can oversee it, looks fine to me. I have no idea why it should fail.
-
I dont know how to reimplement method item, that it will return myItem, i looked into the sourcecodes, but i dont know what to do... a just think about copy data from myModel->item(r,c); but the method return the pointer, and i will then dont return the exact pointer
@QStandardItem *QStandardItemModel::item(int row, int column) const
{
Q_D(const QStandardItemModel);
return d->root->child(row, column);
}@and i think about the reimplementing the setItem, because i dont know either how to do it :(
i dont know what to do... sources doesnt help me much, that are so many functions i cant use