Home · All Classes · All Functions ·

QCamera Class Reference

The QCamera class provides interface for system camera devices. More...

    #include <QCamera>

This class is under development and is subject to change.

Inherits QMediaObject.


Public Types

enum CaptureMode { CaptureDisabled, CaptureStillImage, CaptureVideo }
flags CaptureModes
enum Error { NoError, CameraError, NotReadyToCaptureError, InvalidRequestError, ServiceMissingError, NotSupportedFeatureError }
enum ExposureMode { ExposureManual, ExposureAuto, ExposureNight, ExposureBacklight, ..., ExposurePortrait }
flags ExposureModes
enum ExposureStatus { CorrectExposure, UnderExposure, OverExposure }
enum FlashMode { FlashOff, FlashOn, FlashAuto, FlashRedEyeReduction, FlashFill }
flags FlashModes
enum FocusMode { ManualFocus, AutoFocus, ContinuousFocus, InfinityFocus, HyperfocalFocus }
flags FocusModes
enum FocusStatus { FocusIntial, FocusRequested, FocusCanceled, FocusReached, FocusLost, FocusUnableToReach }
enum MeteringMode { MeteringAverage, MeteringSpot, MeteringMatrix }
flags MeteringModes
enum State { ActiveState, SuspendedState, StoppedState }
enum WhiteBalanceMode { WhiteBalanceManual, WhiteBalanceAuto, WhiteBalanceSunlight, WhiteBalanceCloudy, ..., WhiteBalanceSunset }
flags WhiteBalanceModes

Properties


Public Functions

QCamera ( QObject * parent = 0, QMediaServiceProvider * provider = QMediaServiceProvider::defaultServiceProvider() )
QCamera ( const QByteArray & device, QObject * parent = 0 )
~QCamera ()
qreal aperture () const
CaptureMode captureMode () const
qreal digitalZoom () const
Error error () const
QString errorString () const
qreal exposureCompensation () const
ExposureMode exposureMode () const
FlashMode flashMode () const
FocusMode focusMode () const
FocusStatus focusStatus () const
bool isExposureLocked () const
bool isFlashReady () const
bool isMacroFocusingSupported () const
int isoSensitivity () const
bool macroFocusingEnabled () const
int manualWhiteBalance () const
qreal maximumDigitalZoom () const
qreal maximumOpticalZoom () const
MeteringMode meteringMode () const
qreal opticalZoom () const
void setAutoAperture ()
void setAutoIsoSensitivity ()
void setAutoShutterSpeed ()
void setExposureCompensation ( qreal ev )
void setExposureMode ( ExposureMode mode )
void setFlashMode ( FlashMode mode )
void setFocusMode ( FocusMode mode )
void setMacroFocusingEnabled ( bool enabled )
void setManualAperture ( qreal aperture )
void setManualIsoSensitivity ( int iso )
void setManualShutterSpeed ( qreal seconds )
void setManualWhiteBalance ( int colorTemperature )
void setMeteringMode ( MeteringMode mode )
void setWhiteBalanceMode ( WhiteBalanceMode mode )
qreal shutterSpeed () const
State state () const
QList<qreal> supportedApertures ( bool * continuous = 0 ) const
CaptureModes supportedCaptureModes () const
ExposureModes supportedExposureModes () const
FlashModes supportedFlashModes () const
FocusModes supportedFocusModes () const
QList<int> supportedIsoSensitivities ( bool * continuous = 0 ) const
MeteringModes supportedMeteringModes () const
QList<qreal> supportedShutterSpeeds ( bool * continuous = 0 ) const
WhiteBalanceModes supportedWhiteBalanceModes () const
WhiteBalanceMode whiteBalanceMode () const
void zoomTo ( qreal optical, qreal digital )

Reimplemented Public Functions

virtual QtMedia::AvailabilityError availabilityError () const
virtual bool isAvailable () const

Public Slots

void cancelFocusing ()
void lockExposure ()
void setCaptureMode ( QCamera::CaptureMode mode )
void start ()
void startFocusing ()
void stop ()
void unlockExposure ()

