MaterialDialog.qml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import QtQuick
  2. import QtQuick.Controls
  3. import QtQuick.Layouts
  4. Window {
  5. id: materialdialog
  6. minimumWidth: 600
  7. maximumWidth: 600
  8. minimumHeight: 400
  9. maximumHeight: 400
  10. flags: Qt.Dialog | Qt.WindowStaysOnTopHint | Qt.FramelessWindowHint
  11. modality: Qt.ApplicationModal
  12. title: ""
  13. color: "white"
  14. visible: false
  15. Rectangle {
  16. x: 0
  17. y: 0
  18. width: parent.width
  19. height: 50 // 设置标题栏高度
  20. color: "#ff3968e9" // 设置标题栏背景色
  21. Text {
  22. x: 20
  23. y: 0
  24. width: 80
  25. height: 50 // 设置标题栏高度
  26. text: "超时提醒"
  27. font.pixelSize: 25
  28. horizontalAlignment: Text.AlignLeft
  29. verticalAlignment: Text.AlignVCenter
  30. color: "white"
  31. }
  32. }
  33. Rectangle {
  34. x: 0
  35. y: 50
  36. width: parent.width
  37. height: 200
  38. color: "white"
  39. Text {
  40. id: materialdialog_text
  41. width: parent.width
  42. height: 200
  43. text: ""
  44. font.pixelSize: 30
  45. horizontalAlignment: Text.AlignHCenter
  46. verticalAlignment: Text.AlignVCenter
  47. color: "#000000"
  48. }
  49. }
  50. DialogButtonBox {
  51. id: materialdialog_buttonBox
  52. x: 0
  53. y: 300
  54. width: parent.width
  55. height: 100
  56. // 自定义按钮
  57. Button {
  58. implicitWidth: 120
  59. implicitHeight: 50
  60. text: "关闭"
  61. background: Rectangle {
  62. color: "#055eb3"
  63. radius: 5
  64. }
  65. contentItem: Text {
  66. text: parent.text
  67. font.pixelSize: 30
  68. color: "white"
  69. horizontalAlignment: Text.AlignHCenter
  70. verticalAlignment: Text.AlignVCenter
  71. }
  72. onClicked: {
  73. materialdialog.hide();
  74. }
  75. }
  76. }
  77. function timeout_refresh(epoch)
  78. {
  79. materialdialog_text.text = "物资柜超时未关闭" + epoch + "秒";
  80. }
  81. }