本页内容

QNativeInterface::QEGLContext Struct

EGL 上下文的原生接口。更多...

头文件: #include <QOpenGLContext>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
自: Qt 6.0

公共函数

QEGLContext()
QEGLContext(const QNativeInterface::QEGLContext &)
QEGLContext(QNativeInterface::QEGLContext &&)
(since 6.3) virtual EGLConfig config() const = 0
(since 6.3) virtual EGLDisplay display() const = 0
(since 6.5) virtual void invalidateContext() = 0
virtual EGLContext nativeContext() const = 0
QNativeInterface::QEGLContext &operator=(QNativeInterface::QEGLContext &&)
QNativeInterface::QEGLContext &operator=(const QNativeInterface::QEGLContext &)

静态公共成员

QOpenGLContext *fromNative(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext = nullptr)

详细说明

可通过QOpenGLContext::nativeInterface()访问。

成员函数文档

[constexpr noexcept default] QEGLContext::QEGLContext()

默认——构造一个QEGLContext 的实例。

[delete] QEGLContext::QEGLContext(const QNativeInterface::QEGLContext &)

复制并构造一个QEGLContext 实例。该函数已被删除。

[delete] QEGLContext::QEGLContext(QNativeInterface::QEGLContext &&)

通过移动构造一个QEGLContext 实例。该函数已被删除。

[pure virtual, since 6.3] EGLConfig QEGLContext::config() const

返回与底层 EGLContext 关联的 EGLConfig。

该函数于 Qt 6.3 中引入。

[pure virtual, since 6.3] EGLDisplay QEGLContext::display() const

返回与底层 EGLContext 关联的 EGLDisplay。

该函数在 Qt 6.3 中引入。

[static] QOpenGLContext *QEGLContext::fromNative(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext = nullptr)

采用一个 EGLContextcontext 。

必须将传递给eglCreateContext 的同一EGLDisplay 作为display 参数传递。

shareContext 所创建的QOpenGLContext 的所有权将转移给调用方。

[pure virtual, since 6.5] void QEGLContext::invalidateContext()

将上下文标记为无效

如果该上下文被Qt Quick 场景图使用,这将触发场景图销毁该上下文并创建一个新的上下文。

与 QPlatformWindow::invalidateSurface() 类似,此函数仅在某些平台(如 eglfs)上才有效。

该函数在 Qt 6.5 中引入。

另请参阅 QOpenGLContext::isValid()。

[pure virtual] EGLContext QEGLContext::nativeContext() const

返回底层的 EGLContext。

[delete] QNativeInterface::QEGLContext &QEGLContext::operator=(QNativeInterface::QEGLContext &&)

将other 以移动赋值的方式赋值给此QEGLContext 实例。该函数已被删除。

[delete] QNativeInterface::QEGLContext &QEGLContext::operator=(const QNativeInterface::QEGLContext &)

将other 复制并赋值给该QEGLContext 实例。此函数已被删除。

© 2026 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.