Qt GUI

Qt GUI 模块提供了用于窗口系统集成、事件处理、OpenGL 和 OpenGL ES 集成、2D 图形、基本图像、字体和文本的类。这些类在 Qt 用户界面技术内部使用,但也可直接使用,例如使用低级 OpenGL ES 图形 API 编写应用程序。

对于编写用户界面的应用程序开发人员来说,Qt 提供了更高级别的 API,如Qt Quick ,这些 API 比Qt GUI 模块中的启用程序更适用。

使用模块

使用 Qt 模块的 C++ API 需要直接或通过其他依赖关系与模块库链接。有几种构建工具为此提供了专门支持,包括CMakeqmake

使用 CMake 构建

使用find_package() 命令在Qt6 软件包中找到所需的模块组件:

find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)

更多详情,请参阅使用 CMake 构建概述。

使用 qmake 构建

如果使用qmake来构建项目,默认情况下会包含Qt GUI 。要禁用Qt GUI ,请在.pro 文件中添加以下一行:

QT -= gui

文章与指南

参考资料

模块演变

Qt GUI 的变更列出了 Qt 6 系列 Qt 在模块 API 和功能方面的重要变更。

许可证和归属

Qt GUI 在商业许可下,您可以从Qt 公司获取《Qt 6》。此外,它还可在自由软件许可证下使用:GNU 宽通用公共许可证第 3 版GNU 通用公共许可证第 2 版。详情请参见Qt Licensing

此外,Qt 6.9.0 中的Qt GUI 可能包含以下许可下的第三方模块:

Adobe Glyph List For New Fonts, version 1.7

BSD 3 条款 "新 "或 "修订 "许可证

Anti-aliasing rasterizer from FreeType 2

仅 Freetype 项目许可证或 GNU 通用公共许可证 v2.0

Cocoa Platform Plugin

BSD 3 条款 "新 "或 "修订 "许可证

D3D12 Memory Allocator, version f128d39b7a95b4235bd228d231646278dc6c24b2

MIT 许可

DejaVu Fonts, version 2.37

Bitstream Vera 字体许可证

Emoji Segmenter, version 0.4.0

阿帕奇许可证 2.0

Freetype 2 - Bitmap Distribution Format (BDF) support

MIT 许可

Freetype 2 - Portable Compiled Format (PCF) support

MIT 许可和 MIT Open Group 变体

Freetype 2 - zlib

zlib 许可证

Freetype 2, version 2.13.3

仅 Freetype 项目许可证或 GNU 通用公共许可证 v2.0

HarfBuzz-NG, version 10.4.0

MIT 许可

LibJPEG-turbo, version 3.1.0

独立 JPEG 集团许可证和 BSD 3 条款 "新 "或 "修订 "许可证

LibPNG, version 1.6.47

libpng 许可证和 PNG 参考库第 2 版

MD4C, version 0.5.2

MIT 许可

Mipmap generator for D3D12, version 0aa79bad78992da0b6a8279ddb9002c1753cb849

MIT 许可

Native Style for Android

阿帕奇许可证 2.0

OpenGL ES 2 Headers, version Revision 27673

MIT 许可

OpenGL Headers, version Revision 27684

MIT 许可

Pixman, version 0.17.12

MIT 许可

Smooth Scaling Algorithm

BSD 2 条款 "简化 "许可证和 Imlib2 许可证

Vulkan API Registry, version 1.3.223

Apache 许可证 2.0 或 MIT 许可证

Vulkan Memory Allocator, version 3.1.0

MIT 许可

WebGradients

MIT 许可

Wintab API

LCS-电报许可证

X Server helper

X11 许可证和历史许可声明和免责声明

XCB-XInput

MIT 许可

sRGB color profile icc file

国际色彩联盟许可证

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