简介
随便准备一张图片,只有矩形的,我想加载成圆形。
引入:import QtGraphicalEffects 1.0
Rectangle{
id:rect_Logo
width: parent.width * 0.3
height: parent.width * 0.3
radius: width / 2
color: "#FE958F"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.verticalCenterOffset: -100
visible: false
}
Image{
id:image_Logo
anchors.centerIn: rect_Logo
source: "Images/OIP-C.jpg"
visible: false
smooth:true
}
OpacityMask {
anchors.fill: rect_Logo
source: image_Logo
maskSource: rect_Logo
}