QtMobility Reference Documentation

QDeclarativeCamera Class Reference

The QDeclarativeCamera class provides a camera item that you can add to a QDeclarativeView. More...

 #include <QDeclarativeCamera>

Inherits: QDeclarativeItem.

This class was introduced in Mobility 1.1.

Public Types

enum Error { NoError, CameraError, InvalidRequestError, ServiceMissingError, NotSupportedFeatureError }
enum ExposureMode { ExposureManual, ExposureAuto, ExposureNight, ExposureBacklight, ..., ExposureModeVendor }
enum FlashMode { FlashOff, FlashOn, FlashAuto, FlashRedEyeReduction, ..., FlashManual }
enum LockStatus { Unlocked, Searching, Locked }
enum State { UnloadedState, LoadedState, ActiveState }
enum WhiteBalanceMode { WhiteBalanceManual, WhiteBalanceAuto, WhiteBalanceSunlight, WhiteBalanceCloudy, ..., WhiteBalanceVendor }

Properties

Public Functions

QDeclarativeCamera ( QDeclarativeItem * parent = 0 )
~QDeclarativeCamera ()
qreal aperture () const
State cameraState () const
QSize captureResolution () const
QString capturedImagePath () const
QImage capturedImagePreview () const
qreal digitalZoom () const
Error error () const
QString errorString () const
qreal exposureCompensation () const
ExposureMode exposureMode () const
int flashMode () const
int isoSensitivity () const
LockStatus lockStatus () const
int manualWhiteBalance () const
qreal maximumDigitalZoom () const
qreal maximumOpticalZoom () const
qreal opticalZoom () const
qreal shutterSpeed () const
WhiteBalanceMode whiteBalanceMode () const

Reimplemented Public Functions

virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * style, QWidget * widget )

Public Slots

void captureImage ()
void searchAndLock ()
void setCameraState ( State state )
void setCaptureResolution ( const QSize & size )
void setDigitalZoom ( qreal )
void setExposureCompensation ( qreal ev )
void setExposureMode ( QDeclarativeCamera::ExposureMode )
void setFlashMode ( int )
void setManualIsoSensitivity ( int iso )
void setManualWhiteBalance ( int colorTemp ) const
void setOpticalZoom ( qreal )
void setWhiteBalanceMode ( QDeclarativeCamera::WhiteBalanceMode mode ) const
void start ()
void stop ()
void unlock ()
  • 1 public slot inherited from QObject

Signals

void apertureChanged ( qreal aperture )
void cameraStateChanged ( QDeclarativeCamera::State state )
void captureFailed ( const QString & message )
void captureResolutionChanged ( const QSize & resolution )
void digitalZoomChanged ( qreal )
void error ( QDeclarativeCamera::Error error, const QString & errorString )
void errorChanged ()
void exposureCompensationChanged ( qreal expComp )
void exposureModeChanged ( QDeclarativeCamera::ExposureMode mode )
void flashModeChanged ( int )
void imageCaptured ( const QString & preview )
void imageSaved ( const QString & path )
void isoSensitivityChanged ( int isoValue )
void lockStatusChanged ()
void manualWhiteBalanceChanged ( int newWhiteBal ) const
void maximumDigitalZoomChanged ( qreal zoom )
void maximumOpticalZoomChanged ( qreal )
void opticalZoomChanged ( qreal zoom )
void shutterSpeedChanged ( qreal speed )
void whiteBalanceModeChanged ( QDeclarativeCamera::WhiteBalanceMode ) const

Reimplemented Protected Functions

virtual void geometryChanged ( const QRectF & newGeometry, const QRectF & oldGeometry )
virtual void keyPressEvent ( QKeyEvent * event )
virtual void keyReleaseEvent ( QKeyEvent * event )

Additional Inherited Members

Detailed Description

The QDeclarativeCamera class provides a camera item that you can add to a QDeclarativeView.

Member Type Documentation

enum QDeclarativeCamera::Error

