QCameraDevice#

The QCameraDevice class provides general information about camera devices. More

Inheritance diagram of PySide6.QtMultimedia.QCameraDevice

Synopsis#

Properties#

Functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

Warning

This section contains snippets that were automatically translated from C++ to Python and may contain errors.

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:

cameras = QMediaDevices.videoInputs()
for cameraDevice in cameras:
    print(cameraDevice.description())

A QCameraDevice can be used to construct a QCamera . The following example instantiates a QCamera whose camera device is named mycamera:

cameras = QMediaDevices.videoInputs()
for cameraDevice in cameras:
    if cameraDevice.description() == "mycamera":
        camera = QCamera(cameraDevice)

You can also use QCameraDevice to get general information about a camera device such as description and physical position on the system.

myCamera = QCamera()
cameraDevice = camera.cameraDevice()
if cameraDevice.position() == QCameraDevice.FrontFace:
    print("The camera is on the front face of the hardware system.")
elif cameraDevice.position() == QCameraDevice.BackFace:
    print("The camera is on the back face of the hardware system.")

See also

QCamera

class PySide6.QtMultimedia.QCameraDevice#

PySide6.QtMultimedia.QCameraDevice(other)

Parameters:

otherPySide6.QtMultimedia.QCameraDevice

Constructs a null camera device

Constructs a copy of other.

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property PᅟySide6.QtMultimedia.QCameraDevice.description: str#

Returns the human-readable description of the camera.

Use this string to present the device to the user.

Access functions:
property PᅟySide6.QtMultimedia.QCameraDevice.id: PySide6.QtCore.QByteArray#

Returns the device id of the camera

This is a unique ID to identify the camera and may not be human-readable.

Access functions:
property PᅟySide6.QtMultimedia.QCameraDevice.isDefault: bool#

Returns true if this is the default camera device.

Access functions:
property PᅟySide6.QtMultimedia.QCameraDevice.position: Position#

Returns the physical position of the camera on the hardware system.

Access functions:
property PᅟySide6.QtMultimedia.QCameraDevice.videoFormats#

Returns the video formats supported by the camera.

Access functions:
PySide6.QtMultimedia.QCameraDevice.Position#

This enum specifies the physical position of the camera on the system hardware.

Constant

Description

QCameraDevice.UnspecifiedPosition

The camera position is unspecified or unknown.

QCameraDevice.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.

QCameraDevice.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.

See also

position()

New in version 6.1.

PySide6.QtMultimedia.QCameraDevice.description()#
Return type:

str

Getter of property description .

PySide6.QtMultimedia.QCameraDevice.id()#
Return type:

PySide6.QtCore.QByteArray

Getter of property id .

PySide6.QtMultimedia.QCameraDevice.isDefault()#
Return type:

bool

Getter of property isDefault .

PySide6.QtMultimedia.QCameraDevice.isNull()#
Return type:

bool

Returns true if this QCameraDevice is null or invalid.

PySide6.QtMultimedia.QCameraDevice.__ne__(other)#
Parameters:

otherPySide6.QtMultimedia.QCameraDevice

Return type:

bool

Returns true if this QCameraDevice is different from other.

PySide6.QtMultimedia.QCameraDevice.__eq__(other)#
Parameters:

otherPySide6.QtMultimedia.QCameraDevice

Return type:

bool

Returns true if this QCameraDevice is equal to other.

PySide6.QtMultimedia.QCameraDevice.photoResolutions()#
Return type:

Returns a list of resolutions that the camera can use to capture still images.

See also

QImageCapture

PySide6.QtMultimedia.QCameraDevice.position()#
Return type:

Position

Getter of property position .

PySide6.QtMultimedia.QCameraDevice.videoFormats()#
Return type:

Getter of property videoFormats .