diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2012-02-08 15:32:14 +0000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-08 22:34:08 +0100 |
commit | 5c0629b5711b1f349dd7f4add7a61d75bdf5b222 (patch) | |
tree | 3e1bba00594f6f40467dcdd0344bd3f13598664f /examples | |
parent | c1ec175b24bde1523fcbd7e33d0f46f3bbc1def9 (diff) |
Enable qmlvideofx window to be resized, when large screen layout used
Change-Id: I3010b9fd5f68e922ff94edd4d08d8114c689c037
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Diffstat (limited to 'examples')
5 files changed, 43 insertions, 6 deletions
diff --git a/examples/video/qmlvideofx/main.cpp b/examples/video/qmlvideofx/main.cpp index 1b4f17eac..02568dfbe 100644 --- a/examples/video/qmlvideofx/main.cpp +++ b/examples/video/qmlvideofx/main.cpp @@ -129,6 +129,11 @@ int main(int argc, char *argv[]) videoPath = moviesLocation.first(); viewer.rootContext()->setContextProperty("videoPath", videoPath); + viewer.setWindowTitle("qmlvideofx"); + viewer.setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | + Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + viewer.setMinimumSize(QSize(600, 400)); + #ifdef SMALL_SCREEN_PHYSICAL viewer.showFullScreen(); #else 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 } |