FANGYEFENG

May 23, 2024

QML圆角图像

RoundImage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import QtQuick
import Qt5Compat.GraphicalEffects

Item {
id:root
implicitHeight: 36
implicitWidth: 36
property alias source: image.source
property real radius:10

Image {
id: image
sourceSize: Qt.size(parent.width, parent.height)
smooth: true
visible: false
}

Rectangle {
id: mask
anchors.fill: parent
smooth: true
visible: false
radius: root.radius
}

OpacityMask {
anchors.fill: image
source: image
maskSource: mask
}
}
OLDER > < NEWER