Not using the TableModel directly anymore. Removing and appending items via GeneralSortFilterModel.

This commit is contained in:
2026-01-12 10:15:05 +01:00
parent bd056a00ce
commit 8a0d37f8f9

View File

@ -194,7 +194,7 @@ void MainWindow::deleteCurrentItem() {
if (currentIndex == QModelIndex()) { if (currentIndex == QModelIndex()) {
qDebug() << "No current item. Nothing to remove."; qDebug() << "No current item. Nothing to remove.";
} else { } else {
m_tableModel->removeRows(currentIndex.row(), 1); m_sortModel->removeRows(currentIndex.row(), 1);
} }
} }
@ -212,7 +212,7 @@ void MainWindow::deleteSelectedtItems() {
const int topRow = iter->top(); const int topRow = iter->top();
const int bottomRow = iter->bottom(); const int bottomRow = iter->bottom();
const int nRows = bottomRow - topRow + 1; const int nRows = bottomRow - topRow + 1;
m_tableModel->removeRows(topRow, nRows); m_sortModel->removeRows(topRow, nRows);
} }
} }
} }
@ -444,8 +444,8 @@ void MainWindow::createGuiDialogs() {
/// new item dialog /// new item dialog
m_newItemDialog = make_unique<NewItemDialog>(this); m_newItemDialog = make_unique<NewItemDialog>(this);
m_newItemDialog->createContent(); m_newItemDialog->createContent();
connect(m_newItemDialog.get(), &NewItemDialog::addItems, m_tableModel.get(), connect(m_newItemDialog.get(), &NewItemDialog::addItems, m_sortModel.get(),
&TableModel::appendItems); &GeneralSortFilterModel::appendItems);
/// edit item dialog /// edit item dialog
m_editItemDialog = make_unique<EditItemDialog>(ui->tableView, this); m_editItemDialog = make_unique<EditItemDialog>(ui->tableView, this);
m_editItemDialog->createContent(); m_editItemDialog->createContent();