【1】代码MyPopWindow.qml
Popup {
id: testWindow
width: 0
height: 0
modal: true
closePolicy: Popup.CloseOnEscape
Rectangle {
x: 0
y: 0
width: 700
height: 350
border.color: "black"
border.width: 2
Button {
x: 0
y: 0
text: "close"
onClicked: {
testWindow.visible = false
}
}
}
}
【2】 调用
MyPopWindow{
id:test
}