QWindowCapture Class

This class is used for capturing a window. 更多...

头: #include <QWindowCapture>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
Since: Qt 6.6
实例化: WindowCapture
继承: QObject

公共类型

enum Error { NoError, InternalError, CapturingNotSupported, CaptureFailed, NotFound }

特性

公共函数

QWindowCapture (QObject * parent = nullptr)
virtual ~QWindowCapture () override
QWindowCapture::Error error () const
QString errorString () const
bool isActive () const
void setWindow (QCapturableWindow window )
QCapturableWindow window () const

公共槽

void setActive (bool active )
void start ()
void stop ()

信号

void activeChanged (bool)
void errorChanged ()
void errorOccurred (QWindowCapture::Error error , const QString & errorString )
void windowChanged (QCapturableWindow window )

静态公共成员

QList<QCapturableWindow> capturableWindows ()

详细描述

The class captures a window. It is managed by the QMediaCaptureSession class where the captured window can be displayed in a video preview object or recorded to a file.

另请参阅 QMediaCaptureSession and QCapturableWindow .

成员类型文档编制

enum QWindowCapture:: Error

Enumerates error codes that can be signaled by the QWindowCapture 类。 errorString () provides detailed information about the error cause.

常量 描述
QWindowCapture::NoError 0 No error
QWindowCapture::InternalError 1 Internal window capturing driver error
QWindowCapture::CapturingNotSupported 2 Window capturing is not supported
QWindowCapture::CaptureFailed 4 Capturing window failed
QWindowCapture::NotFound 5 Selected window not found

特性文档编制

active : bool

This property holds whether the capturing is currently active.

访问函数:

bool isActive () const
void setActive (bool active )

通知程序信号:

void activeChanged (bool)

另请参阅 start () 和 stop ().

[read-only] error : const Error

This property holds the code of the last error.

访问函数:

QWindowCapture::Error error () const

通知程序信号:

void errorChanged ()

[read-only] errorString : const QString

This property holds a human readable string describing the cause of error.

访问函数:

QString errorString () const

通知程序信号:

void errorChanged ()

window : QCapturableWindow

This property holds the window for capturing.

访问函数:

QCapturableWindow window () const
void setWindow (QCapturableWindow window )

通知程序信号:

void windowChanged (QCapturableWindow window )

另请参阅 QWindowCapture::capturableWindows .

成员函数文档编制

[explicit] QWindowCapture:: QWindowCapture ( QObject * parent = nullptr)

Constructs a new QWindowCapture object with parent .

[override virtual noexcept] QWindowCapture:: ~QWindowCapture ()

销毁对象。

[static invokable] QList < QCapturableWindow > QWindowCapture:: capturableWindows ()

Returns a list of QCapturableWindow objects that is available for capturing.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[signal] void QWindowCapture:: errorOccurred ( QWindowCapture::Error error , const QString & errorString )

Signals when an error occurs, along with the errorString .

[slot] void QWindowCapture:: start ()

Starts capturing the window .

This is equivalent to setting the active 特性为 true。

[slot] void QWindowCapture:: stop ()

Stops capturing.

This is equivalent to setting the active property to false.