Signals

void apertureChanged ( qreal value )
void apertureRangeChanged ()
void captureModeChanged ( QCamera::CaptureMode )
void digitalZoomChanged ( qreal )
void error ( QCamera::Error value )
void exposureLocked ()
void flashReady ( bool ready )
void focusReached ()
void focusStatusChanged ( QCamera::FocusStatus status )
void focusUnableToReach ()
void isoSensitivityChanged ( int value )
void opticalZoomChanged ( qreal )
void shutterSpeedChanged ( qreal speed )
void stateChanged ( QCamera::State state )

Static Public Members

QList<QByteArray> availableDevices ()
QString deviceDescription ( const QByteArray & device )

Additional Inherited Members


Detailed Description

The QCamera class provides interface for system camera devices.

QCamera can be used with QVideoWidget for viewfinder display and QMediaRecorder for video recording.

    camera = new QCamera;
    viewFinder = new QVideoWidget(camera);
    viewFinder->show();

    recorder = new QMediaRecorder(camera);
    imageCapture = new QStillImageCapture(camera);

    camera->start();

The Camera API of Qt Mobility is still in Technology Preview. It has not undergone the same level of review and testing as the rest of the APIs.

The API exposed by the classes in this component are not stable, and will undergo modification or removal prior to the final release of Qt Mobility.


Member Type Documentation

enum QCamera::CaptureMode
flags QCamera::CaptureModes

The CaptureModes type is a typedef for QFlags<CaptureMode>. It stores an OR combination of CaptureMode values.

enum QCamera::Error

ConstantValueDescription
QCamera::NoError0No errors have occurred.
QCamera::CameraError1An error has occurred.
QCamera::NotReadyToCaptureError2System resource not available.
QCamera::InvalidRequestError3System resource doesn't support functionality.
QCamera::ServiceMissingError4No service available.
QCamera::NotSupportedFeatureError5The feature is not supported.

enum QCamera::ExposureMode
flags QCamera::ExposureModes

ConstantValueDescription
QCamera::ExposureManual0x1Manual mode.
QCamera::ExposureAuto0x2Automatic mode.
QCamera::ExposureNight0x4Night mode.
QCamera::ExposureBacklight0x8Backlight exposure mode.
QCamera::ExposureSpotlight0x10Spotlight exposure mode.
QCamera::ExposureSports0x20Spots exposure mode.
QCamera::ExposureSnow0x40Snow exposure mode.
QCamera::ExposureBeach0x80Beach exposure mode.
QCamera::ExposureLargeAperture0x100Use larger aperture with small depth of field.
QCamera::ExposureSmallAperture0x200Use smaller aperture.
QCamera::ExposurePortrait0x400Portrait exposure mode.

The ExposureModes type is a typedef for QFlags<ExposureMode>. It stores an OR combination of ExposureMode values.

enum QCamera::ExposureStatus

ConstantValueDescription
QCamera::CorrectExposure0The exposure is correct.
QCamera::UnderExposure1The photo will be underexposed.
QCamera::OverExposure2The photo will be overexposed.

enum QCamera::FlashMode
flags QCamera::FlashModes

ConstantValueDescription
QCamera::FlashOff0x1Flash is Off.
QCamera::FlashOn0x2Flash is On.
QCamera::FlashAuto0x4Automatic flash.
QCamera::FlashRedEyeReduction0x8Red eye reduction flash.
QCamera::FlashFill0x10Use flash to fillin shadows.

The FlashModes type is a typedef for QFlags<FlashMode>. It stores an OR combination of FlashMode values.

enum QCamera::FocusMode
flags QCamera::FocusModes

ConstantValueDescription
QCamera::ManualFocus0x1Manual focus mode.
QCamera::AutoFocus0x8One-shot auto focus mode.
QCamera::ContinuousFocus0x10Continuous auto focus mode.
QCamera::InfinityFocus0x04Focus strictly to infinity.
QCamera::HyperfocalFocus0x02Focus to hyperfocal distance, with with the maximum depth of field achieved. All objects at distances from half of this distance out to infinity will be acceptably sharp.

