Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

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 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 { FocusDisabled, FocusRequested, 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
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 isFocusLocked () const
bool isMacroFocusingSupported () const
bool isReadyForCapture () const
int isoSensitivity () const
bool macroFocusingEnabled () const
int manualWhiteBalance () const
qreal maximumAperture () const
qreal maximumDigitalZoom () const
int maximumIsoSensitivity () const
qreal maximumOpticalZoom () const
qreal maximumShutterSpeed () const
MeteringMode meteringMode () const
qreal minimumAperture () const
int minimumIsoSensitivity () const
qreal minimumShutterSpeed () 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
void start ()
State state () const
void stop ()
QList<qreal> supportedApertures () const
ExposureModes supportedExposureModes () const
FlashModes supportedFlashModes () const
FocusModes supportedFocusModes () const
QList<int> supportedIsoSensitivities () const
MeteringModes supportedMeteringModes () const
QList<qreal> supportedShutterSpeeds () const
WhiteBalanceModes supportedWhiteBalanceModes () const
WhiteBalanceMode whiteBalanceMode () const
void zoomTo ( qreal value )
qreal zoomValue () const

Public Slots

void capture ( const QString & file )
void lockExposure ()
void lockFocus ()
void unlockExposure ()
void unlockFocus ()
  • 1 public slot inherited from QObject

Signals

void apertureChanged ( qreal value )
void apertureRangeChanged ()
void error ( QCamera::Error value )
void exposureLocked ()
void flashReady ( bool ready )
void focusLocked ()
void focusStatusChanged ( QCamera::FocusStatus status )
void imageCaptured ( const QString & fileName, const QImage & preview )
void imageSaved ( const QString & fileName )
void isoSensitivityChanged ( int value )
void readyForCaptureChanged ( bool ready )
void shutterSpeedChanged ( qreal speed )
void stateChanged ( QCamera::State state )
void zoomValueChanged ( qreal value )

Static Public Members

QList<QByteArray> availableDevices ()
QString deviceDescription ( const QByteArray & device )
  • 4 static public members inherited from QObject

Additional Inherited Members

  • 1 public type inherited from QObject
  • 2 protected functions inherited from QMediaObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

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 = QMediaRecorder(camera);

    camera->start();

The Camera API of Qt Mobility is still in ALPHA. 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::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::FocusDisabled0Manual focus mode used or auto focus is not available.
QCamera::FocusRequested1Focus request is in progress.
QCamera::FocusReached2Focus has been reached.
QCamera::FocusLost3Focus has been lost.
QCamera::FocusUnableToReach4Unable to achieve focus.

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 )

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 )

readyForCapture : const bool

Indicates the camera is ready to capture an image immediately.

Access functions:

bool isReadyForCapture () const

Notifier signal:

void readyForCaptureChanged ( bool ready )

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.

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

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

void QCamera::capture ( const QString & file )   [slot]

Capture the image and save it to file. This operation is asynchronous in majority of cases, followed by signal QCamera::imageCaptured() or error()

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

Returns the description of the device.

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.

void QCamera::focusLocked ()   [signal]

Signal emitted when focus is locked.

FocusMode QCamera::focusMode () const

Returns the focus mode being used.

See also setFocusMode().

FocusStatus QCamera::focusStatus () const

Returns the focus status

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

Signal emitted when focus status changed.

void QCamera::imageCaptured ( const QString & fileName, const QImage & preview )   [signal]

Signals that an image intendec to be saved to to fileName has been captured and a preview is available.

void QCamera::imageSaved ( const QString & fileName )   [signal]

Signals that an captured image has been saved to fileName.

bool QCamera::isExposureLocked () const

Return true if exposure locked.

bool QCamera::isFlashReady () const

Returns true if flash is charged.

bool QCamera::isFocusLocked () const

Return true if focus locked.

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.

void QCamera::lockFocus ()   [slot]

Lock the focus.

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::maximumAperture () const

Returns the largest supported aperture.

See also minimumAperture() and aperture().

qreal QCamera::maximumDigitalZoom () const

Returns the maximum digital zoom

int QCamera::maximumIsoSensitivity () const

Returns the largest supported ISO sensitivity.

qreal QCamera::maximumOpticalZoom () const

Returns the maximum optical zoom

qreal QCamera::maximumShutterSpeed () const

Returns the largest supported shutter speed.

See also shutterSpeed().

MeteringMode QCamera::meteringMode () const

Returns the metering mode being used.

See also setMeteringMode().

qreal QCamera::minimumAperture () const

Returns the smallest supported aperture as an F number, corresponding to wide open lens. For example if the camera lenses supports aperture range from F/1.4 to F/32, the minumum aperture value will be 1.4, the maximum - 32

int QCamera::minimumIsoSensitivity () const

Returns the smallest supported ISO sensitivity.

qreal QCamera::minimumShutterSpeed () const

Returns the smallest supported shutter speed.

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

Signals that a camera's ready for capture state has changed.

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 ()

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::stateChanged ( QCamera::State state )   [signal]

Signal emitted when state of the Camera object has changed.

void QCamera::stop ()

Stops the camera.

QList<qreal> QCamera::supportedApertures () const

Returns the list of apertures if camera supports only fixed set of aperture values, otherwise returns an empty list.

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 () const

Returns the list of ISO senitivities if camera supports only fixed set of ISO sensitivity values, otherwise returns an empty list.

MeteringModes QCamera::supportedMeteringModes () const

Returns the metering modes available.

QList<qreal> QCamera::supportedShutterSpeeds () const

Returns the list of shutter speed values if camera supports only fixed set of shutter speed values, otherwise returns an empty list.

WhiteBalanceModes QCamera::supportedWhiteBalanceModes () const

Returns the white balance modes available.

void QCamera::unlockExposure ()   [slot]

Unlock the exposure.

void QCamera::unlockFocus ()   [slot]

Unlock the focus.

WhiteBalanceMode QCamera::whiteBalanceMode () const

Returns the white balance mode being used.

See also setWhiteBalanceMode().

void QCamera::zoomTo ( qreal value )

Set the zoom to value.

qreal QCamera::zoomValue () const

Returns the current zoom.

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

Signal emitted when zoom value changes to new value.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtmobility-1.0-tp
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web