代码比较简单,就不细讲了,大家直接看下面源码吧!如果对你有所帮助,可以帮角角点个关注嘛?
import QtQuick
import QtQuick.Effects
import Qt5Compat.GraphicalEffectsWindow {width: 640height: 480visible: truetitle: qsTr("Round Image Test")//原图片Image {id: bugsource: "img/111.jpg"width: 200; height: 200smooth: truevisible: false}//MaskSourceRectangle {id: maskwidth: 200; height: 200; radius: width /2smooth: truevisible: false}//Effect AppliedOpacityMask {anchors.fill: bugsource: bugmaskSource: mask}//图片圆形外框Rectangle {width: 200; height: 200; radius: width /2color: "transparent"border.width: 6; border.color: "pink"}
}
如果你的 Qt Creator 显示找不到 Qt5Compat.GraphicalEffects,请查阅我的上一篇文章:《qml找不到GraphicalEffects???》