Iterating over USER_FACING_ROLES to get all the item values when parsing and keeping them in edit and remove commands. Instead of using each role explicitly.
This commit is contained in:
@ -120,6 +120,17 @@ bool TableModel::setItemData(const QModelIndex& index, const QMap<int, QVariant>
|
||||
return false;
|
||||
}
|
||||
|
||||
QHash<int, QVariant> TableModel::getItemValues(const QModelIndex& index) const {
|
||||
QHash<int, QVariant> values;
|
||||
|
||||
QListIterator<UserRoles> i(USER_FACING_ROLES);
|
||||
while (i.hasNext()) {
|
||||
const UserRoles role = i.next();
|
||||
values.insert(role, data(index, role));
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
QJsonDocument TableModel::getAllItemsAsJsonDoc() const {
|
||||
QJsonDocument doc = QJsonDocument();
|
||||
QJsonObject rootObject;
|
||||
|
||||
Reference in New Issue
Block a user