- Qt 6.11
- Qt Multimedia
- QML Types
- WindowCapture
- Qt 6.11.2 Reference Documentation

# WindowCapture QML Type

This type is used for capturing a window. More...

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

- List of all members, including inherited members

## Properties

- active : bool
- error : enumeration
- errorString : string
- window : Window

## Signals

- errorChanged()
- errorOccurred(int error, string errorString)

## Methods

- list<CapturableWindow> capturableWindows()
- void start()
- void stop()

## Detailed Description

WindowCapture captures a window. It is managed by MediaCaptureSession 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 WindowCapture:

- WindowCapture is only supported with the FFmpeg backend.
- On some platforms, no new video frames are emitted while the captured window content remains unchanged. Applications should therefore not rely on receiving a continuous stream of frames at the requested frame rate.

The following limitations apply when using `QWindowCapture` on X11 systems:

- On Linux X11 systems, when a window is moved partially outside the visible screen area, only the visible region is captured. As a result, the emitted video frames may have a size smaller than the window’s geometry.
- Windows that are outside the visible screen area cannot be captured, and an error signal is emitted in that case.
- The behavior of minimized windows or those located on an invisible virtual workspace depends on the window manager. For example, such windows can be captured on GNOME, whereas on WindowMaker or Xfwm such capturing is not allowed, and the window capture instance emits an error.

See also CaptureSession and CapturableWindow.

## Property Documentation

### active : bool

Describes whether the capturing is currently active.

### error : enumeration `[read-only]`

Returns a code of the last error.

Constant | Description
--- | ---
`WindowCapture.NoError` | No error
`WindowCapture.InternalError` | Internal window capturing driver error
`WindowCapture.CapturingNotSupported` | Window capturing is not supported
`WindowCapture.CaptureFailed` | Capturing window failed
`WindowCapture.NotFound` | Selected window not found

### errorString : string `[read-only]`

Returns a human readable string describing the cause of error.

### window : Window

Describes the window for capturing.

See also QtMultimedia::WindowCapture::capturableWindows.

## Signal Documentation

### errorChanged()

This signal is emitted when the error or errorString properties are changed.

This signal is not emitted whenever multiple identical errors are raised. To track such errors, use the signal errorOccurred.

Note: The corresponding handler is `onErrorChanged`.

### errorOccurred(int error, string errorString)

Signals when an error occurs, along with the errorString.

For the error parameter, see the enumeration table in error for what values may be passed.

Note: The corresponding handler is `onErrorOccurred`.

See also error.

## Method Documentation

### list<CapturableWindow> capturableWindows()

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

### void start()

Starts capturing the window.

This is equivalent to setting the active property to `true`.

### void stop()

Stops capturing.

This is equivalent to setting the active property to `false`.