QT QML 界面设计教程20—— 弹出式窗口

【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

}

你可能感兴趣的:(前端,javascript,html,qml,qt)