Lock children inside parent
-
Hi.
I'm trying to make a drop down animation. I face the problem that the child rectangle is showed on top, and hence outside the parent rectangle. Is it not possible to have the children "inside" the parent??
In the below code, the redRect is always visible. The animation works fine (except the fact that the red square is always shown).
@import QtQuick 2.0
Rectangle {
width: 100
height: 10Behavior on height { NumberAnimation { easing.type: Easing.OutQuad; duration: 400 } } function hide() { height = 0; } function show() { height = childrenRect.height } Rectangle { id: redSquare width: 50; height: 50 color: "red" }
}@
-
Hi Hykkel,
If I understand right, what your are looking for is the "clip" property. It ensures that children are visible only inside parent surface.
@
import QtQuick 2.0Rectangle {
clip: true
...
}@Note that this clipping test costs CPU usage.
Regards