Reordered function implementations according to declarations in header file.
This commit is contained in:
@ -135,6 +135,27 @@ void TableModel::insertItems(int startPosition,
|
|||||||
m_undoStack->push(insertCommand);
|
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 {
|
int TableModel::getRoleForColumn(const int column) const {
|
||||||
switch (column) {
|
switch (column) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -157,24 +178,3 @@ int TableModel::getRoleForColumn(const int column) const {
|
|||||||
break;
|
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();
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user