I changed my code and I remove the sql query exec I tried to modify the data with the setData but unfortunately nothing happened
{
if(index.column() == STATUS_INDEX) {
bool ret
= QSqlTableModel::setData(index, value
== Qt
::Checked ? Qt
::Unchecked : Qt
::Checked, role
);
database().commit();
this->submitAll();
return ret;
}
}
bool AttributesModel::setData(const QModelIndex &index, const QVariant &value, int role)
{
if(index.column() == STATUS_INDEX) {
bool ret = QSqlTableModel::setData(index, value == Qt::Checked ? Qt::Unchecked : Qt::Checked, role);
database().commit();
this->submitAll();
return ret;
}
return QSqlTableModel::setData(index, value, role);
}
To copy to clipboard, switch view to plain text mode
Bookmarks