QWindowCapture 類

此類用於捕獲窗口。 更多...

頭: #include <QWindowCapture>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
Since: Qt 6.6
在 QML: 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.

Window Capture Limitations

The following limitations apply to using QWindowCapture:

  • QWindowCapture is only supported with the FFmpeg backend.

另請參閱 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 沒有錯誤
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

此特性保持捕獲目前是否活動。

訪問函數:

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)

構造新 QWindowCapture 對象采用 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 ()

啓動捕獲 window .

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

[slot] void QWindowCapture:: stop ()

停止捕獲。

This is equivalent to setting the active property to false.