import QtQuick import QtQuick.Controls import QtQuick.Layouts Window { id: materialdialog minimumWidth: 600 maximumWidth: 600 minimumHeight: 400 maximumHeight: 400 flags: Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint modality: Qt.ApplicationModal title: "" color: "white" visible: false Rectangle { x: 0 y: 0 width: parent.width height: 50 // 设置标题栏高度 color: "#ff3968e9" // 设置标题栏背景色 Text { x: 20 y: 0 width: 80 height: 50 // 设置标题栏高度 text: "超时提醒" font.pixelSize: 25 horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter color: "white" } } Rectangle { x: 0 y: 50 width: parent.width height: 200 color: "white" Text { id: materialdialog_text width: parent.width height: 200 text: "" font.pixelSize: 30 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter color: "#000000" } } DialogButtonBox { id: materialdialog_buttonBox x: 0 y: 300 width: parent.width height: 100 // 自定义按钮 Button { implicitWidth: 120 implicitHeight: 50 text: "关闭" background: Rectangle { color: "#055eb3" radius: 5 } contentItem: Text { text: parent.text font.pixelSize: 30 color: "white" horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } onClicked: { materialdialog.hide(); } } } function timeout_refresh(epoch) { materialdialog_text.text = "物资柜超时未关闭" + epoch + "秒"; } }