在本页

WindowCapture QML Type

该类型用于捕捉窗口。更多

Import Statement: import QtMultimedia
Since: Qt 6.6
In C++: QWindowCapture

属性

方法

详细说明

WindowCapture 可捕获窗口。它由 MediaCaptureSession 管理,捕获的窗口可显示在视频预览对象中或录制到文件中。

窗口捕捉限制

使用 WindowCapture 时有以下限制:

  • WindowCapture 仅支持 FFmpeg 后端。

在 X11 系统上使用QWindowCapture 时有以下限制:

  • 在 Linux X11 系统上,当窗口部分移出可见屏幕区域时,只有可见区域会被捕获。因此,发射的视频帧大小可能小于窗口的几何尺寸。
  • 超出可见屏幕区域的窗口无法捕捉,在这种情况下会发出错误信号。
  • 最小化窗口或位于不可见虚拟工作区的窗口的行为取决于窗口管理器。例如,在 GNOME 上可以捕获此类窗口,而在 WindowMaker 或 Xfwm 上则不允许捕获,窗口捕获实例会发出错误信息。

另请参阅 CaptureSessionCapturableWindow

属性文档

active : bool

描述捕获当前是否处于活动状态。

error : enumeration [read-only]

返回最后一个错误的代码。

errorString : string [read-only]

返回描述错误原因的可读字符串。

window : Window

描述捕捉窗口。

另请参阅 QtMultimedia::WindowCapture::capturableWindows

方法文档

list<CapturableWindow> capturableWindows()

返回可用于捕获的CapturableWindow 对象列表。

void start()

开始捕获window

这相当于将active 属性设置为true

void stop()

停止捕获。

这相当于将active 属性设置为false

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