ConstantValueDescription
QDeclarativeCamera::NoErrorQCamera::NoErrorNo errors have occurred.
QDeclarativeCamera::CameraErrorQCamera::CameraErrorAn error has occurred.
QDeclarativeCamera::InvalidRequestErrorQCamera::InvalidRequestErrorSystem resource doesn't support requested functionality.
QDeclarativeCamera::ServiceMissingErrorQCamera::ServiceMissingErrorNo camera service available.
QDeclarativeCamera::NotSupportedFeatureErrorQCamera::NotSupportedFeatureErrorThe feature is not supported.

enum QDeclarativeCamera::ExposureMode

ConstantValueDescription
QDeclarativeCamera::ExposureManual1Manual mode.
QDeclarativeCamera::ExposureAuto0Automatic mode.
QDeclarativeCamera::ExposureNight3Night mode.
QDeclarativeCamera::ExposureBacklight4Backlight exposure mode.
QDeclarativeCamera::ExposureSpotlight5Spotlight exposure mode.
QDeclarativeCamera::ExposureSports6Spots exposure mode.
QDeclarativeCamera::ExposureSnow7Snow exposure mode.
QDeclarativeCamera::ExposureBeach8Beach exposure mode.
QDeclarativeCamera::ExposureLargeAperture9Use larger aperture with small depth of field.
QDeclarativeCamera::ExposureSmallAperture10Use smaller aperture.
QDeclarativeCamera::ExposurePortrait2Portrait exposure mode.
QDeclarativeCamera::ExposureModeVendor1000The base value for device specific exposure modes.

enum QDeclarativeCamera::FlashMode

ConstantValueDescription
QDeclarativeCamera::FlashOff0x2Flash is Off.
QDeclarativeCamera::FlashOn0x4Flash is On.
QDeclarativeCamera::FlashAuto0x1Automatic flash.
QDeclarativeCamera::FlashRedEyeReduction0x8Red eye reduction flash.
QDeclarativeCamera::FlashFill0x10Use flash to fillin shadows.
QDeclarativeCamera::FlashTorch0x20Constant light source, useful for focusing and video capture.
QDeclarativeCamera::FlashSlowSyncFrontCurtain0x40Use the flash in conjunction with a slow shutter speed. This mode allows better exposure of distant objects and/or motion blur effect.
QDeclarativeCamera::FlashSlowSyncRearCurtain0x80The similar mode to FlashSlowSyncFrontCurtain but flash is fired at the end of exposure.
QDeclarativeCamera::FlashManual0x100Flash power is manually set.

enum QDeclarativeCamera::LockStatus

ConstantValueDescription
QDeclarativeCamera::UnlockedQCamera::UnlockedThe application is not interested in camera settings value. The camera may keep this parameter without changes, this is common with camera focus, or adjust exposure and white balance constantly to keep the viewfinder image nice.
QDeclarativeCamera::SearchingQCamera::SearchingThe application has requested the camera focus, exposure or white balance lock with searchAndLock(). This state indicates the camera is focusing or calculating exposure and white balance.
QDeclarativeCamera::LockedQCamera::LockedThe camera focus, exposure or white balance is locked. The camera is ready to capture, application may check the exposure parameters.

The locked state usually means the requested parameter stays the same, except in the cases when the parameter is requested to be constantly updated. For example in continuous focusing mode, the focus is considered locked as long and the object is in focus, even while the actual focusing distance may be constantly changing.

enum QDeclarativeCamera::State

ConstantValueDescription
QDeclarativeCamera::UnloadedStateQCamera::UnloadedStateThe initial camera state, with camera not loaded, the camera capabilities except of supported capture modes are unknown. While the supported settings are unknown in this state, it's allowed to set the camera capture settings like codec, resolution, or frame rate.
QDeclarativeCamera::LoadedStateQCamera::LoadedStateThe camera is loaded and ready to be configured. In the Idle state it's allowed to query camera capabilities, set capture resolution, codecs, etc. The viewfinder is not active in the loaded state.
QDeclarativeCamera::ActiveStateQCamera::ActiveStateIn the active state as soon as camera is started the viewfinder displays video frames and the camera is ready for capture.

The default camera state is ActiveState.

