Skip to content
Permalink
Browse files

[DBManager] retrieve and store columns not null value when editing ta…

…ble (fix #13089)
  • Loading branch information
brushtyler committed Aug 24, 2015
1 parent 9aecf9f commit a2ce73aec07473b53159a5a87dfdea79944afacc
Showing with 4 additions and 3 deletions.
  1. +4 −3 python/plugins/db_manager/db_plugins/data_model.py
@@ -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):
@@ -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

0 comments on commit a2ce73a

Please sign in to comment.
You can’t perform that action at this time.