VisualEffect.qml 685 B

12345678910111213141516171819202122232425262728
  1. import QtQuick 2.5
  2. import ".."
  3. Item {
  4. id: root
  5. property alias target: effectSource.sourceItem
  6. property string effect: "Random"
  7. property var effectObject
  8. function scheduleUpdate() { effectSource.scheduleUpdate() }
  9. transformOrigin: Item.TopLeft
  10. anchors.fill: target
  11. scale: target.scale
  12. ShaderEffectSource {
  13. id: effectSource
  14. smooth: true
  15. hideSource: true
  16. sourceItem: target
  17. live: false
  18. }
  19. Component.onCompleted: {
  20. effectObject = Effects.getComponent(effect).createObject(root, { "source": effectSource, "anchors.fill": root, "targetWidth": root.width, "targetHeight": root.height })
  21. }
  22. }