MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QML Camera Example

Files:

Images:

This example demonstrates the basic use of the Camera QML Plugin elements. The plugin provides access to the API functionality for camera settings and capturing an image.

Most of the QML code supports the user interface for this application with the Camera elements being mostly found in declarative-camera.qml and CaptureControls.qml.

In declarative-camera.qml the Camera element is initialized with an id of camera , a photo preview is setup, states are implemented for image preview or capture and a CaptureControls element is initialized. The initial state is PhotoCapture. The camera element includes a handler, onImageCaptured, for the imageCaptured signal. The handler sets up the application to process the preview including a change in the user interface state. The PhotoPreview element now becomes visible with any key press being picked up by the handler in PhotoPreview and returning the state to PhotoCapture.

The CaptureControls element, which is implemented in CaptureControls.qml, generates a column on the right hand side of the screen which includes control buttons for focus (not initially visible), capture, flash modes, white balance, exposure compensation, and if a preview is available a preview button. The last button exits from the application.

When the Capture button is pressed the onClicked handler calls captureImage()