Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.7.1
-
None
Description
To properly tool QDeclarativePositioners in Bauhaus (Qt Quick Visual Editor) and to avoid crashes: QGraphicsObject::setParentItem() has to be called instead of QGraphicsItemPrivate::setParentItemHelper() in
QDeclarativeObject::children_append (and also clear).
QDeclarativePositioners relies on the notifications send only by setParentItem() . If only setParentItemHelper() is called QDeclarativePositioners get into an invalid state and eventually access dangling pointers, if used dynamically as in Bauhaus. We also need similar changes in QDeclarative for QDeclarativeItems data property, but here we can rely on the componentComplete flag and we need no behavior change relevant to non Bauhaus code.
proposed solution: We introduce an internal flag (false by default) that defines if children uses QGraphicsObject::setParentItem() (if true) or QGraphicsItemPrivate::setParentItemHelper() (default).
Everybody that does rely on the notifications by QGraphicsObject::setParentItem() can turn on this flag (e. g. Bauhaus).
For QDeclarativeItem we will just use componentComplete to decide if we have to use setParentItem() or setParentItemHelper(). If the component is not complete we use setParentItemHelper(). This is current behavior.
If the component is complete we use setParentItem().