PDA

View Full Version : QSqlTableModel and NULL



karas
9th February 2009, 13:55
Hi,
the following code


for (QList<QModelIndex>::iterator it = currentSelection.begin(); it != currentSelection.end(); ++it)
{
bool res = messengersModel->removeRow(it->row());
this->setRowHidden(it->row(), true);
}

deletes row from the MySql table if there's no NULL values in the given record. But, if some of the columns contain NULL value, that row is not deleted by QSqlTableModel::removeRow(). Why? Is it possible to force QSqlTableModel to delete row even if it contains NULL?
Thanks