enum QDeclarativeCamera::WhiteBalanceMode

ConstantValueDescription
QDeclarativeCamera::WhiteBalanceManual1Manual white balance. In this mode the manual white balance property value is used.
QDeclarativeCamera::WhiteBalanceAuto0Auto white balance mode.
QDeclarativeCamera::WhiteBalanceSunlight2Sunlight white balance mode.
QDeclarativeCamera::WhiteBalanceCloudy3Cloudy white balance mode.
QDeclarativeCamera::WhiteBalanceShade4Shade white balance mode.
QDeclarativeCamera::WhiteBalanceTungsten5Tungsten white balance mode.
QDeclarativeCamera::WhiteBalanceFluorescent6Fluorescent white balance mode.
QDeclarativeCamera::WhiteBalanceIncandescent7Incandescent white balance mode.
QDeclarativeCamera::WhiteBalanceFlash8Flash white balance mode.
QDeclarativeCamera::WhiteBalanceSunset9Sunset white balance mode.
QDeclarativeCamera::WhiteBalanceVendor1000Vendor defined white balance mode.

Property Documentation

aperture : const qreal

The lens aperture as an F number (the ratio of the focal length to effective aperture diameter).

This property was introduced in Mobility 1.1.

Access functions:

qreal aperture () const

Notifier signal:

void apertureChanged ( qreal aperture )

cameraState : State

The current state of the camera object.

ValueDescription
UnloadedStateThe initial camera state, with camera not loaded, the camera capabilities except of supported capture modes are unknown. While the supported settings are unknown in this state, it's allowed to set the camera capture settings like codec, resolution, or frame rate.
LoadedStateThe camera is loaded and ready to be configured.

In the Idle state it's allowed to query camera capabilities, set capture resolution, codecs, etc.

The viewfinder is not active in the loaded state.

ActiveStateIn the active state as soon as camera is started the viewfinder displays video frames and the camera is ready for capture.

This property was introduced in Mobility 1.1.

Access functions:

State cameraState () const
void setCameraState ( State state )

Notifier signal:

void cameraStateChanged ( QDeclarativeCamera::State state )

captureResolution : QSize

The resolution to capture the image at. If empty, the system will pick a good size.

This property was introduced in Mobility 1.1.

Access functions:

QSize captureResolution () const
void setCaptureResolution ( const QSize & size )

Notifier signal:

void captureResolutionChanged ( const QSize & resolution )

capturedImagePath : const QString

The path to the captured image.

This property was introduced in Mobility 1.1.

Access functions:

QString capturedImagePath () const

Notifier signal:

void imageSaved ( const QString & path )

digitalZoom : qreal

The current digital zoom factor.

This property was introduced in Mobility 1.1.

Access functions:

qreal digitalZoom () const
void setDigitalZoom ( qreal )

Notifier signal:

void digitalZoomChanged ( qreal )

errorString : const QString

A description of the current error, if any.

This property was introduced in Mobility 1.1.

Access functions:

QString errorString () const

Notifier signal:

void errorChanged ()

exposureCompensation : qreal

Adjustment for the automatically calculated exposure. The value is in EV units.

This property was introduced in Mobility 1.1.

Access functions:

qreal exposureCompensation () const
void setExposureCompensation ( qreal ev )

Notifier signal:

void exposureCompensationChanged ( qreal expComp )

exposureMode : ExposureMode

Camera exposure modes.

This property was introduced in Mobility 1.1.

Access functions:

ExposureMode exposureMode () const
void setExposureMode ( QDeclarativeCamera::ExposureMode )

Notifier signal:

void exposureModeChanged ( QDeclarativeCamera::ExposureMode mode )

flashMode : int

ValueDescription
FlashOffFlash is Off.
FlashOnFlash is On.
FlashAutoAutomatic flash.
FlashRedEyeReductionRed eye reduction flash.
FlashFillUse flash to fillin shadows.
FlashTorchConstant light source, useful for focusing and video capture.
FlashSlowSyncFrontCurtainUse the flash in conjunction with a slow shutter speed. This mode allows better exposure of distant objects and/or motion blur effect.
FlashSlowSyncRearCurtainThe similar mode to FlashSlowSyncFrontCurtain but flash is fired at the end of exposure.
FlashManualFlash power is manually set.

