Only allow editing of tables that have a primary key.
This commit is contained in:
parent
09d5c1e41a
commit
36f5153091
1 changed files with 5 additions and 1 deletions
|
|
@ -205,7 +205,11 @@ void CrudModel::connectionStateChanged(ASyncDBConnection::State state)
|
|||
|
||||
Qt::ItemFlags CrudModel::flags(const QModelIndex &) const
|
||||
{
|
||||
return Qt::ItemIsSelectable + Qt::ItemIsEditable + Qt::ItemIsEnabled;
|
||||
Qt::ItemFlags flags = Qt::ItemIsSelectable + Qt::ItemIsEnabled;
|
||||
if (m_primaryKey) {
|
||||
flags += Qt::ItemIsEditable;
|
||||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
bool CrudModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue