Qt Data Visualization
Qt Data Visualization 模块允许您以柱状图、散点图和曲面图的形式在3D空间中可视化数据。该模块特别适用于可视化深度图以及大量快速变化的数据,例如来自多个传感器的数据。您可以通过使用主题或添加自定义元素和标签来定制图表的外观和风格。
Qt Data Visualization 该模块基于 Qt 6 和 Qt OpenGL 构建,以充分利用硬件加速和Qt Quick 的优势。
注意: 自 Qt 6.10 起,Qt Data Visualization 模块 已被废弃。对于新项目,请改用 Qt Graphs 模块。Qt Graphs 利用各平台的原生渲染后端(macOS上的Metal、Windows上的DirectX、Linux上的OpenGL或Vulkan)来实现2D和3D图表的硬件加速渲染。 若要从Qt Data Visualization 迁移至Qt Graphs 模块,请参阅Qt Graphs 《从Qt DataVisualization迁移》或Qt Academy课程《迁移至Qt Graphs 》。
使用该模块
QML API
可通过导入QtDataVisualization 来使用该模块的QML类型。要使用这些类型,请在您的.qml文件中添加以下导入语句:
import QtDataVisualizationC++ API
要使用 Qt 模块的 C++ API,需要链接该模块库,既可以直接链接,也可以通过其他依赖项间接链接。包括CMake和qmake 在内的多种构建工具都对此提供了专门支持。
使用 CMake 构建
使用find_package() 命令在Qt6 软件包中定位所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS DataVisualization)
target_link_libraries(mytarget PRIVATE Qt6::DataVisualization)更多详细信息,请参阅“使用 CMake 构建”概述。
使用 qmake 构建
要配置模块以便使用 qmake 进行构建,请在项目的 .pro 文件中将该模块作为QT 变量的值添加:
QT += datavisualization文章与指南
示例
API 参考
许可与归属
Qt Data Visualization 本软件由The Qt Company 提供商业许可。此外,本软件还遵循GNU 通用公共许可证第 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.