- Qt 6.7
- Qt Wayland Compositor
- C++ Classes
- QWaylandXdgToplevel
- Qt Wayland Compositor | Commercial or GPLv3

# QWaylandXdgToplevel Class

The QWaylandXdgToplevel class represents the toplevel window specific parts of an xdg surface. More...

Header: | #include <QWaylandXdgToplevel>
CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor)
qmake: | QT += waylandcompositor
Instantiated By: | XdgToplevel
Inherits: | QObject

- List of all members, including inherited members

## Public Types

enum | DecorationMode { ServerSideDecoration, ClientSideDecoration }

## Properties

activated : const bool appId : const QString decorationMode : const enum DecorationMode fullscreen : const bool maxSize : const QSize maximized : const bool | minSize : const QSize parentToplevel : QWaylandXdgToplevel* const resizing : const bool states : const QList<int> title : const QString xdgSurface : QWaylandXdgSurface* const

## Public Functions

| QWaylandXdgToplevel(QWaylandXdgSurface *xdgSurface, QWaylandResource &resource)
bool | activated() const
QString | appId() const
QWaylandXdgToplevel::DecorationMode | decorationMode() const
bool | fullscreen() const
QSize | maxSize() const
bool | maximized() const
QSize | minSize() const
QWaylandXdgToplevel * | parentToplevel() const
bool | resizing() const
void | sendClose()
uint | sendConfigure(const QSize &size, const QList<QWaylandXdgToplevel::State> &states)
uint | sendFullscreen(const QSize &size)
uint | sendMaximized(const QSize &size)
uint | sendResizing(const QSize &maxSize)
uint | sendUnmaximized(const QSize &size = QSize(0, 0))
QSize | sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const
QString | title() const
QWaylandXdgSurface * | xdgSurface() const

## Signals

void | activatedChanged()
void | appIdChanged()
void | decorationModeChanged()
void | fullscreenChanged()
void | maxSizeChanged()
void | maximizedChanged()
void | minSizeChanged()
void | parentToplevelChanged()
void | resizingChanged()
void | statesChanged()
void | titleChanged()

## Static Public Members

QWaylandXdgToplevel * | fromResource(wl_resource *resource)
QWaylandSurfaceRole * | role()

## Detailed Description

This class is part of the QWaylandXdgShell extension and provides a way to extend the functionality of an QWaylandXdgSurface with features specific to desktop-style windows.

It corresponds to the Wayland interface `xdg_toplevel`.

## Member Type Documentation

### enum QWaylandXdgToplevel::DecorationMode

This enum type is used to specify the window decoration mode for toplevel windows.

Constant | Value | Description
--- | --- | ---
`QWaylandXdgToplevel::ServerSideDecoration` | `2` | The compositor should draw window decorations.
`QWaylandXdgToplevel::ClientSideDecoration` | `1` | The client should draw window decorations.

## Property Documentation

### `[read-only]` activated : const bool

This property holds whether toplevel is drawing itself as having input focus.

Access functions:

bool | activated() const

Notifier signal:

void | activatedChanged()

### `[read-only]` appId : const QString

This property holds the app id of the QWaylandXdgToplevel.

Access functions:

QString | appId() const

Notifier signal:

void | appIdChanged()

### `[read-only]` decorationMode : const enum DecorationMode

This property holds the current window decoration mode for this toplevel.

Access functions:

QWaylandXdgToplevel::DecorationMode | decorationMode() const

Notifier signal:

void | decorationModeChanged()

See also QWaylandXdgDecorationManagerV1.

### `[read-only]` fullscreen : const bool

This property holds whether the client has acknowledged that it should be fullscreen.

Access functions:

bool | fullscreen() const

Notifier signal:

void | fullscreenChanged()

### `[read-only]` maxSize : const QSize

This property holds the maximum size of the QWaylandXdgToplevel.

The compositor is free to ignore this value and request a larger size.

Access functions:

QSize | maxSize() const

Notifier signal:

void | maxSizeChanged()

### `[read-only]` maximized : const bool

This property holds whether the client has acknowledged that it should be maximized.

Access functions:

bool | maximized() const

Notifier signal:

void | maximizedChanged()

### `[read-only]` minSize : const QSize

This property holds the minimum size of the QWaylandXdgToplevel.

The compositor is free to ignore this value and request a smaller size.

Access functions:

QSize | minSize() const

Notifier signal:

void | minSizeChanged()

### `[read-only]` parentToplevel : QWaylandXdgToplevel* const

This property holds the XdgToplevel parent of this XdgToplevel.

Access functions:

QWaylandXdgToplevel * | parentToplevel() const

Notifier signal:

void | parentToplevelChanged()

### `[read-only]` resizing : const bool

This property holds whether the client has acknowledged that it is being resized.

Access functions:

bool | resizing() const

Notifier signal:

void | resizingChanged()

### `[read-only]` states : const QList<int>

This property holds the last states the client acknowledged for this QWaylandToplevel.

Notifier signal:

void | statesChanged()

### `[read-only]` title : const QString

This property holds the title of the QWaylandXdgToplevel.

Access functions:

QString | title() const

Notifier signal:

void | titleChanged()

### `[read-only]` xdgSurface : QWaylandXdgSurface* const

This property holds the QWaylandXdgSurface for this QWaylandXdgToplevel.

Access functions:

QWaylandXdgSurface * | xdgSurface() const

## Member Function Documentation

### `[explicit]` QWaylandXdgToplevel::QWaylandXdgToplevel(QWaylandXdgSurface *xdgSurface, QWaylandResource &resource)

Constructs a QWaylandXdgToplevel for the given xdgSurface and resource.

### `[static]` QWaylandXdgToplevel *QWaylandXdgToplevel::fromResource(wl_resource *resource)

Returns the QWaylandXdgToplevel corresponding to the resource.

### `[static]` QWaylandSurfaceRole *QWaylandXdgToplevel::role()

Returns the surface role for the QWaylandToplevel.

### `[invokable]` void QWaylandXdgToplevel::sendClose()

Sends a close event to the client. The client may choose to ignore the event.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

### uint QWaylandXdgToplevel::sendConfigure(const QSize &size, const QList<QWaylandXdgToplevel::State> &states)

Sends a configure event to the client. Parameter size contains the pixel size of the surface. A size of zero means the client is free to decide the size. Known states are enumerated in QWaylandXdgToplevel::State.

### `[invokable]` uint QWaylandXdgToplevel::sendFullscreen(const QSize &size)

Convenience for sending a configure event with the fullscreen state set, and maximized and resizing removed. The activated state is left in its current state.

size is the new size of the window.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

See also sendUnmaximized.

### `[invokable]` uint QWaylandXdgToplevel::sendMaximized(const QSize &size)

Convenience for sending a configure event with the maximized state set, and fullscreen and resizing removed. The activated state is left in its current state.

size is the new size of the window.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

### `[invokable]` uint QWaylandXdgToplevel::sendResizing(const QSize &maxSize)

Convenience for sending a configure event with the resizing state set, and maximized and fullscreen removed. The activated state is left in its current state.

maxSize is the new size of the window.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

### `[invokable]` uint QWaylandXdgToplevel::sendUnmaximized(const QSize &size = QSize(0, 0))

Convenience for sending a configure event with the maximized, fullscreen and resizing states removed, and fullscreen and resizing removed. The activated state is left in its current state.

size is the new size of the window. If size is zero, the client decides the size.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

### `[invokable]` QSize QWaylandXdgToplevel::sizeForResize(const QSizeF &size, const QPointF &delta, Qt::Edges edges) const

Convenience for computing the new size given the current size, a delta, and the edges active in the drag.

Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.