Added delete support to the CRUD system.

This commit is contained in:
eelke 2018-04-08 09:02:22 +02:00
parent 36f5153091
commit 8c20bd6a02
8 changed files with 230 additions and 89 deletions

View file

@ -22,6 +22,7 @@ CrudTab::CrudTab(MainWindow *parent)
ui->tableView->setModel(m_crudModel);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView->addAction(ui->actionRemove_rows);
//auto selection_model = ui->tableView->selectionModel();
// connect(ui->tableView->selectionModel(), &QItemSelectionModel::currentRowChanged, this,
// &CrudTab::tableView_currentRowChanged);
@ -55,3 +56,15 @@ void CrudTab::refresh()
{
m_crudModel->loadData();
}
void CrudTab::on_actionRemove_rows_triggered()
{
// determine selection
// ui->tableView->currentIndex()
// selectionModel()->
//ui->tableView->selectionModel()->selectedRows()
m_crudModel->removeRow(ui->tableView->currentIndex().row());
//removeRows();
}