summaryrefslogtreecommitdiffstats
path: root/examples/sql/masterdetail/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/sql/masterdetail/mainwindow.cpp')
-rw-r--r--examples/sql/masterdetail/mainwindow.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/examples/sql/masterdetail/mainwindow.cpp b/examples/sql/masterdetail/mainwindow.cpp
index 020a149b22f..f8b198eebc2 100644
--- a/examples/sql/masterdetail/mainwindow.cpp
+++ b/examples/sql/masterdetail/mainwindow.cpp
@@ -202,6 +202,8 @@ void MainWindow::removeAlbumFromFile(int id)
void MainWindow::removeAlbumFromDatabase(const QModelIndex &index)
{
model->removeRow(index.row());
+ // to avoid a blank row, see QSqlTableModel::removeRows()
+ model->select();
}
void MainWindow::decreaseAlbumCount(const QModelIndex &artistIndex)
@@ -217,6 +219,7 @@ void MainWindow::decreaseAlbumCount(const QModelIndex &artistIndex)
showImageLabel();
} else {
artists->setData(albumCountIndex, QVariant(albumCount - 1));
+ artists->submitAll();
}
}