Added a second bound property (nExpectedBiddings) & cleaned up the code a little.

This commit is contained in:
2026-02-16 09:24:58 +01:00
parent dac9ac46f2
commit f200fff99e
5 changed files with 70 additions and 12 deletions

View File

@ -290,8 +290,19 @@ void TableModel::onRowCountChanged(const QModelIndex& parent, int first, int las
return;
}
emit rowCountChanged();
emit nExpectedBiddingsChanged();
}
int TableModel::nExpectedBiddings() const {
int result = 0;
for (auto i = m_items.begin(), end = m_items.end(); i != end; ++i) {
const QString biddingType = (*i)->data(BiddingTypeRole).toString();
if (!biddingType.isEmpty()) {
result++;
}
}
return result;
}
void TableModel::execInsertItems(const int firstRow, const QList<ModelItemValues> valueList) {
const int nRows = valueList.size();
qDebug() << "Inserting" << nRows << "items...";
@ -326,6 +337,9 @@ void TableModel::execEditItemData(const int row, const QMap<int, QVariant>& chan
QList<int> roles = changedValues.keys();
roles.insert(0, Qt::DisplayRole);
emit dataChanged(firstIndex, lastIndex, roles.toVector());
// NEXT check which roles are changed & trigger only changed properties
emit nExpectedBiddingsChanged();
}
}