QML学习
main.qml
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
Button {
text: "发消息"
onClicked: {
if (!popup.opened) {
popup.close()
}
popup.open()
}
}
Popup {
id: popup
x: parent.width / 2 - width / 2
y: parent.height / 5
// 弹窗模态
modal: false
// 触发弹窗关闭方式
closePolicy: Popup.NoAutoClose
// 弹窗背景视图
background: Rectangle {
color: "transparent&#