You can cast all the items of the list.
if(static_cast<QGraphicsRectItem*>( myList.at(i)) != 0){//it's a rectangle}
if(static_cast<QGraphicsRectItem*>( myList.at(i)) != 0){//it's a rectangle}
To copy to clipboard, switch view to plain text mode
agh, I've seen now you have subclassed them. So you can cast using qgraphicsitem_cast instead. But, at the beginning of each clas you'll need to add:
enum { Type = UserType + 1 }; //+1 because it's the first class, the next subclassed class will be +2 and so on
int type() const
{
// Enable the use of qgraphicsitem_cast with this item.
return Type;
}
enum { Type = UserType + 1 }; //+1 because it's the first class, the next subclassed class will be +2 and so on
int type() const
{
// Enable the use of qgraphicsitem_cast with this item.
return Type;
}
To copy to clipboard, switch view to plain text mode
Bookmarks