in the documentation there's a sample that inherits both QObject and QGraphicsItem. Deoesn't QGraphicsItem inherits QObject? I looked at the Qt Assistant but it doesn't give info about that.
{
Q_OBJECT
public:
Mouse();
protected:
private:
qreal angle;
qreal speed;
qreal mouseEyeDirection;
};
class Mouse : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
Mouse();
QRectF boundingRect() const;
QPainterPath shape() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
protected:
void timerEvent(QTimerEvent *event);
private:
qreal angle;
qreal speed;
qreal mouseEyeDirection;
QColor color;
};
To copy to clipboard, switch view to plain text mode
Bookmarks