in the documentation there's a sample that demonstrates Graphics View Framework. The class DiagramItem inherits QGraphicsPolygonItem but it doesn't override the mouse events, so how can it answer to the mouse events?
here's the code:(copied from the QT Documentation):
Qt Code:
  1. class DiagramItem : public QGraphicsPolygonItem
  2. {
  3. public:
  4. enum { Type = UserType + 15 };
  5. enum DiagramType { Step, Conditional, StartEnd, Io };
  6.  
  7. DiagramItem(DiagramType diagramType, QMenu *contextMenu,
  8. QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
  9.  
  10. void removeArrow(Arrow *arrow);
  11. void removeArrows();
  12. DiagramType diagramType() const
  13. { return myDiagramType; }
  14. QPolygonF polygon() const
  15. { return myPolygon; }
  16. void addArrow(Arrow *arrow);
  17. QPixmap image() const;
  18. int type() const
  19. { return Type;}
  20.  
  21. protected:
  22. void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
  23. QVariant itemChange(GraphicsItemChange change, const QVariant &value);
  24.  
  25. private:
  26. DiagramType myDiagramType;
  27. QPolygonF myPolygon;
  28. QMenu *myContextMenu;
  29. QList<Arrow *> arrows;
  30. };
To copy to clipboard, switch view to plain text mode