[Qt-qml] Why child object overrides parent borders

Zharkyn Kassenov _light at mail.ru
Wed Aug 18 05:48:48 CEST 2010


Hi

I create parent and child rectangles. Parent rectangle have borders, clip property is true. Size of child rectangle is biggest than size of parent rectangle. And the borders of parent rectangle is not visible. Why child rectangle override borders of parent rectangle?

import Qt 4.7

Rectangle {
    id: scene
    width: 200
    height: 200

    Rectangle {
        id: rectangle1
        x: 43
        y: 37
        width: 114
        height: 75
        color: "#cbf7cb"
        border.width: 1
        border.color: "#000000"
        transformOrigin: "Center"
        clip: true

        Rectangle {
            id: rectangle2
            width: 158
            height: 56
            color: "#c1c9f3"
            anchors.top: parent.top
            anchors.topMargin: 1
            anchors.left: parent.left
            anchors.leftMargin: 1
        }
    }
}


Thanks,
Zharkyn



More information about the Qt-qml mailing list