QNativeInterface::QWGLContext Struct
Windows 平台上 WGL 上下文的原生接口。更多内容...
| 标题: | #include <QOpenGLContext> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
| qmake: | QT += gui |
| 自: | Qt 6.0 |
- 所有成员列表(包括继承的成员)
- QWGLContext 属于“本机接口”的一部分。
公共函数
| QWGLContext() | |
| QWGLContext(const QNativeInterface::QWGLContext &) | |
| QWGLContext(QNativeInterface::QWGLContext &&) | |
| virtual HGLRC | nativeContext() const = 0 |
| QNativeInterface::QWGLContext & | operator=(QNativeInterface::QWGLContext &&) |
| QNativeInterface::QWGLContext & | operator=(const QNativeInterface::QWGLContext &) |
静态公共成员
| QOpenGLContext * | fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext = nullptr) |
| HMODULE | openGLModuleHandle() |
详细说明
通过QOpenGLContext::nativeInterface() 访问。
成员函数文档
[constexpr noexcept default] QWGLContext::QWGLContext()
默认——构造一个QWGLContext 的实例。
[delete] QWGLContext::QWGLContext(const QNativeInterface::QWGLContext &)
复制并构造一个QWGLContext 实例。该函数已被删除。
[delete] QWGLContext::QWGLContext(QNativeInterface::QWGLContext &&)
通过移动构造一个QWGLContext 实例。该函数已被删除。
[static] QOpenGLContext *QWGLContext::fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext = nullptr)
采用一个 WGLcontext 句柄。
需要该window 参数,因为将查询其像素格式。当采用操作成功时,QOpenGLContext::format()将返回一个描述该像素格式的QSurfaceFormat 。
注意: 由window 指定的窗口,其 像素格式必须设置为与上下文兼容的格式。如果该窗口所属的任何设备上下文上均未调用 SetPixelFormat(),则采用该上下文将失败。
所创建的QOpenGLContext shareContext 的所有权将转移给调用者。
[pure virtual] HGLRC QWGLContext::nativeContext() const
返回底层上下文句柄。
[static] HMODULE QWGLContext::openGLModuleHandle()
返回当前正在使用的 OpenGL 实现的句柄。
注意:此 函数要求已创建QGuiApplication 实例。
[delete] QNativeInterface::QWGLContext &QWGLContext::operator=(QNativeInterface::QWGLContext &&)
将other 按移动赋值给该QWGLContext 实例。该函数已被删除。
[delete] QNativeInterface::QWGLContext &QWGLContext::operator=(const QNativeInterface::QWGLContext &)
将other 复制并赋值给此QWGLContext 实例。该函数已被删除。
© 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.