For custom path, derive from QGraphicsObject or QGraphicsPathItem ?
-
In a QGraphicsScene, I would like to have my own custom object that essentially draws a QGraphicsPathItem. It should store additional information, however.
I now am unsure how to proceed:
Should I derive from QGraphicsObject, and then insert the QGraphicsPathItem as a child?
Or should I derive from QGraphicsPathItem?
-
In a QGraphicsScene, I would like to have my own custom object that essentially draws a QGraphicsPathItem. It should store additional information, however.
I now am unsure how to proceed:
Should I derive from QGraphicsObject, and then insert the QGraphicsPathItem as a child?
Or should I derive from QGraphicsPathItem?
@QtUser467
You don't want to encapsulate, and add a child. Not that I have ever used it, but useQGraphicsPathItem. Subclass that for your additional information.That will a
QGraphicsItem.QGraphicsObjectis aQGraphicsItemplus aQObject, usually so you can use signals/slots or maybe properties. You can also provide much the same if you need it by multiple-inheriting from aQGraphicsItemclass and aQObject. Don't do so unless you need it.