qml 虚线边框绘制

    Rectangle{
        width: 400
        height: 100
        anchors.centerIn: parent
        Column{
            width:1
            height:parent.height
            spacing: 5
            clip: true
            anchors.left: parent.left
            Repeater{
                anchors.fill: parent
                model: parent.height/10
                delegate:Rectangle{
                    width: 1
                    height: 10
                    color: "black"
                }
            }
        }
        Column{
            width:1
            height:parent.height
            spacing: 5
            clip: true
            anchors.right: parent.right
            Repeater{
                anchors.fill: parent
                model: parent.height/10
                delegate:Rectangle{
                    width:1
                    height: 10
                    color: "black"
                }
            }
        }
        Row{
            width: parent.width
            height: 1
            spacing: 5
            clip: true
            anchors.top: parent.top
            Repeater{
                anchors.fill: parent
                model: parent.width/10
                delegate:Rectangle{
                    width: 10
                    height: 1
                    color: "black"
                }
            }
        }
        Row{
            width: parent.width
            height: 1
            spacing: 5
            clip: true
            anchors.bottom: parent.bottom
            Repeater{
                anchors.fill: parent
                model: parent.width/10
                delegate:Rectangle{
                    width: 10
                    height: 1
                    color: "black"
                }
            }
        }
    }


版权声明:本文为zs1123原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。