parameters: (self)
docstring: Adds new field to the end of field table
docstring_summary: Adds new field to the end of field table
docstring_tokens: Adds new field to the end of field table
function: def addField(self):
          """Adds new field to the end of field table """
          m = self.fields.model()
          newRow = m.rowCount()
          m.insertRows(newRow, 1)
  
          indexName = m.index(newRow, 0, QModelIndex())
          indexType = m.index(newRow, 1, QModelIndex())
          indexNull = m.index(newRow, 2, QModelIndex())
  
          m.setData(indexName, "new_field")
          colType = self.fieldTypes[0]
          if newRow == 0:
              # adding the first row, use auto-incrementing column type if any
              if "serial" in self.fieldTypes:  # PostgreSQL
                  colType = "serial"
          m.setData(indexType, colType)
          m.setData(indexNull, None, Qt.DisplayRole)
          m.setData(indexNull, Qt.Unchecked, Qt.CheckStateRole)
  
          # selects the new row
          sel = self.fields.selectionModel()
          sel.select(indexName, QItemSelectionModel.Rows | QItemSelectionModel.ClearAndSelect)
  
          # starts editing
          self.fields.edit(indexName)
  
          self.updatePkeyCombo(0 if newRow == 0 else None)
function_tokens: def addField ( self ) : m = self . fields . model ( ) newRow = m . rowCount ( ) m . insertRows ( newRow , 1 ) indexName = m . index ( newRow , 0 , QModelIndex ( ) ) indexType = m . index ( newRow , 1 , QModelIndex ( ) ) indexNull = m . index ( newRow , 2 , QModelIndex ( ) ) m . setData ( indexName , "new_field" ) colType = self . fieldTypes [ 0 ] if newRow == 0 : # adding the first row, use auto-incrementing column type if any if "serial" in self . fieldTypes : # PostgreSQL colType = "serial" m . setData ( indexType , colType ) m . setData ( indexNull , None , Qt . DisplayRole ) m . setData ( indexNull , Qt . Unchecked , Qt . CheckStateRole ) # selects the new row sel = self . fields . selectionModel ( ) sel . select ( indexName , QItemSelectionModel . Rows | QItemSelectionModel . ClearAndSelect ) # starts editing self . fields . edit ( indexName ) self . updatePkeyCombo ( 0 if newRow == 0 else None )