The FocusModes type is a typedef for QFlags<FocusMode>. It stores an OR combination of FocusMode values.

enum QCamera::FocusStatus

ConstantValueDescription
QCamera::FocusIntial?The initial focus state.
QCamera::FocusRequested1Focus request is in progress.
QCamera::FocusCanceled2The focus request was canceled.
QCamera::FocusReached3Focus has been reached.
QCamera::FocusLost4Focus has been lost.
QCamera::FocusUnableToReach5Unable to achieve focus.

When the QCamera::InfinityFocus or QCamera::HyperfocalFocus mode is requested, the focus status changes to QCamera::FocusRequested until the requested state is reached and stays in the QCamera::FocusReached status after.

In manual focusing mode the focus stays in the QCamera::FocusReached status, or, when supported by camera, QCamera::FocusLost and QCamera::FocusReached values could be used for manual focus notifications.

In autofocus mode, on focus request the status changes to QCamera::FocusRequested, and then depending on request results the focus status changes to QCamera::FocusReached, QCamera::FocusUnableToReach or QCamera::FocusCanceled.

In countinous autofocus mode, the status changes to QCamera::FocusRequested, and since the focus is reached is stays in QCamera::FocusReached and QCamera::FocusLost states until continous focusing is canceled with cancelAutofocus() or setFocusMode().

enum QCamera::MeteringMode
flags QCamera::MeteringModes

ConstantValueDescription
QCamera::MeteringAverage0x1Center weighted average metering mode.
QCamera::MeteringSpot0x2Spot metering mode.
QCamera::MeteringMatrix0x4Matrix metering mode.

The MeteringModes type is a typedef for QFlags<MeteringMode>. It stores an OR combination of MeteringMode values.

enum QCamera::State

ConstantValueDescription
QCamera::ActiveState0The camera has been started and can produce data.
QCamera::SuspendedState1The camera is temporary not available, usually as a result of higher priority client requested the camera device.
QCamera::StoppedState2The camera has been stopped.

enum QCamera::WhiteBalanceMode
flags QCamera::WhiteBalanceModes

ConstantValueDescription
QCamera::WhiteBalanceManual0x1Manual white balance. In this mode the white balance should be set with setManualWhiteBalance()
QCamera::WhiteBalanceAuto0x2Auto white balance mode.
QCamera::WhiteBalanceSunlight0x4Sunlight white balance mode.
QCamera::WhiteBalanceCloudy0x8Cloudy white balance mode.
QCamera::WhiteBalanceShade0x10Shade white balance mode.
QCamera::WhiteBalanceTungsten0x20Tungsten white balance mode.
QCamera::WhiteBalanceFluorescent0x40Fluorescent white balance mode.
QCamera::WhiteBalanceIncandescent0x80Incandescent white balance mode.
QCamera::WhiteBalanceFlash0x100Flash white balance mode.
QCamera::WhiteBalanceSunset0x200Sunset white balance mode.

The WhiteBalanceModes type is a typedef for QFlags<WhiteBalanceMode>. It stores an OR combination of WhiteBalanceMode values.


Property Documentation

aperture : qreal

This property holds lens aperture is specified as an F number, the ratio of the focal length to effective aperture diameter.

Access functions:

qreal aperture () const
void setManualAperture ( qreal aperture )

Notifier signal:

void apertureChanged ( qreal value )

captureMode : CaptureMode

Returns the type of media (video or still images), the camera is configured to capture.

Access functions:

CaptureMode captureMode () const
void setCaptureMode ( QCamera::CaptureMode mode )

Notifier signal:

void captureModeChanged ( QCamera::CaptureMode )

isoSensitivity : int

This property holds the sensor ISO sensitivity. Lower sensitivity, the noise is lower, but more light is needed.

Access functions:

int isoSensitivity () const
void setManualIsoSensitivity ( int iso )

Notifier signal:

void isoSensitivityChanged ( int value )

shutterSpeed : qreal

This property holds the effective length of time the shutter is open in seconds.

Access functions:

qreal shutterSpeed () const
void setManualShutterSpeed ( qreal seconds )

