IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QWaylandSurfaceRole Class

The QWaylandSurfaceRole class represents the role of the surface in context of wl_surface.

This class was introduced in Qt 5.8.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QWaylandSurfaceRole Class

  • Header: QWaylandSurfaceRole

  • Since: Qt 5.8

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Waylandcompositor)

    target_link_libraries(mytarget PRIVATE Qt6::Waylandcompositor)

  • qmake: QT += waylandcompositor

Detailed Description

QWaylandSurfaceRole is used to represent the role of a QWaylandSurface. According to the protocol specification, the role of a surface is permanent once set, and if the same surface is later reused for a different role, this constitutes a protocol error. Setting the surface to the same role multiple times is not an error.

As an example, the QWaylandXdgShell can assign either "popup" or "toplevel" roles to surfaces. If get_toplevel is requested on a surface which has previously received a get_popup request, then the compositor will issue a protocol error.

Roles are compared by pointer value, so any two objects of QWaylandSurfaceRole will be considered different roles, regardless of what their names are. A typical way of assigning a role is to have a static QWaylandSurfaceRole object to represent it.

 
Sélectionnez
class MyShellSurfaceSubType
{
    static QWaylandSurfaceRole s_role;
    // ...
};

// ...

surface->setRole(&MyShellSurfaceSubType::s_role, resource->handle, MY_ERROR_CODE);

Member Function Documentation

 

QWaylandSurfaceRole::QWaylandSurfaceRole(const QByteArray &name)

Creates a QWaylandSurfaceRole and assigns it name. The name is used in error messages involving this QWaylandSurfaceRole.

const QByteArray QWaylandSurfaceRole::name()

Returns the name of the QWaylandSurfaceRole. The name is used in error messages involving this QWaylandSurfaceRole, for example if an attempt is made to change the role of a surface.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+