13 return static_cast<int>(snapshots.size());
21 if (!index.isValid() || role != Qt::DisplayRole)
return {};
22 const auto& s = snapshots[index.row()];
24 switch (index.column()) {
25 case 0:
return s.time;
26 case 1:
return s.position.x;
27 case 2:
return s.position.y;
28 case 3:
return s.position.z;
29 case 4:
return s.velocity.x;
30 case 5:
return s.velocity.y;
31 case 6:
return s.velocity.z;
32 case 7:
return s.temperature;
38 if (role != Qt::DisplayRole || orientation != Qt::Horizontal)
return {};
40 case 0:
return QStringLiteral(
"Time (s)");
41 case 1:
return QStringLiteral(
"Pos X");
42 case 2:
return QStringLiteral(
"Pos Y");
43 case 3:
return QStringLiteral(
"Pos Z");
44 case 4:
return QStringLiteral(
"Vel X");
45 case 5:
return QStringLiteral(
"Vel Y");
46 case 6:
return QStringLiteral(
"Vel Z");
47 case 7:
return QStringLiteral(
"Temp (K)");
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
int rowCount(const QModelIndex &parent) const override
SnapshotTableModel(QObject *parent=nullptr)
int columnCount(const QModelIndex &parent) const override
void setSnapshots(const std::vector< ObjectSnapshot > &snaps)
QVariant data(const QModelIndex &index, int role) const override