基礎ガイド
データモデル
モデルの所有権を手放すことなく、リスト・テーブル・ツリー・チャートにデータモデルをバインドします。
リスト・ツリー・テーブルモデル
ListView、TreeView、DataGrid は標準的な Qt の QAbstractItemModel と QItemSelectionModel を使用します。アプリケーション側でモデルの作成と破棄を行い、標準の Qt 変更シグナルを送出してビューを更新します。
チャートモデル
チャートは所有権を奪わずに ChartModel をアタッチするため、複数のチャートで 1 つのモデルを共有できます。モデルのスレッド上で ChartModel::setPoints() を呼び出してください。バックグラウンドスレッドで計算する場合は ChartData スナップショットを構築し、モデルのスレッド上で ChartModel::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)