4#include <private/qplatformimagecapture_p.h>
6#include <private/qplatformmediacapture_p.h>
7#include <private/qplatformmediaintegration_p.h>
8#include <private/qplatformmediaformatinfo_p.h>
11#include "private/qobject_p.h"
13#include <private/qplatformcamera_p.h>
14#include <QtCore/qdebug.h>
15#include <QtCore/qurl.h>
16#include <QtCore/qstringlist.h>
17#include <QtCore/qmetaobject.h>
68 emit q->errorChanged();
88 qWarning() <<
"Failed to initialize QImageCapture" << maybeControl.error();
89 d->errorString = maybeControl.error();
94 d->control = maybeControl.value();
123 d->captureSession = session;
142 return d_func()->control && d_func()->captureSession && d_func()->captureSession->camera();
167 return d_func()->error;
180 return d_func()->errorString;
205 d->control->setMetaData(
d->metaData);
216 auto data =
d->metaData;
232 if (!
d->control || !
d->captureSession || !
d->control->isReadyForCapture())
234 auto *
camera =
d->captureSession->camera();
272 d->_q_error(-1,
d->error,
d->errorString);
283 return d->control->capture(
file);
302 d->_q_error(-1,
d->error,
d->errorString);
306 return d->control->captureToBuffer();
387 auto fmt =
d->control->imageSettings();
391 d->control->setImageSettings(
fmt);
410 const char *
name =
nullptr;
413 name =
"Unspecified image format";
436 const char *
name =
nullptr;
439 name =
"Unspecified image format";
464 return d->control ?
d->control->imageSettings().resolution() :
QSize{};
484 auto fmt =
d->control->imageSettings();
488 d->control->setImageSettings(
fmt);
521 return d->control ?
d->control->imageSettings().quality() :
NormalQuality;
532 auto fmt =
d->control->imageSettings();
536 d->control->setImageSettings(
fmt);
551#include "moc_qimagecapture.cpp"
The QCamera class provides interface for system camera devices.
bool isActive() const
Returns true if the camera is currently active.
QPlatformImageCapture * control
void _q_error(int id, int error, const QString &errorString)
QMediaCaptureSession * captureSession
QImageCapture::Error error
static QString fileFormatName(FileFormat c)
Returns the name of the given format, f.
int captureToFile(const QString &location=QString())
Capture the image and save it to file.
static QList< FileFormat > supportedFormats()
Returns a list of supported file formats.
Error
\value NoError No Errors.
QMediaCaptureSession * captureSession() const
Returns the capture session this camera is connected to, or a nullptr if the camera is not connected ...
void setMetaData(const QMediaMetaData &metaData)
Replaces any existing meta data, to be embedded into the captured image, with a set of metaData.
FileFormat
Choose one of the following image formats:
void imageSaved(int id, const QString &fileName)
Signal emitted when QImageCapture::CaptureToFile is set and the frame with request id was saved to fi...
bool isReadyForCapture() const
Quality quality
The image encoding quality.
~QImageCapture()
Destroys images capture object.
QImageCapture(QObject *parent=nullptr)
Constructs a image capture object, from a parent, that can capture individual still images produced b...
void addMetaData(const QMediaMetaData &metaData)
Adds additional metaData to any existing meta data, that is embedded into the captured image.
QSize resolution() const
Returns the resolution of the encoded image.
QString errorString
Returns a string describing the current error state.
void imageAvailable(int id, const QVideoFrame &frame)
Signal emitted when the frame with request id is available.
void setQuality(Quality quality)
Sets the image encoding quality.
Error error
Returns the current error state.
QMediaMetaData metaData
The meta data that will get embedded into the image.
bool isAvailable() const
Returns true if the images capture service ready to use.
void imageExposed(int id)
Signal emitted when the frame with request id was exposed.
static QString fileFormatDescription(FileFormat c)
Returns the description of the given file format, f.
void imageMetadataAvailable(int id, const QMediaMetaData &metaData)
Signals that an image identified by id has metaData.
void resolutionChanged()
Signals when the image resolution changes.
void imageCaptured(int id, const QImage &preview)
Signal emitted when the frame with request id was captured, but not processed and saved yet.
Quality
Enumerates quality encoding levels.
void setResolution(const QSize &)
Sets the resolution of the encoded image.
void readyForCaptureChanged(bool ready)
Signals that a camera's ready for capture state has changed.
void setFileFormat(FileFormat format)
Sets the image format.
FileFormat fileFormat
The image format.
int capture()
Capture the image and make it available as a QImage.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
\macro QT_RESTRICTED_CAST_FROM_ASCII
void clear()
Clears the contents of the string and makes it null.
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QVideoFrame class represents a frame of video data.
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
GLint GLsizei GLsizei height
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
GLdouble GLdouble GLdouble GLdouble q
QVideoFrameFormat::PixelFormat fmt
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent