Image rounded corners in QML

前端 未结 7 1091
遇见更好的自我
遇见更好的自我 2020-12-14 06:25

To my surprise, the Image component has no radius property. I tried emulating the rounded corners by putting the image in a rounded Rectangle

7条回答
  •  生来不讨喜
    2020-12-14 06:44

    If you have a unicolor background, you can draw with the border of a rounded rectangle on top.

    Image{
        id:img
    }
    Rectangle { // rounded corners for img
        anchors.fill: img
        color: "transparent"
        border.color: "blue" // color of background
        border.width: 4
        radius: 4
    }
    

提交回复
热议问题