Pinch and zoom for camera using Qml
-
Hi Guys,
I am posting my previous question again as i did not get appropriate output with that.
Here is my requirement.
1.Start Camera and set capture mode as captureStillImage
2.I need to set the zoom for camera by pinch and zoom.I have tried in various methods but could not get proper output as it works partially.I hope i am having problem with the logic only..
Here is my code:
@Camera {
id: cameraObj
captureMode: Camera.CaptureStillImage
}
VideoOutput {
id: viewfinderBack
source: cameraObj
anchors.fill: parent
visible: true
autoOrientation: true
}
PinchArea {
id: pincharea
anchors.fill: parent
pinch.target: viewfinderBack
scale: root.defScale // 0 by default
pinch.minimumScale: 0.5
pinch.maximumScale: 4.0property real zoomValue: 0 property double oldZoom: 0 onPinchStarted: { oldZoom = pincharea.scale } onPinchUpdated: { if(zoomValue < 4.0) { zoomValue = oldZoom + pinch.scale } } onPinchFinished: { zoomValue = oldZoom + pinch.scale if(zoomValue < 4.0) { pincharea.scale = zoomValue cameraObj.setDigitalZoom(zoomValue) } } }@
The above code does not exactly sink between pinch area scaled and zoomed. Here up on every pinch start the value goes to default.so i added the previous scale to that.
Please help me with the solution.Its hardtime for me as i am struggling to get this for longtime.
Thanks in Advance
Regards
Bala Beemaneni