Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qimagecapture.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCAMERAIMAGECAPTURE_H
5#define QCAMERAIMAGECAPTURE_H
6
7#include <QtCore/qobject.h>
8#include <QtMultimedia/qvideoframe.h>
9
10#include <QtMultimedia/qmediaenumdebug.h>
11
13
14class QSize;
15class QMediaMetaData;
17
19
21class QCamera;
23
25class Q_MULTIMEDIA_EXPORT QImageCapture : public QObject
26{
28 Q_PROPERTY(bool readyForCapture READ isReadyForCapture NOTIFY readyForCaptureChanged)
29 Q_PROPERTY(QMediaMetaData metaData READ metaData WRITE setMetaData NOTIFY metaDataChanged)
30 Q_PROPERTY(Error error READ error NOTIFY errorChanged)
31 Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
32 Q_PROPERTY(FileFormat fileFormat READ fileFormat NOTIFY setFileFormat NOTIFY fileFormatChanged)
33 Q_PROPERTY(Quality quality READ quality NOTIFY setQuality NOTIFY qualityChanged)
34public:
45
54 Q_ENUM(Quality)
55
62 LastFileFormat = Tiff
63 };
64 Q_ENUM(FileFormat)
65
66 explicit QImageCapture(QObject *parent = nullptr);
68
69 bool isAvailable() const;
70
71 QMediaCaptureSession *captureSession() const;
72
73 Error error() const;
74 QString errorString() const;
75
76 bool isReadyForCapture() const;
77
78 FileFormat fileFormat() const;
79 void setFileFormat(FileFormat format);
80
81 static QList<FileFormat> supportedFormats();
82 static QString fileFormatName(FileFormat c);
83 static QString fileFormatDescription(FileFormat c);
84
85 QSize resolution() const;
86 void setResolution(const QSize &);
87 void setResolution(int width, int height);
88
89 Quality quality() const;
90 void setQuality(Quality quality);
91
92 QMediaMetaData metaData() const;
93 void setMetaData(const QMediaMetaData &metaData);
94 void addMetaData(const QMediaMetaData &metaData);
95
96public Q_SLOTS:
97 int captureToFile(const QString &location = QString());
98 int capture();
99
102 void errorOccurred(int id, QImageCapture::Error error, const QString &errorString);
103
104 void readyForCaptureChanged(bool ready);
106
110
111 void imageExposed(int id);
112 void imageCaptured(int id, const QImage &preview);
113 void imageMetadataAvailable(int id, const QMediaMetaData &metaData);
114 void imageAvailable(int id, const QVideoFrame &frame);
115 void imageSaved(int id, const QString &fileName);
116
117private:
118 // This is here to flag an incompatibilities with Qt 5
119 QImageCapture(QCamera *) = delete;
120
122 class QPlatformImageCapture *platformImageCapture();
123 void setCaptureSession(QMediaCaptureSession *session);
125 Q_DISABLE_COPY(QImageCapture)
126 Q_DECLARE_PRIVATE(QImageCapture)
127 Q_PRIVATE_SLOT(d_func(), void _q_error(int, int, const QString &))
128};
129
131
133
134#endif
135
The QCamera class provides interface for system camera devices.
Definition qcamera.h:28
\inmodule QtMultimedia
Error
\value NoError No Errors.
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...
void fileFormatChanged()
void errorChanged()
void metaDataChanged()
void imageAvailable(int id, const QVideoFrame &frame)
Signal emitted when the frame with request id is available.
void qualityChanged()
void imageExposed(int id)
Signal emitted when the frame with request id was exposed.
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 errorOccurred(int id, QImageCapture::Error error, const QString &errorString)
Signals that the capture request id has failed with an error and errorString description.
void readyForCaptureChanged(bool ready)
Signals that a camera's ready for capture state has changed.
\inmodule QtGui
Definition qimage.h:37
The QMediaCaptureSession class allows capturing of audio and video content.
\inmodule QtMultimedia
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QVideoFrame class represents a frame of video data.
Definition qvideoframe.h:27
Combined button and popup list for selecting options.
DBusConnection const char DBusError * error
QMediaFormat::FileFormat fileFormat
#define Q_MEDIA_ENUM_DEBUG(Class, Enum)
GLint location
GLint GLsizei GLsizei height
GLint GLsizei width
GLint GLsizei GLsizei GLenum format
const GLubyte * c
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
QFrame frame
[0]