【Qt6】窗口圆角
Window {
id: window
visible: true
title: qsTr("Hello World")
color: "transparent" // 设置窗口背景透明
width: 1317
height: 714 // 933
// 无边框
flags: Qt.FramelessWindowHint // 无边框
| Qt.Window // 任务栏图标
Rectangle{
id: innerWindow
anchors.fill: parent
anchors.margins: 5
radius: 10
// 圆角透明遮罩
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Rectangle {
width: innerWindow.width
height: innerWindow.height
radius: innerWindow.radius
}
}
}
Rectangle的clip在qt6中不再生效

浙公网安备 33010602011771号