- Qt 6.7
- Qt Wayland Compositor
- QML Types
- WaylandSurface
- Qt Wayland Compositor | Commercial or GPLv3

# WaylandSurface QML Type

Represents a rectangular area on an output device. More...

Import Statement: | import QtWayland.Compositor
Instantiates: | QWaylandSurface

- List of all members, including inherited members

## Properties

- bufferScale : size
- bufferSize : size
- client : WaylandClient
- contentOrientation : enum
- cursorSurface : bool
- destinationSize : size
- hasContent : bool
- inhibitsIdle : bool
- isOpaque : bool `(since 6.4)`
- origin : enum
- sourceGeometry : rect
- useTextureAlpha : bool

## Signals

- childAdded(WaylandSurface child)
- void dragStarted(WaylandDrag drag)
- surfaceDestroyed()

## Methods

- void destroy()
- void initialize(WaylandCompositor compositor, WaylandClient client, int id, int version)
- bool isDestroyed()

## Detailed Description

This type encapsulates a rectangular area of pixels that is displayed on an output device. It corresponds to the interface `wl_surface` in the Wayland protocol.

## Property Documentation

bufferScale : size `[read-only]`

This property holds the WaylandSurface's buffer scale. The buffer scale lets a client supply higher resolution buffer data for use on high resolution outputs.

bufferSize : size `[read-only]`

This property holds the size of the current buffer of this WaylandSurface in pixels, not in surface coordinates.

For the size in surface coordinates, use destinationSize instead.

See also destinationSize and bufferScale.

client : WaylandClient `[read-only]`

This property holds the client using this WaylandSurface.

contentOrientation : enum `[read-only]`

This property holds the orientation of the WaylandSurface's contents.

See also WaylandOutput.transform.

cursorSurface : bool

This property holds whether the WaylandSurface is a cursor surface.

destinationSize : size `[read-only]`

This property holds the size of this WaylandSurface in surface coordinates.

See also bufferScale and bufferSize.

hasContent : bool `[read-only]`

This property holds whether the WaylandSurface has content.

inhibitsIdle : bool `[read-only]`

This property holds whether this surface is intended to inhibit the idle behavior of the compositor such as screen blanking, locking and screen saving.

See also IdleInhibitManagerV1.

isOpaque : bool `[read-only, since 6.4]`

This property holds whether the surface is fully opaque, as reported by the client through the set_opaque_region request.

This property was introduced in Qt 6.4.

origin : enum `[read-only]`

This property holds the origin of the WaylandSurface's buffer, or WaylandSurface.OriginTopLeft if the surface has no buffer.

It can have the following values:

- WaylandSurface.OriginTopLeft The origin is the top left corner of the buffer.
- WaylandSurface.OriginBottomLeft The origin is the bottom left corner of the buffer.

sourceGeometry : rect `[read-only]`

This property describes the portion of the attached Wayland buffer that should be drawn on the screen. The coordinates are from the corner of the buffer and are scaled by bufferScale.

See also bufferScale, bufferSize, and destinationSize.

useTextureAlpha : bool

This property specifies whether the surface should use texture alpha.

## Signal Documentation

childAdded(WaylandSurface child)

This signal is emitted when a wl_subsurface, child, has been added to the surface.

Note: The corresponding handler is `onChildAdded`.

void dragStarted(WaylandDrag drag)

This signal is emitted when a drag has started from this surface.

Note: The corresponding handler is `onDragStarted`.

surfaceDestroyed()

This signal is emitted when the corresponding wl_surface is destroyed.

Note: The corresponding handler is `onSurfaceDestroyed`.

## Method Documentation

void destroy()

Destroys the WaylandSurface.

void initialize(WaylandCompositor compositor, WaylandClient client, int id, int version)

Initializes the WaylandSurface with the given compositor and client, and with the given id and version.

bool isDestroyed()

Returns `true` if the WaylandSurface has been destroyed. Otherwise returns `false`.