功能:将方形图片显示为圆形图片
import QtQuick 2.9
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0
Window {
visible: true
width: 640
height: 480
title: qsTr("Hello World")
color: "blue"
Rectangle {
id: img
width: 57
height: 57
radius: width/2
color: "black"
ImageNormal {
id: _image
smooth: true
visible: false
anchors.fill: parent
imageSource: "file:///tmp/2"
//sourceSize: Qt.size(parent.size, parent.size)
antialiasing: true
}
Rectangle {
id: _mask
anchors.fill: parent
radius: width/2
visible: false
antialiasing: true
smooth: true
}
OpacityMask {
id:mask_image
anchors.fill: _image
source: _image
maskSource: _mask
visible: true
antialiasing: true
}
}
}