Not using the TableModel directly anymore. Removing and appending items via GeneralSortFilterModel.
This commit is contained in:
@ -194,7 +194,7 @@ void MainWindow::deleteCurrentItem() {
|
||||
if (currentIndex == QModelIndex()) {
|
||||
qDebug() << "No current item. Nothing to remove.";
|
||||
} 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 bottomRow = iter->bottom();
|
||||
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
|
||||
m_newItemDialog = make_unique<NewItemDialog>(this);
|
||||
m_newItemDialog->createContent();
|
||||
connect(m_newItemDialog.get(), &NewItemDialog::addItems, m_tableModel.get(),
|
||||
&TableModel::appendItems);
|
||||
connect(m_newItemDialog.get(), &NewItemDialog::addItems, m_sortModel.get(),
|
||||
&GeneralSortFilterModel::appendItems);
|
||||
/// edit item dialog
|
||||
m_editItemDialog = make_unique<EditItemDialog>(ui->tableView, this);
|
||||
m_editItemDialog->createContent();
|
||||
|
||||
Reference in New Issue
Block a user