[Qt-qml] Row relayout on item destroy

Adriano Rezende adriano.rezende at openbossa.org
Mon Oct 4 21:33:09 CEST 2010


Hi,

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?

Br,
Adriano



More information about the Qt-qml mailing list