Added a second bound property (nExpectedBiddings) & cleaned up the code a little.
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user