Qt Graphs

The Qt Graphs module enables you to visualize data in 2D and 3D graphs.

In the 3D realm there is support for bar, scatter, and surface graphs. It's especially useful for visualizing depth maps and large quantities of rapidly changing data, such as data received from multiple sensors. The look and feel of graphs can be customized by using themes or by adding custom items and labels.

In the 2D realm, there is support for area, bar, donut, line, pie, scatter, and spline graphs, and they are easily combinable with any other QML content.

Qt Graphs 构建于 Qt 6 并基于 Qt Quick 3D 的 3D 图形,以利用硬件加速和 Qt Quick。

使用模块

QtGraphs QML API

模块的 QML 类型是可用的透过 QtGraphs 导入。要使用类型,添加以下 import 语句到 .qml 文件:

import QtGraphs
					

C++ API

使用 Qt 模块的 C++ API 要求直接 (或透过其它依赖) 链接到模块库。几个构建工具对此有专用支持,包括 CMake and qmake .

构建采用 CMake

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

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

更多细节,见 构建采用 CMake 概述。

采用 qmake 构建

要配置采用 qmake 构建模块,添加模块作为值为 QT 变量在工程的 .pro 文件:

QT += graphs
					

Building a widget application

文章和指南

限制特征

若应用程序的目标是具有有限规格的一些嵌入式硬件,在模块中构建仅 2D (或 3D) 支持是可能的。

更多信息,见 配置 Qt Graphs .

Qt Graphs for 2D

Qt Graphs for 3D

Qt Graphs Common

范例

API 参考

许可和归属

Qt 在商业许可下是可用的来自 Qt 公司 。此外,它是可用的根据 GNU GPL (一般公共许可) 第 3 版 。见 Qt 许可 进一步了解细节。