Notifier signal:

void shutterSpeedChanged ( qreal speed )

state : const QCamera::State

This property holds the current state of the camera object.

Access functions:

State state () const

Notifier signal:

void stateChanged ( QCamera::State state )

Member Function Documentation

QCamera::QCamera ( QObject * parent = 0, QMediaServiceProvider * provider = QMediaServiceProvider::defaultServiceProvider() )

Construct a QCamera from service provider and parent.

QCamera::QCamera ( const QByteArray & device, QObject * parent = 0 )

Construct a QCamera from device name device and parent.

QCamera::~QCamera ()

Destroys the camera object.

void QCamera::apertureChanged ( qreal value )   [signal]

Signal emitted when aperature changes to value.

void QCamera::apertureRangeChanged ()   [signal]

Signal emitted when aperature range has changed.

QtMedia::AvailabilityError QCamera::availabilityError () const   [virtual]

Reimplemented from QMediaObject::availabilityError().

Returns the error state of the camera service.

QList<QByteArray> QCamera::availableDevices ()   [static]

Returns a list of camera device's available from the default service provider.

void QCamera::cancelFocusing ()   [slot]

Cancels the single autofocus request or stops continuous focusing.

Does nothing in hyperfocal or infinity focus modes.

If supported by camera, startFocusing() turns off the manual focusing notifications, otherwise it does nothing in manual mode.

void QCamera::captureModeChanged ( QCamera::CaptureMode )   [signal]

QString QCamera::deviceDescription ( const QByteArray & device )   [static]

Returns the description of the device.

qreal QCamera::digitalZoom () const

Returns the current digital zoom value.

See also QCamera::digitalZoomChanged(qreal) and QCamera::opticalZoom().

void QCamera::digitalZoomChanged ( qreal )   [signal]

Error QCamera::error () const

Returns the error state of the object.

void QCamera::error ( QCamera::Error value )   [signal]

Signal emitted when error state changes to value.

QString QCamera::errorString () const

Returns a string describing a camera's error state.

qreal QCamera::exposureCompensation () const

Returns the exposure compensation.

See also setExposureCompensation().

void QCamera::exposureLocked ()   [signal]

Signal emitted when exposure locked.

ExposureMode QCamera::exposureMode () const

Returns the exposure mode being used.

See also setExposureMode().

FlashMode QCamera::flashMode () const

Returns the flash mode being used.

See also setFlashMode().

void QCamera::flashReady ( bool ready )   [signal]

Signal emitted when flash status changed, flash is ready if ready true.

FocusMode QCamera::focusMode () const

Returns the focus mode being used.

See also setFocusMode().

void QCamera::focusReached ()   [signal]

Signals the focus was reached. This signal is emited after focusStatus changes to QCamera::FocusReached state.

FocusStatus QCamera::focusStatus () const

Returns the focus status

void QCamera::focusStatusChanged ( QCamera::FocusStatus status )   [signal]

Signal emitted when focus status changed.

void QCamera::focusUnableToReach ()   [signal]

Signals the focus was unable to reach. This signal is emited after focusStatus changes to QCamera::FocusUnableToReach state.

bool QCamera::isAvailable () const   [virtual]

Reimplemented from QMediaObject::isAvailable().

Returne true if the camera service is ready to use.

bool QCamera::isExposureLocked () const

Return true if exposure locked.

bool QCamera::isFlashReady () const

Returns true if flash is charged.

bool QCamera::isMacroFocusingSupported () const

Returns true if macro focusing is supported.

void QCamera::isoSensitivityChanged ( int value )   [signal]

Signal emitted when sensitivity changes to value.

void QCamera::lockExposure ()   [slot]

Lock the exposure.

bool QCamera::macroFocusingEnabled () const

Returns true if macro focusing enabled.

See also setMacroFocusingEnabled().

int QCamera::manualWhiteBalance () const

Returns the current color temperature if the manual white balance is active, otherwise the return value is undefined.

See also setManualWhiteBalance().

qreal QCamera::maximumDigitalZoom () const

Returns the maximum digital zoom

