在QML中,可以使用属性'radius'来设置Rectangle的圆角。如果需要设置不同的圆角半径,可以使用属性'topLeftRadius'、'topRightRadius'、'bottomLeftRadius'和'bottomRightRadius'来分别设置左上角、右上角、左下角和右下角的圆角半径。

如果只需要设置左上角和右上角的圆角,可以这样写:

Rectangle {
    width: 100
    height: 100
    radius: 10 // 设置所有圆角半径为10
    topLeftRadius: 10 // 设置左上角圆角半径为10
    topRightRadius: 10 // 设置右上角圆角半径为10
}

这样就可以只设置左上角和右上角的圆角了。

QML Rectangle 设置两个圆角:左上角和右上角

原文地址: https://www.cveoy.top/t/topic/g3ah 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录