![]() |
Qt 6.x
The Qt SDK
|
The QCameraDevice class provides general information about camera devices. More...
#include <qcameradevice.h>
Public Types | |
enum | Position { UnspecifiedPosition , BackFace , FrontFace } |
This enum specifies the physical position of the camera on the system hardware. More... | |
Public Member Functions | |
QCameraDevice () | |
Describes a camera device. | |
QCameraDevice (const QCameraDevice &other) | |
Constructs a copy of other. | |
QCameraDevice & | operator= (const QCameraDevice &other) |
Sets the QCameraDevice object to be equal to other. | |
~QCameraDevice () | |
Destroys the QCameraDevice. | |
bool | operator== (const QCameraDevice &other) const |
Returns true if this QCameraDevice is equal to other. | |
bool | operator!= (const QCameraDevice &other) const |
Returns true if this QCameraDevice is different from other. | |
bool | isNull () const |
Returns true if this QCameraDevice is null or invalid. | |
QByteArray | id () const |
QString | description () const |
bool | isDefault () const |
Position | position () const |
QList< QSize > | photoResolutions () const |
Returns a list of resolutions that the camera can use to capture still images. | |
QList< QCameraFormat > | videoFormats () const |
Properties | |
QByteArray | id |
\qmlproperty string QtMultimedia::cameraDevice::id | |
QString | description |
\qmlproperty string QtMultimedia::cameraDevice::description | |
bool | isDefault |
\qmlproperty bool QtMultimedia::cameraDevice::isDefault | |
Position | position |
\qmlproperty enumeration QtMultimedia::cameraDevice::position | |
QList< QCameraFormat > | videoFormats |
\qmlproperty CameraFormat QtMultimedia::cameraDevice::videoFormats | |
Friends | |
class | QCameraDevicePrivate |
The QCameraDevice class provides general information about camera devices.
\inmodule QtMultimedia
QCameraDevice represents a physical camera device and its properties.
You can discover what cameras are available on a system using the availableCameras() and defaultCamera() functions. These are contained within QtMultimedia::MediaDevices.
This example prints the name of all available cameras:
A QCameraDevice can be used to construct a QCamera. The following example instantiates a QCamera whose camera device is named {mycamera}
:
You can also use QCameraDevice to get general information about a camera device such as description and physical position on the system.
Definition at line 44 of file qcameradevice.h.
This enum specifies the physical position of the camera on the system hardware.
\value UnspecifiedPosition The camera position is unspecified or unknown. \value BackFace The camera is on the back face of the system hardware. For example on a mobile device, it means it is on the opposite side to that of the screen. \value FrontFace The camera is on the front face of the system hardware. For example on a mobile device, it means it is on the same side as that of the screen.
Enumerator | |
---|---|
UnspecifiedPosition | |
BackFace | |
FrontFace |
Definition at line 72 of file qcameradevice.h.
|
default |
Describes a camera device.
\qmlvaluetype cameraDevice \ingroup qmlvaluetypes \inqmlmodule QtMultimedia \since 6.2
! \instantiates QCameraDevice
The cameraDevice value type describes the properties of a camera device that is connected to the system.
The list of camera devices can be queried from the \l{MediaDevices} type. To select a certain camera device set it as the device on \l{Camera}.
\qml CaptureSession { camera: Camera { cameraDevice: mediaDevices.defaultVideoInput } } MediaDevices { id: mediaDevices } \endqml
Constructs a null camera device
|
default |
Constructs a copy of other.
|
default |
Destroys the QCameraDevice.
QString QCameraDevice::description | ( | ) | const |
Definition at line 338 of file qcameradevice.cpp.
References QCameraDevicePrivate::description.
QByteArray QCameraDevice::id | ( | ) | const |
Definition at line 302 of file qcameradevice.cpp.
References QCameraDevicePrivate::id.
bool QCameraDevice::isDefault | ( | ) | const |
Definition at line 318 of file qcameradevice.cpp.
References QCameraDevicePrivate::isDefault.
bool QCameraDevice::isNull | ( | ) | const |
Returns true if this QCameraDevice is null or invalid.
Definition at line 282 of file qcameradevice.cpp.
Referenced by QCameraPrivate::init(), QWindowsImageCapture::isReadyForCapture(), AVFCamera::setActive(), QAVFCameraBase::setActive(), AVFCameraSession::setActive(), QV4L2Camera::setActive(), QWindowsCamera::setActive(), QGstreamerCamera::setActive(), and AVFCameraSession::updateVideoInput().
|
inline |
Returns true if this QCameraDevice is different from other.
Definition at line 93 of file qcameradevice.h.
References operator==(), and other().
|
default |
Sets the QCameraDevice object to be equal to other.
bool QCameraDevice::operator== | ( | const QCameraDevice & | other | ) | const |
Returns true if this QCameraDevice is equal to other.
Definition at line 266 of file qcameradevice.cpp.
References QCameraDevicePrivate::description, QCameraDevicePrivate::id, other(), and QCameraDevicePrivate::position.
Referenced by operator!=().
Returns a list of resolutions that the camera can use to capture still images.
Definition at line 387 of file qcameradevice.cpp.
References QCameraDevicePrivate::photoResolutions.
QCameraDevice::Position QCameraDevice::position | ( | ) | const |
Definition at line 376 of file qcameradevice.cpp.
References QCameraDevicePrivate::position, and UnspecifiedPosition.
QList< QCameraFormat > QCameraDevice::videoFormats | ( | ) | const |
Definition at line 403 of file qcameradevice.cpp.
References QCameraDevicePrivate::videoFormats.
|
friend |
Definition at line 88 of file qcameradevice.h.
|
read |
\qmlproperty string QtMultimedia::cameraDevice::description
Holds a human readable name of the camera.
Use this string to present the device to the user.
Returns the human-readable description of the camera.
Use this string to present the device to the user.
Definition at line 40 of file qcameradevice.h.
Referenced by QAndroidCamera::onCameraError(), and QAndroidCamera::onCaptureSessionFailed().
|
read |
\qmlproperty string QtMultimedia::cameraDevice::id
Holds he device id of the camera
This is a unique ID to identify the camera and may not be human-readable.
Returns the device id of the camera
This is a unique ID to identify the camera and may not be human-readable.
Definition at line 40 of file qcameradevice.h.
Referenced by QAVFCameraBase::device(), and QWindowsMediaDeviceSession::setActive().
|
read |
\qmlproperty bool QtMultimedia::cameraDevice::isDefault
Is true if this is the default camera device.
Returns true if this is the default camera device.
Definition at line 40 of file qcameradevice.h.
|
read |
\qmlproperty enumeration QtMultimedia::cameraDevice::position
Returns the physical position of the camera on the hardware system.
The returned value can be one of the following:
\value cameraDevice.UnspecifiedPosition The camera position is unspecified or unknown. \value cameraDevice.BackFace The camera is on the back face of the system hardware. For example on a mobile device, it means it is on the opposite side to that of the screen. \value cameraDevice.FrontFace The camera is on the front face of the system hardware. For example on a mobile device, it means it is on the same side as that of the screen.
Returns the physical position of the camera on the hardware system.
Definition at line 40 of file qcameradevice.h.
Referenced by camera_info(), QAndroidCamera::frameAvailable(), and overview_viewfinder_orientation().
|
read |
\qmlproperty CameraFormat QtMultimedia::cameraDevice::videoFormats
Holds the video formats supported by the camera.
Returns the video formats supported by the camera.
Definition at line 40 of file qcameradevice.h.
Referenced by AVFCamera::setCameraFormat(), QAVFCameraBase::setCameraFormat(), QV4L2Camera::setCameraFormat(), and QGstreamerCamera::setCameraFormat().