diff options
-rw-r--r-- | src/effects/shadereffectitem.cpp | 6 | ||||
-rw-r--r-- | src/effects/shadereffectitem.h | 2 | ||||
-rw-r--r-- | tests/effects.qml | 45 |
3 files changed, 53 insertions, 0 deletions
diff --git a/src/effects/shadereffectitem.cpp b/src/effects/shadereffectitem.cpp index e19602e..de5bd83 100644 --- a/src/effects/shadereffectitem.cpp +++ b/src/effects/shadereffectitem.cpp @@ -501,6 +501,12 @@ void ShaderEffectSource::update() m_dirtyTexture = false; } +void ShaderEffectSource::grab() +{ + m_dirtyTexture = true; + emit repaintRequired(); +} + void ShaderEffectSource::markSceneGraphDirty() { m_dirtySceneGraph = true; diff --git a/src/effects/shadereffectitem.h b/src/effects/shadereffectitem.h index 7667f65..15cfb54 100644 --- a/src/effects/shadereffectitem.h +++ b/src/effects/shadereffectitem.h @@ -136,6 +136,8 @@ public: void derefFromEffectItem(); void update(); + Q_INVOKABLE void grab(); + Q_SIGNALS: void sourceItemChanged(); void sourceImageChanged(); diff --git a/tests/effects.qml b/tests/effects.qml index b6389bc..41d01d0 100644 --- a/tests/effects.qml +++ b/tests/effects.qml @@ -166,6 +166,7 @@ Rectangle { drag.target.y = y drag.target.z = 0 } + onClicked: { effectSource2.grab(); grabbedAnim2.restart() } } Item { @@ -229,6 +230,20 @@ Rectangle { text: effectSource2.hideOriginal ? "Hidden" : "Shown" MouseArea { anchors.fill: parent; onClicked: { effectSource2.hideOriginal = !effectSource2.hideOriginal } } } + Text { + anchors.centerIn: parent + color: "red" + font.pixelSize: 12 + text: "Grabbed" + opacity: 0 + SequentialAnimation on opacity { + id: grabbedAnim2 + running: false + PropertyAction { value: 1 } + PauseAnimation { duration: 1000 } + NumberAnimation { to: 0; duration: 1000 } + } + } } MouseArea { @@ -264,6 +279,7 @@ Rectangle { drag.target.y = y drag.target.z = 0 } + onClicked: { effectSource3.grab(); grabbedAnim3.restart() } } Item { @@ -326,6 +342,20 @@ Rectangle { text: effectSource3.hideOriginal ? "Hidden" : "Shown" MouseArea { anchors.fill: parent; onClicked: { effectSource3.hideOriginal = !effectSource3.hideOriginal } } } + Text { + anchors.centerIn: parent + color: "red" + font.pixelSize: 12 + text: "Grabbed" + opacity: 0 + SequentialAnimation on opacity { + id: grabbedAnim3 + running: false + PropertyAction { value: 1 } + PauseAnimation { duration: 1000 } + NumberAnimation { to: 0; duration: 1000 } + } + } } MouseArea { @@ -418,6 +448,7 @@ Rectangle { drag.target.y = y drag.target.z = 0 } + onClicked: { effectSource5.grab(); grabbedAnim5.restart() } } Item { @@ -479,6 +510,20 @@ Rectangle { text: effectSource5.hideOriginal ? "Hidden" : "Shown" MouseArea { anchors.fill: parent; onClicked: { effectSource5.hideOriginal = !effectSource5.hideOriginal } } } + Text { + anchors.centerIn: parent + color: "red" + font.pixelSize: 12 + text: "Grabbed" + opacity: 0 + SequentialAnimation on opacity { + id: grabbedAnim5 + running: false + PropertyAction { value: 1 } + PauseAnimation { duration: 1000 } + NumberAnimation { to: 0; duration: 1000 } + } + } } MouseArea { |