I am trying to make the first image, look like the second image


The goal to is to clip the green child rect to match the inside radius and edge bounds of the parent rect. Unfortunately, the clip property on a QML Rectangle only clips children to the bounding rect of the parent object, meaning radius is excluded in the clipping.
Most of the solutions suggested online use either a OpacityMask (Qt5) or a MultiEffect (Qt6) QML object to achieve said effect. I would prefer to stick with Qt6 native objects instead of deprecated Qt5 versions and I have tried many variations of using MutiEffect with none working.
In a basic example, I'm looking at something like this:
Rectangle
{
id: parentRect
width: 300
height: 300
anchors.centerIn: parent
color: "blue"
radius: 50
Rectangle
{
id: childRect
color: "green"
anchors.bottom: parent.bottom
height: parent.height * 0.1
width: parent.width
}
}
MultiEffect
{
source: childRect
anchors.fill: childRect
maskEnabled: true
maskSource: parentRect
}
The desired result is that the childRect is clipped to the radius of the parentRect making the illusion that the rect is "running off" the edge of the parentRect without actually spilling over.
I have tried many other variations of the above code snippet with no success (including other answers on SO to related questions). I don't want to include all of that code in this question, but I would be happy to provide more details on what else I've tried in the comments if needed.
Can this effect be achieved using QML and MultiEffect? Or do I have to use some other solution for Qt6? I would find it hard to believe if something this (seemingly) simple could not be done in QML.
