From 772ab6b2ffb509796e1d25b2eb301584f8794b77 Mon Sep 17 00:00:00 2001 From: Bent Witthold Date: Fri, 12 Dec 2025 13:22:27 +0100 Subject: [PATCH] Reordered function implementations according to declarations in header file. --- model/tablemodel.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/model/tablemodel.cpp b/model/tablemodel.cpp index 68fb51e..c0912a8 100644 --- a/model/tablemodel.cpp +++ b/model/tablemodel.cpp @@ -135,6 +135,27 @@ void TableModel::insertItems(int startPosition, m_undoStack->push(insertCommand); } +void TableModel::execInsertItems(const int firstRow, const QList> 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 item = make_unique(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> 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 item = make_unique(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(); -}