QWaylandSurface Class

The QWaylandSurface class represents a rectangular area on an output device. 更多...

头: #include <QWaylandSurface>
CMake: find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor)
target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor)
qmake: QT += waylandcompositor
实例化: WaylandSurface
继承: QWaylandObject

公共类型

enum Origin { OriginTopLeft, OriginBottomLeft }

特性

公共函数

QWaylandSurface ()
QWaylandSurface (QWaylandCompositor * compositor , QWaylandClient * client , uint id , int version )
virtual ~QWaylandSurface () override
int bufferScale () const
QSize bufferSize () const
QWaylandClient * client () const
QWaylandCompositor * compositor () const
Qt::ScreenOrientation contentOrientation () const
QSize destinationSize () const
void destroy ()
void frameStarted ()
bool hasContent () const
bool inhibitsIdle () const
void initialize (QWaylandCompositor * compositor , QWaylandClient * client , uint id , int version )
bool inputRegionContains (const QPoint & p ) const
bool inputRegionContains (const QPointF & position ) const
bool isCursorSurface () const
bool isDestroyed () const
bool isInitialized () const
bool isOpaque () const
void markAsCursorSurface (bool cursorSurface )
QWaylandSurface::Origin origin () const
QWaylandView * primaryView () const
struct wl_resource * resource () const
void sendFrameCallbacks ()
void setPrimaryView (QWaylandView * view )
bool setRole (QWaylandSurfaceRole * role , wl_resource * errorResource , uint32_t errorCode )
QRectF sourceGeometry () const
QList<QWaylandView *> views () const
wl_client * waylandClient () const

公共槽

void updateSelection ()

信号

void bufferScaleChanged ()
void bufferSizeChanged ()
void childAdded (QWaylandSurface * child )
void contentOrientationChanged ()
void cursorSurfaceChanged ()
void destinationSizeChanged ()
void dragStarted (QWaylandDrag * drag )
void hasContentChanged ()
void inhibitsIdleChanged ()
void isOpaqueChanged ()
void originChanged ()
void sourceGeometryChanged ()
void surfaceDestroyed ()

静态公共成员

QWaylandSurface * fromResource (wl_resource * resource )

详细描述

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

成员类型文档编制

enum QWaylandSurface:: Origin

This enum type is used to specify the origin of a QWaylandSurface 's buffer.

常量 描述
QWaylandSurface::OriginTopLeft 0 The origin is the top left corner of the buffer.
QWaylandSurface::OriginBottomLeft 1 The origin is the bottom left corner of the buffer.

特性文档编制

[read-only] bufferScale : const int

此特性保持 QWaylandSurface 's buffer scale. The buffer scale lets a client supply higher resolution buffer data for use on high resolution outputs.

访问函数:

int bufferScale () const

通知程序信号:

void bufferScaleChanged ()

[read-only] bufferSize : const QSize

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

For the size in surface coordinates, use destinationSize 代替。

访问函数:

QSize bufferSize () const

通知程序信号:

void bufferSizeChanged ()

另请参阅 destinationSize and bufferScale .

[read-only] client : QWaylandClient * const

This property holds the client using this QWaylandSurface .

访问函数:

QWaylandClient * client () const

[read-only] contentOrientation : const Qt::ScreenOrientation

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

访问函数:

Qt::ScreenOrientation contentOrientation () const

通知程序信号:

void contentOrientationChanged ()

另请参阅 QWaylandOutput::transform .

cursorSurface : bool

This property holds whether the QWaylandSurface is a cursor surface.

访问函数:

bool isCursorSurface () const
void markAsCursorSurface (bool cursorSurface )

通知程序信号:

void cursorSurfaceChanged ()

[read-only] destinationSize : const QSize

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

访问函数:

QSize destinationSize () const

通知程序信号:

void destinationSizeChanged ()

另请参阅 bufferScale and bufferSize .

[read-only] hasContent : const bool

This property holds whether the QWaylandSurface has content.

访问函数:

bool hasContent () const

通知程序信号:

void hasContentChanged ()

[read-only] inhibitsIdle : const bool

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

访问函数:

bool inhibitsIdle () const

通知程序信号:

void inhibitsIdleChanged ()

另请参阅 QWaylandIdleInhibitManagerV1 .

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

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

该特性在 Qt 6.4 引入。

访问函数:

bool isOpaque () const

通知程序信号:

void isOpaqueChanged ()

[read-only] origin : const QWaylandSurface::Origin

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

访问函数:

QWaylandSurface::Origin origin () const

通知程序信号:

void originChanged ()

[read-only] sourceGeometry : const QRectF

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

访问函数:

QRectF sourceGeometry () const

通知程序信号:

void sourceGeometryChanged ()

另请参阅 bufferScale , bufferSize ,和 destinationSize .

成员函数文档编制

QWaylandSurface:: QWaylandSurface ()

Constructs a an uninitialized QWaylandSurface.

QWaylandSurface:: QWaylandSurface ( QWaylandCompositor * compositor , QWaylandClient * client , uint id , int version )

Constructs and initializes a QWaylandSurface for the given compositor and client ,和采用给定 id and version .

[override virtual noexcept] QWaylandSurface:: ~QWaylandSurface ()

销毁 QWaylandSurface .

[signal] void QWaylandSurface:: childAdded ( QWaylandSurface * child )

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

QWaylandCompositor *QWaylandSurface:: compositor () const

Returns the compositor for this QWaylandSurface .

[invokable] void QWaylandSurface:: destroy ()

销毁 QWaylandSurface .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[signal] void QWaylandSurface:: dragStarted ( QWaylandDrag * drag )

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

[invokable] void QWaylandSurface:: frameStarted ()

Prepares all frame callbacks for sending.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

[static] QWaylandSurface *QWaylandSurface:: fromResource ( wl_resource * resource )

返回 QWaylandSurface corresponding to the Wayland resource resource .

[invokable] void QWaylandSurface:: initialize ( QWaylandCompositor * compositor , QWaylandClient * client , uint id , int version )

初始化 QWaylandSurface 采用给定 compositor and client ,和采用给定 id and version .

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

bool QWaylandSurface:: inputRegionContains (const QPoint & p ) const

返回 true QWaylandSurface 's input region contains the point p . Otherwise returns false .

bool QWaylandSurface:: inputRegionContains (const QPointF & position ) const

返回 true QWaylandSurface 's input region contains the point position . Otherwise returns false .

[invokable] bool QWaylandSurface:: isDestroyed () const

返回 true 若 QWaylandSurface has been destroyed. Otherwise returns false.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

bool QWaylandSurface:: isInitialized () const

返回 true 若 QWaylandSurface has been initialized.

QWaylandView *QWaylandSurface:: primaryView () const

Returns this QWaylandSurface 's primary view.

另请参阅 QWaylandView::advance () 和 QWaylandSurface::setPrimaryView ().

struct wl_resource *QWaylandSurface:: resource () const

Returns the Wayland resource corresponding to this QWaylandSurface .

[invokable] void QWaylandSurface:: sendFrameCallbacks ()

Sends pending frame callbacks.

注意: 此函数可以被援引,通过元对象系统和从 QML。见 Q_INVOKABLE .

void QWaylandSurface:: setPrimaryView ( QWaylandView * view )

设置此 QWaylandSurface 's primary view to view , in case there are multiple views of this surface. The primary view is the view that governs the client's refresh rate. It takes care of discarding buffer references when QWaylandView::advance () is called. See the documentation for QWaylandView::advance () 了解更多细节。

In shell surface integrations, such as QWaylandWlShellIntegration and QWaylandXdgShellV5Integration, maximize and fullscreen requests from the client will only have an effect if the integration has the primary view of the surface.

另请参阅 primaryView () 和 QWaylandView::advance ().

bool QWaylandSurface:: setRole ( QWaylandSurfaceRole * role , wl_resource * errorResource , uint32_t errorCode )

设置 role on the surface. A role defines how a surface will be mapped on screen; without a role a surface is supposed to be hidden. Once a role is assigned to a surface, this becomes its permanent role. Any subsequent call to setRole() with a different role will trigger a protocol error to the errorResource and send an errorCode to the client. Enforcing this requirement is the main purpose of the surface role.

The role is compared by pointer value. Any two objects of QWaylandSurfaceRole will be considered different roles, regardless of their names.

The surface role is set internally by protocol implementations when a surface is adopted for a specific purpose, for example in a shell extension . Unless you are developing extensions which use surfaces in this way, you should not call this function.

Returns true if a role can be assigned; false otherwise.

[signal] void QWaylandSurface:: surfaceDestroyed ()

This signal is emitted when the corresponing wl_surface is destroyed.

[slot] void QWaylandSurface:: updateSelection ()

Updates the surface with the compositor's retained clipboard selection. Although this is done automatically when the surface receives keyboard focus, this function is useful for updating clients which do not have keyboard focus.

QList < QWaylandView *> QWaylandSurface:: views () const

Returns the views for this QWaylandSurface .

wl_client *QWaylandSurface:: waylandClient () const

保持 wl_client using this QWaylandSurface .