[Qt-qml] Row relayout on item destroy
michael.brasser at nokia.com
michael.brasser at nokia.com
Wed Oct 6 08:06:42 CEST 2010
On 05/10/2010, at 5:33 AM, ext Adriano Rezende wrote:
> I noticed that when a Row's child item is destroyed, the Row does not
> reconfigure its geometry sometimes.
>
> Follows a code to reproduce this behavior:
>
> ======================================================
> import Qt 4.7
>
> Item {
> width: 600
> height: 300
>
> MouseArea {
> anchors.fill: parent
> onClicked: itemComponent.createObject(row);
> }
>
> Row {
> id: row
> spacing: 2
> }
>
> Component {
> id: itemComponent
>
> Rectangle {
> id: item
> width: 80
> height: 80
> color: "red"
>
> MouseArea {
> anchors.fill: parent
> onClicked: {
> // item.visible = false; // XXX: workaround to relayout
> item.destroy();
> }
> }
> }
> }
> }
> =====================================================
>
> Looking at the Positioner's code
> (QDeclarativeBasePositioner::itemChange() method), it seems that it
> fails to cast to QDeclarativeItem in this case.
>
> Someone knows if this is a bug?
I wasn't able to reproduce this on my machine, but from the description it sounds like it is only failing intermittently for you? In any case, Row should always relayout when a child is destroyed (though note that the QML destroy() calls deleteLater() than than deleting immediately); if it doesn't then yes it is a bug.
Regards,
Michael
More information about the Qt-qml
mailing list