QWaylandQuickItem Class
QWaylandQuickItem 类提供了一个Qt Quick 项目,代表QWaylandView... 更多...
Header: | #include <QWaylandQuickItem> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor) |
qmake: | QT += waylandcompositor |
在 QML 中: | WaylandQuickItem |
继承: | QQuickItem |
继承于: |
属性
|
|
公共函数
QWaylandQuickItem(QQuickItem *parent = nullptr) | |
virtual | ~QWaylandQuickItem() override |
bool | allowDiscardFrontBuffer() const |
QWaylandCompositor * | compositor() const |
bool | focusOnClick() const |
bool | inputEventsEnabled() const |
bool | inputRegionContains(const QPointF &localPosition) const |
bool | isBufferLocked() const |
bool | isPaintEnabled() const |
QPointF | mapFromSurface(const QPointF &point) const |
QPointF | mapToSurface(const QPointF &point) const |
QWaylandSurface::Origin | origin() const |
QWaylandOutput * | output() const |
void | setAllowDiscardFrontBuffer(bool discard) |
void | setBufferLocked(bool locked) |
void | setFocusOnClick(bool focus) |
void | setInputEventsEnabled(bool enabled) |
void | setOutput(QWaylandOutput *output) |
void | setPrimary() |
void | setSubsurfaceHandler(QObject *) |
void | setSurface(QWaylandSurface *surface) |
void | setTouchEventsEnabled(bool enabled) |
QObject * | subsurfaceHandler() const |
QWaylandSurface * | surface() const |
bool | touchEventsEnabled() const |
QWaylandView * | view() const |
重新实现的公共函数
virtual QSGTextureProvider * | textureProvider() const override |
公共插槽
void | setPaintEnabled(bool paintEnabled) |
virtual void | takeFocus(QWaylandSeat *device = nullptr) |
信号
void | allowDiscardFrontBufferChanged() |
void | bufferLockedChanged() |
void | compositorChanged() |
void | focusOnClickChanged() |
void | inputEventsEnabledChanged() |
void | originChanged() |
void | outputChanged() |
void | paintEnabledChanged() |
void | subsurfaceHandlerChanged() |
void | surfaceChanged() |
void | surfaceDestroyed() |
void | touchEventsEnabledChanged() |
详细说明
在Qt Quick 中编写QWaylandCompositor 时,该类可用于在输出设备上显示客户端内容,并将用户输入传递给客户端。
属性文档
allowDiscardFrontBuffer : bool
默认情况下,该项目会锁定当前缓冲区,直到有新的缓冲区且调用updatePaintNode() 时为止。将此属性设为 true 可让 Qt 在节流视图不再使用缓冲区时立即释放缓冲区。这对于更新间隔较慢的项目非常有用。
访问函数:
bool | allowDiscardFrontBuffer() const |
void | setAllowDiscardFrontBuffer(bool discard) |
Notifier 信号:
void | allowDiscardFrontBufferChanged() |
bufferLocked : bool
该属性显示项目的缓冲区当前是否被锁定。只要缓冲区处于锁定状态,就不会释放并返回给客户端。
默认值为 false。
访问功能:
bool | isBufferLocked() const |
void | setBufferLocked(bool locked) |
Notifier 信号:
void | bufferLockedChanged() |
[read-only]
compositor : QWaylandCompositor* const
此属性用于保存此QWaylandQuickItem 渲染的曲面的合成器。
访问功能:
QWaylandCompositor * | compositor() const |
通知信号:
void | compositorChanged() |
focusOnClick : bool
该属性指定QWaylandQuickItem 在被点击或触摸时是否应获得焦点。
默认值为true
。
访问功能:
bool | focusOnClick() const |
void | setFocusOnClick(bool focus) |
Notifier 信号:
void | focusOnClickChanged() |
[read-only]
origin : const QWaylandSurface::Origin
该属性保留了QWaylandQuickItem 的原点。
访问功能:
QWaylandSurface::Origin | origin() const |
通知信号:
void | originChanged() |
output : QWaylandOutput*
此属性用于保存显示此项目的输出。
访问功能:
QWaylandOutput * | output() const |
void | setOutput(QWaylandOutput *output) |
通知信号:
void | outputChanged() |
paintEnabled : bool
如果项目被隐藏,则保持true
,但纹理仍会更新。与通过将visible 设置为false
来隐藏项目相反,将此属性设置为false
不会阻止鼠标或键盘输入到达项目。
访问功能:
bool | isPaintEnabled() const |
void | setPaintEnabled(bool paintEnabled) |
通知信号:
void | paintEnabledChanged() |
surface : QWaylandSurface*
此属性保存此QWaylandQuickItem 渲染的曲面。
访问功能:
QWaylandSurface * | surface() const |
void | setSurface(QWaylandSurface *surface) |
通知信号:
void | surfaceChanged() |
touchEventsEnabled : bool
如果触摸事件被转发到客户端表面,则此属性为true
,否则为false
。
访问功能:
bool | touchEventsEnabled() const |
void | setTouchEventsEnabled(bool enabled) |
Notifier 信号:
void | touchEventsEnabledChanged() |
成员函数 文档
QWaylandQuickItem::QWaylandQuickItem(QQuickItem *parent = nullptr)
使用给定的parent 构建一个 QWaylandQuickItem。
[override virtual noexcept]
QWaylandQuickItem::~QWaylandQuickItem()
bool QWaylandQuickItem::inputRegionContains(const QPointF &localPosition) const
如果此条目表面的输入区域包含localPosition 给出的位置,则返回true
。
[invokable]
QPointF QWaylandQuickItem::mapFromSurface(const QPointF &point) const
将 Wayland 表面坐标系中给定的point 映射到此项目坐标系中的对应点,并返回映射后的坐标。
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
[invokable]
QPointF QWaylandQuickItem::mapToSurface(const QPointF &point) const
将此项目坐标系中给定的point 映射到 Wayland 曲面坐标系中的对应点,并返回映射后的坐标。
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
[invokable]
void QWaylandQuickItem::setPrimary()
使QWaylandQuickItem 的视图成为曲面的主视图。
注: 可通过元对象系统和 QML 调用此函数。请参阅Q_INVOKABLE 。
另请参阅 QWaylandSurface::primaryView 。
[signal]
void QWaylandQuickItem::surfaceDestroyed()
当客户端销毁了与QWaylandQuickItem 关联的wl_surface
时,就会发出该信号。该信号的处理程序应立即销毁QWaylandQuickItem 或启动关闭动画,然后销毁该项目。
如果启动了动画,则应设置bufferLocked ,以确保项目在动画结束前保持其内容。
另请参见 QWaylandQuickItem::bufferLocked 。
[virtual slot]
void QWaylandQuickItem::takeFocus(QWaylandSeat *device = nullptr)
调用该函数将使该项目成为device 输入的焦点。
[override virtual]
QSGTextureProvider *QWaylandQuickItem::textureProvider() const
重实现:QQuickItem::textureProvider() 常量。
返回QWaylandQuickItem 的纹理提供者。
QWaylandView *QWaylandQuickItem::view() const
返回该QWaylandQuickItem 渲染的视图。
© 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.