qreal QCamera::maximumOpticalZoom () const

Returns the maximum optical zoom

MeteringMode QCamera::meteringMode () const

Returns the metering mode being used.

See also setMeteringMode().

qreal QCamera::opticalZoom () const

Returns the current optical zoom value.

See also QCamera::opticalZoomChanged(qreal) and QCamera::digitalZoom().

void QCamera::opticalZoomChanged ( qreal )   [signal]

void QCamera::setAutoAperture ()

Turn on auto aperture

void QCamera::setAutoIsoSensitivity ()

Turn on auto sensitivity

void QCamera::setAutoShutterSpeed ()

Turn on auto shutter speed

void QCamera::setExposureCompensation ( qreal ev )

Sets the exposure compensation to ev

See also exposureCompensation().

void QCamera::setExposureMode ( ExposureMode mode )

Set exposure mode to mode

See also exposureMode().

void QCamera::setFlashMode ( FlashMode mode )

Set the flash mode to mode

See also flashMode().

void QCamera::setFocusMode ( FocusMode mode )

Set the focus mode to mode

See also focusMode().

void QCamera::setMacroFocusingEnabled ( bool enabled )

Set macro focusing to enabled.

See also macroFocusingEnabled().

void QCamera::setManualWhiteBalance ( int colorTemperature )

Sets manual white balance to colorTemperature

See also manualWhiteBalance().

void QCamera::setMeteringMode ( MeteringMode mode )

Sets the metering mode to mode.

See also meteringMode().

void QCamera::setWhiteBalanceMode ( WhiteBalanceMode mode )

Sets the white balance to mode.

See also whiteBalanceMode().

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

Signals that a camera's shutter speed has changed.

void QCamera::start ()   [slot]

Starts the camera.

This can involve powering up the camera device and can be asynchronyous.

State is changed to QCamera::ActiveState if camera is started succesfuly, otherwise error() signal is emited.

void QCamera::startFocusing ()   [slot]

Starts single or continuous autofocus.

Does nothing in hyperfocal or infinity focus modes.

If supported by camera, startFocusing() turns on the manual focusing notifications, otherwise it does nothing in manual mode.

void QCamera::stateChanged ( QCamera::State state )   [signal]

Signal emitted when state of the Camera object has changed.

void QCamera::stop ()   [slot]

Stops the camera.

QList<qreal> QCamera::supportedApertures ( bool * continuous = 0 ) const

Returns the list of aperture values camera supports. The apertures list can change depending on the focal length, in such a case the apertureRangeChanged() signal is emited.

If the camera supports arbitrary aperture values within the supported range, *continuous is set to true, otherwise *continuous is set to false.

CaptureModes QCamera::supportedCaptureModes () const

Returns the supported capture modes.

ExposureModes QCamera::supportedExposureModes () const

Return the exposure modes available.

FlashModes QCamera::supportedFlashModes () const

Returns the flash modes available.

FocusModes QCamera::supportedFocusModes () const

Returns the focus modes available.

QList<int> QCamera::supportedIsoSensitivities ( bool * continuous = 0 ) const

Returns the list of ISO senitivities camera supports.

If the camera supports arbitrary ISO sensitivities within the supported range, *continuous is set to true, otherwise *continuous is set to false.

MeteringModes QCamera::supportedMeteringModes () const

Returns the metering modes available.

QList<qreal> QCamera::supportedShutterSpeeds ( bool * continuous = 0 ) const

Returns the list of shutter speed values in seconds camera supports.

If the camera supports arbitrary shutter speed values within the supported range, *continuous is set to true, otherwise *continuous is set to false.

WhiteBalanceModes QCamera::supportedWhiteBalanceModes () const

Returns the white balance modes available.

void QCamera::unlockExposure ()   [slot]

Unlock the exposure.

WhiteBalanceMode QCamera::whiteBalanceMode () const

Returns the white balance mode being used.

See also setWhiteBalanceMode().

void QCamera::zoomTo ( qreal optical, qreal digital )

Set the camera optical and digital zoom values.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Mobility Project 1.0.0