This class is used for capturing a window. More...
| Header: | #include <QWindowCapture> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Multimedia)target_link_libraries(mytarget PRIVATE Qt6::Multimedia) |
| qmake: | QT += multimedia |
| Since: | Qt 6.6 |
| In QML: | WindowCapture |
| Inherits: | 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 | 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.
The following limitations apply to using QWindowCapture:
See also QMediaCaptureSession and QCapturableWindow.
Enumerates error codes that can be signaled by the QWindowCapture class. errorString() provides detailed information about the error cause.
| Constant | Value | Description |
|---|---|---|
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 |
This property holds whether the capturing is currently active.
Access functions:
| bool | isActive() const |
| void | setActive(bool active) |
Notifier signal:
| void | activeChanged(bool) |
[read-only] error : const ErrorThis property holds the code of the last error.
Access functions:
| QWindowCapture::Error | error() const |
Notifier signal:
| void | errorChanged() |
[read-only] errorString : const QStringThis property holds a human readable string describing the cause of error.
Access functions:
| QString | errorString() const |
Notifier signal:
| void | errorChanged() |
This property holds the window for capturing.
Access functions:
| QCapturableWindow | window() const |
| void | setWindow(QCapturableWindow window) |
Notifier signal:
| void | windowChanged(QCapturableWindow window) |
See also QWindowCapture::capturableWindows.
[explicit] QWindowCapture::QWindowCapture(QObject *parent = nullptr)Constructs a new QWindowCapture object with parent.
[override virtual noexcept] QWindowCapture::~QWindowCapture()Destroys the object.
[static invokable] QList<QCapturableWindow> QWindowCapture::capturableWindows()Returns a list of QCapturableWindow objects that is available for capturing.
Note: This function can be invoked via the meta-object system and from QML. See 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 property to true.
[slot] void QWindowCapture::stop()Stops capturing.
This is equivalent to setting the active property to false.