DialogQuery.qml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. import QtQuick 1.1
  2. DialogLiquid {
  3. id: dlgQuery
  4. signal clickedOk
  5. signal clickedCancel
  6. property string title: ""
  7. property int fontTitleSize: 24
  8. property string text: ""
  9. property int fontTextSize: 22
  10. property string textButtonOk: "Ok"
  11. property string textButtonCancel: "Cancel"
  12. width: parent.width*0.9
  13. height: headerDlg.height + dlgText.height + rowButtons.height + dlgText.anchors.topMargin + rowButtons.anchors.topMargin + 20
  14. Rectangle {
  15. id: headerDlg
  16. anchors.top: parent.top
  17. anchors.left: parent.left
  18. width: parent.width
  19. height: 70
  20. gradient: Gradient {
  21. GradientStop { position: 0; color: "#919191" }
  22. GradientStop { position: 1; color: "#666666" }
  23. }
  24. Text {
  25. anchors.centerIn: parent
  26. font.pixelSize: dlgQuery.fontTitleSize
  27. color: "white"
  28. text: dlgQuery.title
  29. }
  30. }
  31. Text {
  32. id: dlgText
  33. anchors.top: headerDlg.bottom; anchors.topMargin: 20
  34. anchors.left: parent.left; anchors.leftMargin: 10
  35. font.pixelSize: dlgQuery.fontTextSize
  36. width: parent.width - 10
  37. text: dlgQuery.text
  38. clip: true
  39. HorizontalGradient {
  40. anchors.left: parent.left
  41. anchors.top: parent.top
  42. height: parent.height
  43. width: parent.width
  44. gradient: Gradient {
  45. GradientStop { color: "transparent"; position: 0 }
  46. GradientStop { color: "transparent"; position: 0.8 }
  47. GradientStop { color: "white"; position: 0.95 }
  48. GradientStop { color: "white"; position: 1 }
  49. }
  50. }
  51. }
  52. /****************************************************/
  53. Row {
  54. id: rowButtons
  55. anchors.top: dlgText.bottom; anchors.topMargin: 20
  56. anchors.left: parent.left; anchors.leftMargin: 10
  57. spacing: 20
  58. Button {
  59. id: buttonOk
  60. height: 70
  61. text: textButtonOk
  62. width: dlgQuery.width/2 - 20
  63. onClicked: {
  64. dlgQuery.clickedOk()
  65. dlgQuery.state = "hidden"
  66. }
  67. }
  68. Button {
  69. id: buttonCancel
  70. height: 70
  71. text: textButtonCancel
  72. width: dlgQuery.width/2 - 20
  73. onClicked: {
  74. dlgQuery.clickedCancel()
  75. dlgQuery.state = "hidden"
  76. }
  77. }
  78. }
  79. /****************************************************/
  80. }