This property was introduced in Mobility 1.1.

Access functions:

int flashMode () const
void setFlashMode ( int )

Notifier signal:

void flashModeChanged ( int )

iso : int

The sensor's ISO sensitivity.

This property was introduced in Mobility 1.1.

Access functions:

int isoSensitivity () const
void setManualIsoSensitivity ( int iso )

Notifier signal:

void isoSensitivityChanged ( int isoValue )

lockStatus : const LockStatus

The overall status for all the requested camera locks.

ValueDescription
UnlockedThe application is not interested in camera settings value. The camera may keep this parameter without changes, this is common with camera focus, or adjust exposure and white balance constantly to keep the viewfinder image nice.
SearchingThe application has requested the camera focus, exposure or white balance lock with searchAndLock(). This state indicates the camera is focusing or calculating exposure and white balance.
LockedThe camera focus, exposure or white balance is locked. The camera is ready to capture, application may check the exposure parameters.

The locked state usually means the requested parameter stays the same, except in the cases when the parameter is requested to be constantly updated. For example in continuous focusing mode, the focus is considered locked as long and the object is in focus, even while the actual focusing distance may be constantly changing.

This property was introduced in Mobility 1.1.

Access functions:

LockStatus lockStatus () const

Notifier signal:

void lockStatusChanged ()

manualWhiteBalance : int

The color temperature used when in manual white balance mode (WhiteBalanceManual).

This property was introduced in Mobility 1.1.

Access functions:

int manualWhiteBalance () const
void setManualWhiteBalance ( int colorTemp ) const

Notifier signal:

void manualWhiteBalanceChanged ( int newWhiteBal ) const

See also whiteBalanceMode.

maximumDigitalZoom : const qreal

The maximum digital zoom factor, or 1.0 if digital zoom is not supported.

This property was introduced in Mobility 1.1.

Access functions:

qreal maximumDigitalZoom () const

Notifier signal:

void maximumDigitalZoomChanged ( qreal zoom )

maximumOpticalZoom : const qreal

The maximum optical zoom factor, or 1.0 if optical zoom is not supported.

This property was introduced in Mobility 1.1.

Access functions:

qreal maximumOpticalZoom () const

Notifier signal:

void maximumOpticalZoomChanged ( qreal )

opticalZoom : qreal

The current optical zoom factor.

This property was introduced in Mobility 1.1.

Access functions:

qreal opticalZoom () const
void setOpticalZoom ( qreal )

Notifier signal:

void opticalZoomChanged ( qreal zoom )

shutterSpeed : const qreal

The camera's shutter speed, in seconds.

This property was introduced in Mobility 1.1.

Access functions:

qreal shutterSpeed () const

Notifier signal:

void shutterSpeedChanged ( qreal speed )

whiteBalanceMode : WhiteBalanceMode

This property was introduced in Mobility 1.1.

Access functions:

WhiteBalanceMode whiteBalanceMode () const
void setWhiteBalanceMode ( QDeclarativeCamera::WhiteBalanceMode mode ) const

Notifier signal:

void whiteBalanceModeChanged ( QDeclarativeCamera::WhiteBalanceMode ) const

See also WhiteBalanceMode.

Member Function Documentation

QDeclarativeCamera::QDeclarativeCamera ( QDeclarativeItem * parent = 0 )

Construct a declarative camera object using parent object.

QDeclarativeCamera::~QDeclarativeCamera ()

Destructor, clean up memory

void QDeclarativeCamera::apertureChanged ( qreal aperture ) [signal]

Signals the change to a new aperture value.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::cameraStateChanged ( QDeclarativeCamera::State state ) [signal]

The camera state has changed to value state.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::captureFailed ( const QString & message ) [signal]

This handler is called when an error occurs during capture. A descriptive message is available in message.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::captureImage () [slot]

