default.txt 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /****************************************************************************
  2. ** QML with Highlight.js **/
  3. import QtQuick 2.5 // good version
  4. Window {
  5. id: root
  6. width: 1024; height: 600
  7. color: "black"
  8. property int highestZ: 0 // 0 is lowest, +infinity is highest
  9. property real defaultSize = 200.1
  10. signal activated(real xPosition, real yPosition)
  11. // show the file picker
  12. FileDialog {
  13. id:fileDialog // an id in a comment should not be detected
  14. title: "Choose a folder with some images"
  15. onAccepted: folderModel.folder = fileUrl + "/" // if this is on property
  16. }
  17. Flickable {
  18. id: flickableproperty
  19. contentHeight: height * surfaceViewportRatio
  20. property real zRestore: 0
  21. Behavior on scale { NumberAnimation { duration: 200 } }
  22. Repeater {
  23. model: FolderListModel {
  24. id: folderModel
  25. nameFilters: ["*.png", "*.jpg", "*.gif"]
  26. }
  27. Component.onCompleted: {
  28. x = Math.random() * root.width - width / 2
  29. rotation = Math.random() * 13 - 6
  30. if (pinch.scale > 0) {
  31. photoFrame.rotation = 0;
  32. photoFrame.scale = Math.min(root.width, root.height) / Math.max(image.sourceSize.width, image.sourceSize.height) * 0.85
  33. } else {
  34. photoFrame.rotation = pinch.previousAngle
  35. photoFrame.scale = pinch.previousScale
  36. }
  37. }
  38. function setFrameColor() {
  39. if (currentFrame)
  40. currentFrame.border.color = "black";
  41. currentFrame = photoFrame;
  42. }
  43. }
  44. }
  45. Timer { id: fadeTimer; interval: 1000; onTriggered: { hfade.start(); vfade.start() } }
  46. Component.onCompleted: fileDialog.open()
  47. }