QPlatformImageCapture Class

The QPlatformImageCapture class provides a control interface for image capture services. More...

Header: #include <QPlatformImageCapture>
CMake: find_package(Qt6 COMPONENTS Multimedia REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
Inherits: QObject

This class is deprecated. We strongly advise against using it in new code.

Public Functions

virtual int capture(const QString &fileName) = 0
virtual QImageEncoderSettings imageSettings() const = 0
virtual bool isReadyForCapture() const = 0
virtual void setImageSettings(const QImageEncoderSettings &settings) = 0


void error(int id, int error, const QString &errorString)
void imageAvailable(int requestId, const QVideoFrame &buffer)
void imageCaptured(int requestId, const QImage &preview)
void imageExposed(int requestId)
void imageMetadataAvailable(int id, const QMediaMetaData &)
void imageSaved(int requestId, const QString &fileName)
void readyForCaptureChanged(bool ready)

Protected Functions

QPlatformImageCapture(QImageCapture *parent = nullptr)

Detailed Description

Member Function Documentation

[protected] QPlatformImageCapture::QPlatformImageCapture(QImageCapture *parent = nullptr)

Constructs a new image capture control object with the given parent

[signal] void QPlatformImageCapture::error(int id, int error, const QString &errorString)

Signals the capture request id failed with error code and message errorString.

See also QImageCapture::Error.

[signal] void QPlatformImageCapture::imageAvailable(int requestId, const QVideoFrame &buffer)

Signals that a captured buffer with a requestId is available.

[signal] void QPlatformImageCapture::imageCaptured(int requestId, const QImage &preview)

Signals that an image with it requestId has been captured and a preview is available.

[signal] void QPlatformImageCapture::imageExposed(int requestId)

Signals that an image with it requestId has just been exposed. This signal can be used for the shutter sound or other indicaton.

[signal] void QPlatformImageCapture::imageMetadataAvailable(int id, const QMediaMetaData &)

Signals that a metadata for an image with request id is available.

This signal should be emitted between imageExposed and imageSaved signals.

[signal] void QPlatformImageCapture::imageSaved(int requestId, const QString &fileName)

Signals that a captured image with a requestId has been saved to fileName.

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

Signals that a capture control's ready state has changed.

[pure virtual] int QPlatformImageCapture::capture(const QString &fileName)

Initiates the capture of an image to fileName. The fileName can be relative or empty, in this case the service should use the system specific place and file naming scheme.

The Camera service should save all the capture parameters like exposure settings or image processing parameters, so changes to camera parameters after capture() is called do not affect previous capture requests.

Returns the capture request id number, which is used later with imageExposed(), imageCaptured() and imageSaved() signals.

[pure virtual] QImageEncoderSettings QPlatformImageCapture::imageSettings() const

Returns the currently used image encoder settings.

The returned value may be different than passed to setImageSettings() if the settings contains defaulted or undefined parameters.

See also setImageSettings().

[pure virtual] bool QPlatformImageCapture::isReadyForCapture() const

Identifies if a capture control is ready to perform a capture immediately (all the resources necessary for image capture are allocated, hardware initialized, flash is charged, etc).

Returns true if the camera is ready for capture; and false if it is not.

It's permissible to call capture() while the camera status is QCamera::ActiveStatus regardless of isReadyForCapture property value. If camera is not ready to capture image immediately, the capture request is queued with all the related camera settings to be executed as soon as possible.

[pure virtual] void QPlatformImageCapture::setImageSettings(const QImageEncoderSettings &settings)

Sets the selected image encoder settings.

See also imageSettings().

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.