QCamera
QCamera
Header: #include <QCamera>
qmake: QT += multimedia
Inherits: QMediaObject
Public Types
class FrameRateRange
enum CaptureMode { CaptureViewfinder, CaptureStillImage, CaptureVideo }
flags CaptureModes
enum Error { NoError, CameraError, InvalidRequestError, ServiceMissingError, NotSupportedFeatureError }
enum LockChangeReason { UserRequest, LockAcquired, LockFailed, LockLost, LockTemporaryLost }
enum LockStatus { Unlocked, Searching, Locked }
enum LockType { NoLock, LockExposure, LockWhiteBalance, LockFocus }
flags LockTypes
enum Position { UnspecifiedPosition, BackFace, FrontFace }
enum State { UnloadedState, LoadedState, ActiveState }
enum Status { ActiveStatus, StartingStatus, StoppingStatus, StandbyStatus, ..., UnavailableStatus }
Properties
captureMode : QCamera::CaptureModes
lockStatus : const QCamera::LockStatus
state : const QCamera::State
status : const QCamera::Status
1 property inherited from QMediaObject
1 property inherited from QObject
Public Functions
QCamera(QObject *parent = nullptr)
QCamera(const QByteArray &deviceName, QObject *parent = nullptr)
QCamera(const QCameraInfo &cameraInfo, QObject *parent = nullptr)
QCamera(QCamera::Position position, QObject *parent = nullptr)
virtual ~QCamera()
QCamera::CaptureModes captureMode() const
QCamera::Error error() const
QString errorString() const
QCameraExposure * exposure() const
QCameraFocus * focus() const
QCameraImageProcessing * imageProcessing() const
bool isCaptureModeSupported(QCamera::CaptureModes mode) const
QCamera::LockStatus lockStatus() const
QCamera::LockStatus lockStatus(QCamera::LockType lockType) const
QCamera::LockTypes requestedLocks() const
void setViewfinder(QVideoWidget *viewfinder)
void setViewfinder(QGraphicsVideoItem *viewfinder)
void setViewfinder(QAbstractVideoSurface *surface)
void setViewfinderSettings(const QCameraViewfinderSettings &settings)
QCamera::State state() const
QCamera::Status status() const
QCamera::LockTypes supportedLocks() const
QList<QCamera::FrameRateRange> supportedViewfinderFrameRateRanges(const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const
QList<QVideoFrame::PixelFormat> supportedViewfinderPixelFormats(const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const
QList<QSize> supportedViewfinderResolutions(const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const
QList<QCameraViewfinderSettings> supportedViewfinderSettings(const QCameraViewfinderSettings &settings = QCameraViewfinderSettings()) const
QCameraViewfinderSettings viewfinderSettings() const
Reimplemented Public Functions
virtual QMultimedia::AvailabilityStatus availability() const override
10 public functions inherited from QMediaObject
34 public functions inherited from QObject
Public Slots
void load()
void searchAndLock()
void searchAndLock(QCamera::LockTypes locks)
void setCaptureMode(QCamera::CaptureModes mode)
void start()
void stop()
void unload()
void unlock()
void unlock(QCamera::LockTypes locks)
1 public slot inherited from QObject
Signals
void captureModeChanged(QCamera::CaptureModes mode)
void error(QCamera::Error value)
void lockFailed()
void lockStatusChanged(QCamera::LockStatus status, QCamera::LockChangeReason reason)
void lockStatusChanged(QCamera::LockType lock, QCamera::LockStatus status, QCamera::LockChangeReason reason)
void locked()
void stateChanged(QCamera::State state)
void statusChanged(QCamera::Status status)
6 signals inherited from QMediaObject
2 signals inherited from QObject
Additional Inherited Members
1 public variable inherited from QObject
10 static public members inherited from QObject
2 protected functions inherited from QMediaObject
9 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 QCameraViewfinder for viewfinder display, QMediaRecorder for video recording and QCameraImageCapture for image taking.
You can use QCameraInfo to list available cameras and choose which one to use.
QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); foreach (const QCameraInfo &cameraInfo, cameras) { if (cameraInfo.deviceName() == "mycamera")
{ camera = new QCamera(cameraInfo); } }
See the camera overview for more information.
################################