[Interest] QGaphicsItem deletion

Konstantin Shegunov kshegunov at gmail.com
Thu Jun 16 16:44:30 CEST 2016


Hello,

On Wed, Jun 15, 2016 at 7:00 PM, Igor Mironchik <igor.mironchik at 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.

Kind regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160616/984ac844/attachment.html>


More information about the Interest mailing list