summaryrefslogtreecommitdiffstats
path: root/experimental/Camera/CapturePreview.qml
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2013-06-24 15:47:31 +0200
committerEirik Aavitsland <eirik.aavitsland@digia.com>2013-09-23 12:54:29 +0300
commit35edc19994995491aaf44e9bac851e1f8cda17ce (patch)
tree986e0114b63f846619601b89e550bf28b431bdcc /experimental/Camera/CapturePreview.qml
parentd571f4769863bfb8035ff9ab61a7fbd797ae0452 (diff)
Added Mediaplayer and Camera demos.
It's currently in the experimental directory since it has been tested only on the Nexus 7. Change-Id: I9503ded9504841b80a88c6e2541bed0234d73cfc Reviewed-by: Eirik Aavitsland <eirik.aavitsland@digia.com>
Diffstat (limited to 'experimental/Camera/CapturePreview.qml')
-rw-r--r--experimental/Camera/CapturePreview.qml45
1 files changed, 45 insertions, 0 deletions
diff --git a/experimental/Camera/CapturePreview.qml b/experimental/Camera/CapturePreview.qml
new file mode 100644
index 0000000..611fa53
--- /dev/null
+++ b/experimental/Camera/CapturePreview.qml
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+
+Rectangle {
+ id: root
+ anchors.fill: parent
+ color: "black"
+ opacity: 0
+ enabled: opacity !== 0
+
+ property string previewSrc: ""
+
+ onOpacityChanged: {
+ if (opacity === 1 && previewSrc !== "") {
+ previewImage.source = previewSrc;
+ previewSrc = "";
+ }
+ }
+
+ Behavior on opacity { NumberAnimation { duration: 100 } }
+
+ function show() {
+ previewImage.source = "";
+ opacity = 1;
+ }
+
+ function setPreview(preview) {
+ if (root.opacity === 1)
+ previewImage.source = preview;
+ else
+ root.previewSrc = preview;
+ }
+
+ Image {
+ id: previewImage
+ anchors.fill: parent
+ fillMode: Image.PreserveAspectFit
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: {
+ root.opacity = 0;
+ }
+ }
+}