Using the typedef ModelItemValues for "QHash<int, QVariant>".

This commit is contained in:
2026-01-04 17:48:27 +01:00
parent 2702b9c835
commit 3e6273cb7d
15 changed files with 60 additions and 49 deletions

View File

@ -120,8 +120,8 @@ 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;
ModelItemValues TableModel::getItemValues(const QModelIndex& index) const {
ModelItemValues values;
QListIterator<UserRoles> i(USER_FACING_ROLES);
while (i.hasNext()) {
@ -169,14 +169,13 @@ void TableModel::appendItems(const QByteArray& jsonDoc) { insertItems(-1, jsonDo
void TableModel::insertItems(int startPosition,
const QByteArray& jsonDoc,
const QModelIndex& parentIndex) {
const QList<QHash<int, QVariant>> valueList =
JsonParser::toItemValuesList(jsonDoc, ITEM_KEY_STRING);
const QList<ModelItemValues> valueList = JsonParser::toItemValuesList(jsonDoc, ITEM_KEY_STRING);
insertItems(startPosition, valueList, parentIndex);
}
void TableModel::insertItems(int startPosition,
const QList<QHash<int, QVariant>>& itemValuesList,
const QList<ModelItemValues>& itemValuesList,
const QModelIndex& parentIndex) {
qInfo() << "Inserting item(s) into model...";
if (parentIndex != QModelIndex()) {
@ -192,7 +191,7 @@ void TableModel::insertItems(int startPosition,
m_undoStack->push(insertCommand);
}
void TableModel::execInsertItems(const int firstRow, const QList<QHash<int, QVariant>> valueList) {
void TableModel::execInsertItems(const int firstRow, const QList<ModelItemValues> valueList) {
const int nRows = valueList.size();
qDebug() << "Inserting" << nRows << "items...";