基础能力
数据模型
为列表、表格和图表提供数据,数据仍由应用持有。
条目模型
ListView、TreeView 和 DataGrid 使用 QAbstractItemModel 和 QItemSelectionModel。模型由应用持有,通过模型接口修改数据后,所有显示它的视图都会更新。
图表模型
所有图表都从借用的 ChartModel 读取数据。可以直接调用 setPoints(),也可以在工作线程构建 ChartData 快照,再用 setDataSnapshot() 发布。多个图表可以共用一个模型。
#include <FluentQt/Charts.h>
auto* model = new fluent::charts::ChartModel(this);
model->setName("CPU");
model->setPoints({QPointF(0, 32), QPointF(1, 48), QPointF(2, 41)});
lineChart->setModel(model);import fluentqt
from PySide6.QtCore import QPointF
model = fluentqt.ChartModel(window)
model.setPoints([QPointF(0, 32), QPointF(1, 48), QPointF(2, 41)])
line_chart.setModel(model)