相关疑难解决方法(0)

QML中的图像圆角

令我惊讶的是,该Image组件没有radius属性.我尝试通过将图像放在圆形中来模拟圆角Rectangle,但它不会剪切角落.

Rectangle {
    anchors.right: rectContentBg.left
    anchors.top: rectContentBg.top
    anchors.margins: 8

    radius: 8

    width: 64
    height: 64

    Image {
        id: imgAuthor

        opacity: 1
        smooth: false

        anchors.fill: parent

        source: "qrc:/res/sample_avatar.jpg"
    }
}
Run Code Online (Sandbox Code Playgroud)

如何正确创建圆角图像?

qml qt5 qtquick2

34
推荐指数
7
解决办法
2万
查看次数

标签 统计

qml ×1

qt5 ×1

qtquick2 ×1