cameraDevice QML Value Type

描述相机设备。更多

Import Statement: import QtMultimedia

属性

详细说明

cameraDevice 值类型描述连接到系统的摄像机设备的属性。

即使相应的物理设备断开连接或其设置被修改,cameraDevice 实例也会在其整个生命周期中保留其属性。要跟踪更新的属性,用户应在相关信号触发时从MediaDevices 加载新的 cameraDevice 实例。

可通过MediaDevices 类型查询摄像机设备列表。要选择某个摄像机设备,请将其设置为Camera 上的设备。

CaptureSession {
    camera: Camera {
        cameraDevice: mediaDevices.defaultVideoInput
    }
}
MediaDevices {
    id: mediaDevices
}

属性文档

correctionAngle : QtVideo::Rotation [since 6.7]

返回补偿摄像机物理旋转所需的旋转角度。换句话说,该属性表示输出图像需要旋转的顺时针角度,以便以原始方向直立显示在设备屏幕上。由于correctionAngle 是相对于本机方向而言的,因此该值不会随设备方向(纵向/横向)的改变而改变。在 Android 系统中,校正角度可能不为零,因为本机方向和相机方向是由制造商定义的。

90 度修正角度示例

此属性在 Qt 6.7 中引入。


description : string

持有相机的人可读名称。

使用此字符串向用户展示设备。


id : string

摄像机的设备 ID

这是识别摄像机的唯一 ID,可能不是人可读的。


isDefault : bool

如果是默认的摄像机设备,则为 true。


position : enumeration

返回摄像机在硬件系统中的物理位置。

返回值可以是以下值之一:

常量说明
cameraDevice.UnspecifiedPosition摄像机位置未指定或未知。
cameraDevice.BackFace摄像头位于系统硬件的背面。例如,在移动设备上,这意味着摄像头位于屏幕的反面。
cameraDevice.FrontFace摄像头位于系统硬件的正面。例如,在移动设备上,这意味着它与屏幕在同一面。前置摄像头的预览会围绕垂直轴翻转,以镜像方式显示视频输出,而录制时则不会进行这种翻转。

videoFormats : CameraFormat

保存相机支持的视频格式。


© 2025 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.