Added IdRole for the server generated UUID of the items.

This commit is contained in:
2026-01-29 09:27:50 +01:00
parent bc96a805f8
commit 08c2e3a093
5 changed files with 38 additions and 14 deletions

View File

@ -49,16 +49,16 @@ QHash<int, QByteArray> TableModel::roleNames() const { return ROLE_NAMES; }
int TableModel::rowCount(const QModelIndex& parent) const {
if (parent.isValid()) {
return 0; // no children
return 0; /// no children
}
return m_items.size();
}
int TableModel::columnCount(const QModelIndex& parent) const {
if (parent.isValid()) {
return 0; // no children
return 0; /// no children
}
return ROLE_NAMES.size();
return USER_FACING_ROLES.size();
}
QVariant TableModel::data(const QModelIndex& index, int role) const {
@ -249,7 +249,7 @@ void TableModel::execEditItemData(const int row, const QMap<int, QVariant>& chan
/// is getting notified about (potential) data changes; dataChanged should be called only for
/// the affected columns
const QModelIndex firstIndex = this->index(row, 0);
const QModelIndex lastIndex = this->index(row, ROLE_NAMES.size() - 1);
const QModelIndex lastIndex = this->index(row, USER_FACING_ROLES.size() - 1);
QList<int> roles = changedValues.keys();
roles.insert(0, Qt::DisplayRole);
emit dataChanged(firstIndex, lastIndex, roles.toVector());