tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 01:19:32 +0300
changeset 37 758a864f9613
parent 33 3e2da88830cd
permissions -rw-r--r--
Revision: 201037 Kit: 201039

import Qt 4.7

Rectangle {
    width:360;
    height: 200

    Item {
        objectName: "theItem"
        anchors.centerIn: parent
        width: childrenRect.width
        height: childrenRect.height
        Rectangle {
            id: header1
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.top: parent.top
            width: 100; height: 50
            color: "green"
        }
        Rectangle {
            id: text1
            anchors.top: header1.bottom
            anchors.topMargin: 10
            anchors.horizontalCenter: parent.horizontalCenter
            width: 100; height: 50
            color: "blue"
        }
    }

    states: [
    State {
        name: "row"
        AnchorChanges {
            target: header1
            anchors.horizontalCenter: undefined
            anchors.verticalCenter: parent.verticalCenter
            anchors.left: parent.left
            anchors.top: undefined
        }
        AnchorChanges {
            target: text1
            anchors.horizontalCenter: undefined
            anchors.verticalCenter: parent.verticalCenter
            anchors.top: undefined
            anchors.left: header1.right
        }
        PropertyChanges {
            target: text1
            anchors.leftMargin: 10
            anchors.topMargin: 0
        }
    }
    ]
}