forked from zhengtianzuo/QtQuickExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.qml
47 lines (42 loc) · 971 Bytes
/
main.qml
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*!
*@file main.qml
*@brief 主文件
*@version 1.0
*@section LICENSE Copyright (C) 2003-2103 CamelSoft Corporation
*@author zhengtianzuo
*/
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtGraphicalEffects 1.0
ApplicationWindow {
id:mainWidnow
title: qsTr("Qml圆形图片")
width: 400
height: 300
visible: true
Item {
width: 96
height: 96
anchors.centerIn: parent
Image {
id: sourceimage
source: "qrc:/qt.png"
sourceSize: Qt.size(parent.width, parent.height)
smooth: true
visible: false
}
Rectangle {
id: mask
width: parent.width
height: parent.height
radius: height/2
color:"red"
visible: false
}
OpacityMask {
anchors.fill: sourceimage
source: sourceimage
maskSource: mask
}
}
}