DialogSmiles.qml 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import QtQuick 1.1
  2. DialogLiquid {
  3. id: dlgSmiles
  4. signal clickedOk
  5. signal clickedCancel
  6. property string title: ""
  7. property int fontTitleSize: 24
  8. width: parent.width*0.9
  9. height: parent.height*0.4
  10. color: "white"
  11. border.color: "gray"
  12. border.width: 3
  13. smooth: true
  14. property alias smilesModel: smilesGrid.model
  15. signal smileSelected()
  16. property string selectedSmile: ""
  17. /****************************************************/
  18. GridView {
  19. id: smilesGrid
  20. clip: true
  21. anchors.top: parent.top
  22. anchors.left: parent.left
  23. height: parent.height
  24. width: parent.width
  25. delegate: componentSmileWrapper
  26. cellWidth: screen.orientationString == "Landscape" || screen.orientationString == "LandscapeInverted" ? 0.8*parent.width/8 : 0.8*parent.width/4
  27. cellHeight: cellWidth
  28. }
  29. Component {
  30. id: componentSmileWrapper
  31. Rectangle {
  32. id: smileWrapper
  33. color: "transparent"
  34. height: smilesGrid.cellHeight
  35. width: smilesGrid.cellWidth
  36. Image {
  37. id: imgSmile
  38. anchors.centerIn: parent
  39. height: parent.height*0.6
  40. width: parent.width*0.6
  41. smooth: true
  42. source: "file://" + smilePicture
  43. }
  44. MouseArea {
  45. id: ma
  46. anchors.fill: parent
  47. onClicked: {
  48. dlgSmiles.selectedSmile = smileText
  49. dlgSmiles.smileSelected()
  50. animSelectedSmile.start()
  51. }
  52. }
  53. SequentialAnimation {
  54. id: animSelectedSmile
  55. ParallelAnimation {
  56. NumberAnimation {
  57. target: imgSmile;
  58. property: "scale";
  59. from: 1; to: 2
  60. duration: 300;
  61. easing.type: Easing.InOutQuad
  62. }
  63. NumberAnimation {
  64. target: imgSmile;
  65. property: "opacity";
  66. from: 1; to: 0.1
  67. duration: 300;
  68. easing.type: Easing.InOutQuad
  69. }
  70. }
  71. ScriptAction {
  72. script: {
  73. dlgSmiles.state = "hidden"
  74. imgSmile.scale = 1
  75. imgSmile.opacity = 1
  76. }
  77. }
  78. }
  79. }
  80. }
  81. }