main.qml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import QtQuick 2.11
  2. import QtQuick.Window 2.11
  3. import QtGraphicalEffects 1.0
  4. Window {
  5. id: window
  6. visible: true
  7. width: 640
  8. height: 480
  9. title: qsTr("App")
  10. QtObject{
  11. id: d
  12. property var images: []
  13. }
  14. Rectangle{
  15. id: rect
  16. width: parent.width
  17. height: 240
  18. x: 0
  19. y: 0
  20. color: "lightblue"
  21. Text{
  22. id: txt
  23. property int counter: 0
  24. anchors.centerIn: parent
  25. font.pointSize: 30
  26. color: "black"
  27. text: counter
  28. }
  29. MouseArea{
  30. anchors.fill: parent
  31. onClicked: {
  32. rect.grabToImage(function(result) {
  33. img.source = result.url
  34. ++txt.counter
  35. imageManager.get(result.image)
  36. })
  37. }
  38. }
  39. }
  40. Image{
  41. id: img
  42. width: parent.width
  43. height: parent.height - rect.height
  44. x: 0
  45. y: 240
  46. asynchronous: true
  47. mipmap: true
  48. MouseArea{
  49. anchors.fill: parent
  50. onClicked: imageManager.saveAll()
  51. }
  52. }
  53. }