import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.5
import QtGraphicalEffects 1.0
ApplicationWindow {
id:root
visible: true
width:400
height: 300
minimumWidth: width
maximumWidth: width
minimumHeight:height
maximumHeight:height
flags: Qt.FramelessWindowHint
modality:Qt.ApplicationModal
color: "#00000000"
Rectangle{
id:inrec
anchors.fill:parent
radius:30
opacity:1
layer.enabled: true
layer.effect: OpacityMask {
maskSource: Rectangle {
width: inrec.width
height: inrec.height
radius: inrec.radius
}
}
MouseArea {
x:0
y:0
anchors.fill: parent
acceptedButtons: Qt.LeftButton
property point clickPos: "0,0"
onPressed: {
clickPos = Qt.point(mouse.x,mouse.y)
}
onPositionChanged: {
var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
root.setX(root.x+delta.x)
root.setY(root.y+delta.y)
}
}
Image{
anchors.fill: parent
source:"qrc:/back.jpg"
smooth:true
}
Button{
id:xinjiangongcheng
x:root.width/2-width/2
y:60
width:100
height:30
text: qsTr("新建工程")
onClicked: {
camera.newProjectUrl()
}
}
Button{
id:dakaigongcheng
x:xinjiangongcheng.x
y:120
width:100
height:30
text: qsTr("打开工程")
onClicked: {
camera.openProjectUrl()
}
}
Button{
id:quxiao
x:xinjiangongcheng.x
y:180
width:100
height:30
text: qsTr("退出")
onClicked: {
Qt.quit()
}
}
}
}
QML实现圆角Window
最新推荐文章于 2025-06-17 17:13:31 发布