PDA

View Full Version : doubt in padnavigator example



wagmare
13th May 2009, 07:54
hi friends,
i am following the padnavigator example ... /qt4.4.3/example/graphicsview/padnavigator

in this example
in roundrectitem.h
the code is


class RoundRectItem : public QObject, public QGraphicsRectItem
{
Q_OBJECT
public:
RoundRectItem(const QRectF &rect, const QBrush &brush, QWidget *embeddedWidget = 0);


why we want to inherit QObject and also the Q_OBJECT macro .. either one is enough ...?

wysota
13th May 2009, 08:42
Because we want signals and slots to be available for the item - we need to inherit QObject for that and without Q_OBJECT macro one can't add new signals or slots to the class.