Skip to content

Commit

Permalink
[DBManager] retrieve and store columns not null value when editing ta…
Browse files Browse the repository at this point in the history
…ble (fix #13089)
  • Loading branch information
brushtyler committed Aug 24, 2015
1 parent 9aecf9f commit a2ce73a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/plugins/db_manager/db_plugins/data_model.py
Expand Up @@ -211,9 +211,8 @@ def headerData(self, section, orientation, role):

def flags(self, index):
flags = SimpleTableModel.flags(self, index)
if index.column() == 2: # set Null column as checkable
flags &= ~Qt.ItemIsEditable
flags |= Qt.ItemIsUserCheckable
if index.column() == 2 and flags & Qt.ItemIsEditable: # set Null column as checkable instead of editable
flags = flags & ~Qt.ItemIsEditable | Qt.ItemIsUserCheckable
return flags

def append(self, fld):
Expand All @@ -222,6 +221,8 @@ def append(self, fld):
row = self.rowCount() - 1
self.setData(self.index(row, 0), fld, Qt.UserRole)
self.setData(self.index(row, 1), fld.primaryKey, Qt.UserRole)
self.setData(self.index(row, 2), None, Qt.DisplayRole)
self.setData(self.index(row, 2), Qt.Unchecked if fld.notNull else Qt.Checked, Qt.CheckStateRole)

def _getNewObject(self):
from .plugin import TableField
Expand Down

0 comments on commit a2ce73a

Please sign in to comment.