Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
5.4.0 RC
-
None
Description
When setting an effect on an item using the Item::layer.effect property, the children property of item's parent gets polluted with new children.
Test code:
Item{ Rectangle { width: 100 height: 100 color: "green" layer { effect: ColorOverlay { color: "red" } enabled: true } } Rectangle { width: 100 height: 100 color: "green" layer { effect: ColorOverlay { color: "blue" } enabled: true } } Component.onCompleted: { print("Children count : " + children.length) for(var i = 0 ; i < children.length; i++) print("|- " ,children[i]) } }
When printing the item contents we see that there is in fact 6 children in it :
Children count : 6 |- QQuickRectangle(0xcce188) |- QQuickShaderEffectSource(0xccacb8) |- ColorOverlay_QMLTYPE_1(0xccad18) |- QQuickRectangle(0xd059c8) |- QQuickShaderEffectSource(0xd099a8) |- ColorOverlay_QMLTYPE_1(0xcc34b8)
It is not expected that the parent tree gets modified when applying an effect on an item.
This leads to issues in layouts which has been partially fixed (see https://bugreports.qt-project.org/browse/QTBUG-31269
) with a change in QtQuick Positionner but I would expect it to be fixed at the source of the issue in QtQuick Item since there is still issues when some code relies on the children property.
Related topic in the forum : http://qt-project.org/forums/viewthread/40815/