PDA

View Full Version : QStandardItem::type() question



xgoan
7th March 2007, 14:18
Hi,

I have 2 custom items in my model and I want to know any time the exact type of the item.

type() function always returns the 0 type.

Can someone help me?

jpn
7th March 2007, 14:24
Reimplement QStandardItem::type() for the custom types:

Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing QStandardItem, you should reimplement this function and return a new value greater than or equal to UserType.
The default implementation returns QStandardItem::Type which is equal to 0.

xgoan
7th March 2007, 14:39
Yes was a problem with the makefile. Solved... but now...

I have a TreeView with the StandardItemModel populated with "CategoryItem" and a ListView with another StandardItemModel populated with "ObjectItem". When I drag a item from ListView to TreeView it inserts the item right, but when I try to see the type of the "ObjectItem" in the TreeView it returns type 0.