On Thursday 16 June 2016 17:44:30 Konstantin Shegunov wrote: > Hello, > > On Wed, Jun 15, 2016 at 7:00 PM, Igor Mironchik <igor.mironc...@gmail.com> > > wrote: > > Exactly. I need to Line be as parent of handles but they should be > > parented to the scene (read form in my app) because I need boundingRect() > > to return exactly bounding rectangle of the line without handles. An I > > need > > handles to be removed with the Line if Line deleted. > > I didn't have time to check if the graphics view manages the children the > same way as QObject hierarchies, but there's the QEvent::ChildAdded and > QEvent::ChildRemoved events. If they're fired within the graphics items' > object tree you could intercept them and with a bit of fiddling ultimately > null your handle pointers in Line if Qt had deleted the handles.
It does manage them in a similar way. I had a similar problem, where QGraphicsItems where managed by real QObjects and of course belonged to a QGraphicsScene derived class. The dtor of my class is GeoMapScene::~GeoMapScene() { emit aboutToBeDestroyed(this); } This signal is emitted before the dtor of QGraphicsScene comes into play. It is catched by the managing QObject and informs them of the coming death of their QGraphicsItems. -- Best Regards Reinhardt _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest