QWaylandSurface Class
QWaylandSurface 类表示输出设备上的矩形区域。更多
头文件: | #include <QWaylandSurface> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor) |
qmake: | QT += waylandcompositor |
在 QML 中: | 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) |
成员类型文档
enum QWaylandSurface::Origin
该枚举类型用于指定QWaylandSurface 缓冲区的原点。
常量 | 值 | 说明 |
---|---|---|
QWaylandSurface::OriginTopLeft | 0 | 原点是缓冲区的左上角。 |
QWaylandSurface::OriginBottomLeft | 1 | 原点是缓冲区的左下角。 |
属性文档
[read-only]
bufferScale : const int
该属性用于保存QWaylandSurface 的缓冲区缩放比例。缓冲区刻度允许客户端提供更高分辨率的缓冲区数据,以用于高分辨率输出。
访问功能:
int | bufferScale() const |
通知信号:
void | bufferScaleChanged() |
[read-only]
bufferSize : const QSize
此属性表示QWaylandSurface 当前缓冲区的大小(像素),而不是表面坐标。
若要获取表面坐标大小,请使用destinationSize 。
访问功能:
QSize | bufferSize() const |
Notifier 信号:
void | bufferSizeChanged() |
另请参阅 destinationSize 和bufferScale 。
[read-only]
client : QWaylandClient* const
该属性包含使用该QWaylandSurface 的客户端。
访问功能:
QWaylandClient * | client() const |
[read-only]
contentOrientation : const Qt::ScreenOrientation
该属性表示QWaylandSurface 内容的方向。
访问功能:
Qt::ScreenOrientation | contentOrientation() const |
Notifier 信号:
void | contentOrientationChanged() |
另请参阅 QWaylandOutput::transform 。
cursorSurface : bool
该属性表示QWaylandSurface 是否是游标表面。
访问功能:
bool | isCursorSurface() const |
void | markAsCursorSurface(bool cursorSurface) |
通知信号:
void | cursorSurfaceChanged() |
[read-only]
destinationSize : const QSize
该属性以曲面坐标表示WaylandSurface 的大小。
访问功能:
QSize | destinationSize() const |
Notifier 信号:
void | destinationSizeChanged() |
另请参阅 bufferScale 和bufferSize 。
[read-only]
hasContent : const bool
该属性表示QWaylandSurface 是否有内容。
访问功能:
bool | hasContent() const |
Notifier 信号:
void | hasContentChanged() |
[read-only]
inhibitsIdle : const bool
此属性表示此曲面是否用于抑制合成器的空闲行为,如屏幕空白、锁定和屏幕保存。
访问功能:
bool | inhibitsIdle() const |
Notifier 信号:
void | inhibitsIdleChanged() |
另请参阅 QWaylandIdleInhibitManagerV1 。
[read-only, since 6.4]
isOpaque : const bool
此属性保留曲面是否完全不透明,正如客户端通过 set_opaque_region 请求所报告的那样。
此属性在 Qt 6.4 中引入。
访问函数:
bool | isOpaque() const |
Notifier 信号:
void | isOpaqueChanged() |
[read-only]
origin : const QWaylandSurface::Origin
此属性保存QWaylandSurface 缓冲区的原点,如果曲面没有缓冲区,则保存QWaylandSurface::OriginTopLeft 。
访问功能:
QWaylandSurface::Origin | origin() const |
通知信号:
void | originChanged() |
[read-only]
sourceGeometry : const QRectF
该属性描述了所附 QWaylandBuffer 中应绘制在屏幕上的部分。坐标从缓冲区的角落开始,按bufferScale 缩放。
访问功能:
QRectF | sourceGeometry() const |
Notifier 信号:
void | sourceGeometryChanged() |
另请参阅 bufferScale,bufferSize, 和destinationSize 。
成员函数文档
QWaylandSurface::QWaylandSurface()
构造一个未初始化的 QWaylandSurface。
QWaylandSurface::QWaylandSurface(QWaylandCompositor *compositor, QWaylandClient *client, uint id, int version)
为给定的compositor 和client 以及给定的id 和version 构建并初始化一个 QWaylandSurface。
[override virtual noexcept]
QWaylandSurface::~QWaylandSurface()
[signal]
void QWaylandSurface::childAdded(QWaylandSurface *child)
当曲面上添加了一个 wl_subsurfacechild 时,会发出这个信号。
QWaylandCompositor *QWaylandSurface::compositor() const
返回QWaylandSurface 的合成器。
[invokable]
void QWaylandSurface::destroy()
销毁QWaylandSurface 。
注: 可通过元对象系统和 QML 调用该函数。请参见Q_INVOKABLE 。
[signal]
void QWaylandSurface::dragStarted(QWaylandDrag *drag)
当drag 从该表面启动时会发出该信号。
[invokable]
void QWaylandSurface::frameStarted()
准备发送所有框架回调。
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
[static]
QWaylandSurface *QWaylandSurface::fromResource(wl_resource *resource)
返回与 Wayland 资源resource 相对应的QWaylandSurface 。
[invokable]
void QWaylandSurface::initialize(QWaylandCompositor *compositor, QWaylandClient *client, uint id, int version)
用给定的compositor 和client 以及给定的id 和version 初始化QWaylandSurface 。
注: 可通过元对象系统和 QML 调用该函数。请参见Q_INVOKABLE 。
bool QWaylandSurface::inputRegionContains(const QPoint &p) const
如果QWaylandSurface 的输入区域包含点p ,则返回true
。否则返回false
。
bool QWaylandSurface::inputRegionContains(const QPointF &position) const
如果QWaylandSurface 的输入区域包含点position ,则返回true
。否则返回false
。
[invokable]
bool QWaylandSurface::isDestroyed() const
如果QWaylandSurface 已被销毁,则返回 true。否则返回 false。
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
bool QWaylandSurface::isInitialized() const
如果QWaylandSurface 已初始化,则返回 true。
QWaylandView *QWaylandSurface::primaryView() const
返回QWaylandSurface 的主视图。
另请参阅 QWaylandView::advance() 和QWaylandSurface::setPrimaryView()。
struct wl_resource *QWaylandSurface::resource() const
返回与此QWaylandSurface 对应的 Wayland 资源。
[invokable]
void QWaylandSurface::sendFrameCallbacks()
发送待处理的帧回调。
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
void QWaylandSurface::setPrimaryView(QWaylandView *view)
将QWaylandSurface 的主视图设置为view ,以防该曲面有多个视图。主视图是控制客户端刷新率的视图。当调用QWaylandView::advance() 时,它会负责丢弃缓冲区引用。更多详情,请参阅QWaylandView::advance() 文档。
在 Shell 表面集成(如 QWaylandWlShellIntegration 和 QWaylandXdgShellV5Integration)中,来自客户端的最大化和全屏请求只有在集成拥有表面的主视图时才会生效。
另请参阅 primaryView() 和QWaylandView::advance()。
bool QWaylandSurface::setRole(QWaylandSurfaceRole *role, wl_resource *errorResource, uint32_t errorCode)
在曲面上设置role 。角色定义了曲面在屏幕上的映射方式;没有角色的曲面应该是隐藏的。一旦为曲面指定了角色,它就会成为该曲面的永久角色。任何后续调用setRole()
的不同角色都会引发errorResource 协议错误,并向客户端发送errorCode 。执行这一要求是表面角色的主要目的。
role 通过指针值进行比较。QWaylandSurfaceRole 的任何两个对象都将被视为不同的角色,无论其名称如何。
当为特定目的(例如在shell 扩展中)采用表面时,协议实现会在内部设置表面角色。除非您正在开发以这种方式使用表面的扩展,否则不应调用此函数。
如果可以分配角色,则返回 true;否则返回 false。
[signal]
void QWaylandSurface::surfaceDestroyed()
当相应的 wl_surface 被销毁时会发出该信号。
[slot]
void QWaylandSurface::updateSelection()
用剪贴板上保留的合成器选区更新曲面。虽然该功能会在曲面收到键盘焦点时自动执行,但对于更新没有键盘焦点的客户端也很有用。
QList<QWaylandView *> QWaylandSurface::views() const
返回QWaylandSurface 的视图。
wl_client *QWaylandSurface::waylandClient() const
使用此QWaylandSurface 保持wl_client
。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.