The Items, QGraphicsItem

This is the base class of all items drawn on the scene. It contains various methods and properties to deal with drawing each item, collision detection (with other items), handling mouse clicks and other events, and much more. Even though you can subclass it and create your own graphical items, Qt provides a set of subclasses too, which can be used for most (if not all) of the daily graphical tasks. Here are those subclasses, some of which we already used in the previous examples, directly or indirectly:

  • QGraphicsEllipseItem
  • QGraphicsLineItem
  • QGraphicsPathItem
  • QGraphicsPixmapItem
  • QGraphicsPolygonItem
  • QGraphicsRectItem
  • QGraphicsSimpleTextItem
  • QGraphicsTextItem

As it was previously mentioned, QGraphicsItem provides ...

Get Computer Vision with OpenCV 3 and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.