本页内容

Qt Graphs 控件

控件支持被包含在一个独立的模块中,以避免在仅构建 QML 应用程序时对 `QtWidgets ` 产生硬依赖。

使用该模块

要使用 Qt 模块的 C++ API,需要链接该模块库,可以是直接链接,也可以通过其他依赖项间接链接。包括CMake和qmake 在内的多种构建工具都对此提供了专门的支持。

使用 CMake 构建

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

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

更多详细信息,请参阅“使用 CMake 构建”概述。

使用 qmake 构建

要配置模块以便使用 qmake 进行构建,请在项目的 .pro 文件中将该模块作为QT 变量的值添加:

QT += graphswidgets

API 参考

许可与归属

Qt Graphs Qt Widgets 由The Qt Company 提供商业许可。此外,它还遵循GNU 通用公共许可证第 3 版(GNU General Public License, version 3)。更多详情请参阅Qt 许可说明。

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