Reordered function implementations according to declarations in header file.

This commit is contained in:
2025-12-12 13:22:27 +01:00
parent c75d35179b
commit 772ab6b2ff

View File

@ -135,6 +135,27 @@ void TableModel::insertItems(int startPosition,
m_undoStack->push(insertCommand);
}
void TableModel::execInsertItems(const int firstRow, const QList<QHash<int, QVariant>> valueList) {
const int nRows = valueList.size();
qDebug() << "Inserting" << nRows << "items...";
const int lastRow = firstRow + nRows - 1;
beginInsertRows(QModelIndex(), firstRow, lastRow);
for (int row = 0; row < nRows; ++row) {
const int rowPosition = firstRow + row;
shared_ptr<ModelItem> item = make_unique<ModelItem>(valueList.at(row));
m_items.insert(rowPosition, std::move(item));
}
endInsertRows();
}
void TableModel::execRemoveItems(const int firstRow, const int nRows) {
const int lastRow = firstRow + nRows - 1;
beginRemoveRows(QModelIndex(), firstRow, lastRow);
m_items.remove(firstRow, nRows);
endRemoveRows();
}
int TableModel::getRoleForColumn(const int column) const {
switch (column) {
case 0:
@ -157,24 +178,3 @@ int TableModel::getRoleForColumn(const int column) const {
break;
}
}
void TableModel::execInsertItems(const int firstRow, const QList<QHash<int, QVariant>> valueList) {
const int nRows = valueList.size();
qDebug() << "Inserting" << nRows << "items...";
const int lastRow = firstRow + nRows - 1;
beginInsertRows(QModelIndex(), firstRow, lastRow);
for (int row = 0; row < nRows; ++row) {
const int rowPosition = firstRow + row;
shared_ptr<ModelItem> item = make_unique<ModelItem>(valueList.at(row));
m_items.insert(rowPosition, std::move(item));
}
endInsertRows();
}
void TableModel::execRemoveItems(const int firstRow, const int nRows) {
const int lastRow = firstRow + nRows - 1;
beginRemoveRows(QModelIndex(), firstRow, lastRow);
m_items.remove(firstRow, nRows);
endRemoveRows();
}