tags:

views:

56

answers:

1

I was trying to inherit from QGraphicsEllipseItem 'cause i wanted to add some functionality to it. However i was faced with this error, which probably has something to do with the compiler/precompiler or moc?

error: 'staticMetaObject' is not a member of 'QGraphicsEllipseItem'

And here's the class code:

class MyEllipseItem : public QGraphicsEllipseItem
{
    Q_OBJECT

public:
    MyEllipseItem (const QRectF & outline) : QGraphicsEllipseItem(outline)
    {

    }
};
+3  A: 

QGraphicsEllipseItem is not QObject, so just remove Q_OBJECT from class declaration.

Max
Perfect, thanks! Would be nice if you could use a subclass of QGraphicsEllipseItem as a QObject as well, so you could use signals and slots with it.
JHollanti
You still could use composition to achieve this. Just add to your class the attribute of some type, inherited from QObject.
Max
Yeah, nice workaround.
JHollanti