diff options
Diffstat (limited to 'examples/video/qmlvideofx/qml/qmlvideofx')
4 files changed, 38 insertions, 6 deletions
diff --git a/examples/video/qmlvideofx/qml/qmlvideofx/Content.qml b/examples/video/qmlvideofx/qml/qmlvideofx/Content.qml index ae96a7753..fa3da9378 100644 --- a/examples/video/qmlvideofx/qml/qmlvideofx/Content.qml +++ b/examples/video/qmlvideofx/qml/qmlvideofx/Content.qml @@ -82,6 +82,16 @@ Rectangle { ignoreUnknownSignals: true } + onWidthChanged: { + if (effectLoader.item) + effectLoader.item.targetWidth = root.width + } + + onHeightChanged: { + if (effectLoader.item) + effectLoader.item.targetHeight = root.height + } + onEffectSourceChanged: { console.log("[qmlvideofx] Content.onEffectSourceChanged " + effectSource) effectLoader.source = effectSource diff --git a/examples/video/qmlvideofx/qml/qmlvideofx/ContentImage.qml b/examples/video/qmlvideofx/qml/qmlvideofx/ContentImage.qml index 87ff5a54d..0b5624a5d 100644 --- a/examples/video/qmlvideofx/qml/qmlvideofx/ContentImage.qml +++ b/examples/video/qmlvideofx/qml/qmlvideofx/ContentImage.qml @@ -42,5 +42,6 @@ import QtQuick 2.0 Image { + fillMode: Image.PreserveAspectFit smooth: true } diff --git a/examples/video/qmlvideofx/qml/qmlvideofx/EffectMagnify.qml b/examples/video/qmlvideofx/qml/qmlvideofx/EffectMagnify.qml index 11f9b0091..e0b573eb8 100644 --- a/examples/video/qmlvideofx/qml/qmlvideofx/EffectMagnify.qml +++ b/examples/video/qmlvideofx/qml/qmlvideofx/EffectMagnify.qml @@ -58,12 +58,31 @@ Effect { property real posX: -1 property real posY: -1 + QtObject { + id: d + property real oldTargetWidth: root.targetWidth + property real oldTargetHeight: root.targetHeight + } + // Transform slider values, and bind result to shader uniforms property real radius: parameters.get(0).value * 100 property real diffractionIndex: parameters.get(1).value - onTargetWidthChanged: if (posX == -1) posX = targetWidth / 2 - onTargetHeightChanged: if (posY == -1) posY = targetHeight / 2 + onTargetWidthChanged: { + if (posX == -1) + posX = targetWidth / 2 + else if (d.oldTargetWidth != 0) + posX *= (targetWidth / d.oldTargetWidth) + d.oldTargetWidth = targetWidth + } + + onTargetHeightChanged: { + if (posY == -1) + posY = targetHeight / 2 + else if (d.oldTargetHeight != 0) + posY *= (targetHeight / d.oldTargetHeight) + d.oldTargetHeight = targetHeight + } fragmentShaderFilename: "shaders/magnify.fsh" diff --git a/examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml b/examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml index 246616db2..83a8dbe00 100644 --- a/examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml +++ b/examples/video/qmlvideofx/qml/qmlvideofx/main-largescreen.qml @@ -60,7 +60,9 @@ Rectangle { id: content anchors { top: parent.top + bottom: parent.bottom left: parent.left + right: effectSelectionPanel.left margins: 5 } width: 600 @@ -99,11 +101,11 @@ Rectangle { id: effectSelectionPanel anchors { top: parent.top - left: content.right + bottom: fileOpen.top right: parent.right margins: 5 } - height: 420 + width: 300 itemHeight: 40 onEffectSourceChanged: { content.effectSource = effectSource @@ -114,12 +116,12 @@ Rectangle { FileOpen { id: fileOpen anchors { - top: effectSelectionPanel.bottom - left: content.right right: parent.right bottom: parent.bottom margins: 5 } + width: effectSelectionPanel.width + height: 165 buttonHeight: 32 topMargin: 10 } |