PromptInfo.qml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import QtQuick
  2. import QtQuick.Controls
  3. import QtQuick.Layouts
  4. Item {
  5. id: prompt_info
  6. x: parent.width / 2 - 175
  7. y: parent.height / 2 - 175
  8. width: 350
  9. height: 350
  10. visible: false
  11. property int promptInfoTimeout: 0;
  12. property string promptInfoText: "";
  13. property string promptInfoIcon: "";
  14. property string promptInfoColor: "";
  15. Connections {
  16. target: prompt_info
  17. onPromptInfoTextChanged:
  18. {
  19. prompt_info_notice.text = promptInfoText;
  20. }
  21. onPromptInfoIconChanged:
  22. {
  23. prompt_info_image.source = promptInfoIcon;
  24. }
  25. onPromptInfoColorChanged:
  26. {
  27. prompt_info_rect.color = promptInfoColor;
  28. }
  29. }
  30. Rectangle {
  31. id: prompt_info_rect
  32. anchors.fill: parent
  33. color: "#66ea3a0e"
  34. radius: 20
  35. Column {
  36. x: 0
  37. y: 0
  38. width: 350
  39. height: 350
  40. visible: true
  41. spacing: 30
  42. padding: 0
  43. topPadding: 46
  44. Image {
  45. id: prompt_info_image
  46. width: 200
  47. height: 200
  48. opacity: 0.5
  49. anchors.horizontalCenter: parent.horizontalCenter
  50. source: "qrc:/png/error.png"
  51. }
  52. Label {
  53. id: prompt_info_notice
  54. width: parent.width
  55. anchors.horizontalCenter: parent.horizontalCenter
  56. color: "#9affffff"
  57. text: qsTr("")
  58. font.pixelSize: 25
  59. horizontalAlignment: Text.AlignHCenter
  60. verticalAlignment: Text.AlignVCenter
  61. wrapMode: Text.WrapAnywhere
  62. font.bold: true
  63. }
  64. }
  65. }
  66. Timer {
  67. interval: 1000
  68. running: true
  69. repeat: true
  70. onTriggered: {
  71. if(promptInfoTimeout > 0)
  72. {
  73. if (prompt_info.visible === false)
  74. {
  75. prompt_info.visible = true;
  76. }
  77. promptInfoTimeout--;
  78. }
  79. else{
  80. prompt_info.visible = false;
  81. }
  82. }
  83. }
  84. }