Start image capture. The onImageCaptured() and onImageSaved() signals will be emitted when the capture is complete.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::captureResolutionChanged ( const QSize & resolution ) [signal]

Signal that the resolution has changed to resolution.

This function was introduced in Mobility 1.1.

QImage QDeclarativeCamera::capturedImagePreview () const

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::digitalZoomChanged ( qreal ) [signal]

This function was introduced in Mobility 1.1.

Error QDeclarativeCamera::error () const

Returns any camera error.

This function was introduced in Mobility 1.1.

See also QDeclarativeCamera::Error.

void QDeclarativeCamera::error ( QDeclarativeCamera::Error error, const QString & errorString ) [signal]

This handler is called when an error occurs. The enumeration value error is one of the values defined below, and a descriptive string value is available in errorString.

ValueDescription
NoErrorNo errors have occurred.
CameraErrorAn error has occurred.
InvalidRequestErrorSystem resource doesn't support requested functionality.
ServiceMissingErrorNo camera service available.
NotSupportedFeatureErrorThe feature is not supported.

This function was introduced in Mobility 1.1.

See also QDeclarativeCamera::Error.

void QDeclarativeCamera::errorChanged () [signal]

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::exposureCompensationChanged ( qreal expComp ) [signal]

Compensation has changed to the new value expComp.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::exposureModeChanged ( QDeclarativeCamera::ExposureMode mode ) [signal]

Signals that the exposure mode is now mode.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::flashModeChanged ( int ) [signal]

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::geometryChanged ( const QRectF & newGeometry, const QRectF & oldGeometry ) [virtual protected]

Reimplemented from QDeclarativeItem::geometryChanged().

Change viewfinder size to newGeometry and returning the oldGeometry

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::imageCaptured ( const QString & preview ) [signal]

This handler is called when an image has been captured but not yet saved to the filesystem. The preview parameter can be used as the URL supplied to an Image element.

This function was introduced in Mobility 1.1.

See also imageSaved().

void QDeclarativeCamera::imageSaved ( const QString & path ) [signal]

This handler is called after the image has been written to the filesystem. The path is a local file path, not a URL.

This function was introduced in Mobility 1.1.

See also imageCaptured().

void QDeclarativeCamera::isoSensitivityChanged ( int isoValue ) [signal]

The iso value has changed to isoValue.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::keyPressEvent ( QKeyEvent * event ) [virtual protected]

Reimplemented from QGraphicsItem::keyPressEvent().

Handler for keypress events. The event is compared to a small set of events.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::keyReleaseEvent ( QKeyEvent * event ) [virtual protected]

Reimplemented from QGraphicsItem::keyReleaseEvent().

Handle the release of a key in event and take action if needed.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::lockStatusChanged () [signal]

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::manualWhiteBalanceChanged ( int newWhiteBal ) const [signal]

Indicates that the white balance has been manually changed to newWhiteBal.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::maximumDigitalZoomChanged ( qreal zoom ) [signal]

The maximum digital zoom is now zoom.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::maximumOpticalZoomChanged ( qreal ) [signal]

void QDeclarativeCamera::opticalZoomChanged ( qreal zoom ) [signal]

Optical zoom changed to zoom.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::paint ( QPainter * painter, const QStyleOptionGraphicsItem * style, QWidget * widget ) [virtual]

Reimplemented from QGraphicsItem::paint().

Paint method. Takes a painter object, a graphics style option and a widget

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::searchAndLock () [slot]

Start focusing, exposure and white balance calculation. If the camera has keyboard focus, searchAndLock() is called automatically when the camera focus button is pressed.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::shutterSpeedChanged ( qreal speed ) [signal]

The shutter speed has been changed to speed.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::start () [slot]

Starts the camera.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::stop () [slot]

Stops the camera.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::unlock () [slot]

Unlock focus.

If the camera has keyboard focus, unlock() is called automatically when the camera focus button is released.

This function was introduced in Mobility 1.1.

void QDeclarativeCamera::whiteBalanceModeChanged ( QDeclarativeCamera::WhiteBalanceMode ) const [signal]

This function was introduced in Mobility 1.1.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.