feat: create stream and add members to stream
This commit is contained in:
@@ -12,6 +12,26 @@ NetworkStreamModel::NetworkStreamModel(Store *store, QObject *parent) : QAbstrac
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
});
|
||||
|
||||
// Granular update: repaint a single stream row when its properties change (e.g. unseen count)
|
||||
connect(m_store, &Store::streamUpdated, this, [this](const QString &streamId) {
|
||||
const auto &networks = m_store->networks();
|
||||
for (int ni = 0; ni < networks.size(); ++ni)
|
||||
{
|
||||
const auto &streams = networks.at(ni).streams;
|
||||
for (int si = 0; si < static_cast<int>(streams.size()); ++si)
|
||||
{
|
||||
if (streams[si].id == streamId)
|
||||
{
|
||||
// Build indices for both columns of this stream row
|
||||
QModelIndex topLeft = index(si, 0, index(ni, 0));
|
||||
QModelIndex bottomRight = index(si, 1, index(ni, 0));
|
||||
emit dataChanged(topLeft, bottomRight, {Qt::DisplayRole, Qt::ForegroundRole});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QModelIndex NetworkStreamModel::index(int row, int column, const QModelIndex &parent) const
|
||||
|
||||
Reference in New Issue
Block a user