Qt 如何不将ListView委托的子代与其他委托一起剪裁

Qt 如何不将ListView委托的子代与其他委托一起剪裁,qt,qml,Qt,Qml,这是QML的ListView,青色矩形是单个委托。我想在盘旋时放大那些圆圈。问题是它被下面的代表打断了——这是完全可以预料到的,但是我如何克服这种行为呢 下面是示例的代码: import QtQuick 2.7 import QtQuick.Controls 1.4 ApplicationWindow { id: rootWindow visible: true width: 640 height: 480 color: "white" Li

这是QML的ListView,青色矩形是单个委托。我想在盘旋时放大那些圆圈。问题是它被下面的代表打断了——这是完全可以预料到的,但是我如何克服这种行为呢

下面是示例的代码:

import QtQuick 2.7
import QtQuick.Controls 1.4

ApplicationWindow {
    id: rootWindow

    visible: true
    width: 640
    height: 480
    color: "white"

    ListView {
        anchors.fill: parent
        model: 15
        spacing: 5
        delegate: Rectangle {
            width: parent.width
            height: 30
            color: "cyan"
            border.width: 1
            border.color: "black"
            clip: false

            Rectangle {
                property real k: mouseArea.containsMouse ? 5 : 1
                anchors.centerIn: parent
                height: parent.height * 0.5 * k
                width: height
                radius: width / 2
                color: "yellow"
                border.width: 1
                border.color: "black"

                MouseArea {
                    id: mouseArea
                    anchors.fill: parent
                    hoverEnabled: true
                }

                Behavior on k { PropertyAnimation { } }
            }

            // layer.enabled: true // why this clips childs ???
        }
    }
}

其他问题:为什么为代理启用的layer.enabled开始剪辑其子对象?如果此属性设置为true,是否有删除剪辑的方法?

当代理悬停时,只需提高
z
-值,以便悬停的代理将呈现在其余代理之上

import QtQuick 2.7
import QtQuick.Controls 1.4

ApplicationWindow {
    id: rootWindow

    visible: true
    width: 640
    height: 480
    color: "white"

    ListView {
        anchors.fill: parent
        model: 15
        spacing: 5
        delegate: Rectangle {
            width: parent.width
            height: 30
            color: "cyan"
            border.width: 1
            border.color: "black"
            clip: false

 //*********v see this line!               
            z: mouseArea.containsMouse ? 2 : 1

            Rectangle {
                property real k: mouseArea.containsMouse ? 5 : 1
                anchors.centerIn: parent
                height: parent.height * 0.5 * k
                width: height
                radius: width / 2
                color: "yellow"
                border.width: 1
                border.color: "black"

                MouseArea {
                    id: mouseArea
                    anchors.fill: parent
                    hoverEnabled: true
                }

                Behavior on k { PropertyAnimation { } }
            }
        }
    }
}

clip:false
矩形
组件中工作吗?@DJMcMayhem是的,工作正常(没有图层。启用:true)<默认情况下,代码>剪辑对于代理AFAIK是禁用的,因此这一行实际上是多余的。对于您的附加问题,请提出附加问题,因为它甚至与第一个问题无关。可能您试图提高黄色圆圈本身的
z
-值,而不是代理的根