def createEditor(self, parent, option, index):
     
     columnIndex = index.column() 
     
     editor = None
     
     if descriptor.property(columnIndex)== u'Visible':
         editor = QComboBox(parent)
         editor.addItems([u'Yes', u'No'])
         editor.setEditable(False)
     elif descriptor.property(columnIndex)== u'Type':
         editor = QComboBox(parent)
         editor.addItems(descriptor.typesByValue.keys())
         editor.setEditable(False)
     else:
         editor = QLineEdit(parent)
         self.connect(editor, SIGNAL("returnPressed()"), 
                      self.commitAndCloseEditor)
     
     return editor
    def setModelData(self, editor, model, index):

        columnIndex = index.column() 
        propertyValue = descriptor.property(columnIndex)
        if propertyValue == u'Visible'\
        or propertyValue== u'Type':
            model.setData(index, QVariant(editor.currentText()))
        else:
            text = unicode(editor.text())
            if not text:
                text = NEW_COLUMN
            model.setData(index, QVariant(text))
 def setEditorData(self, editor, index):
     
     text = index.model().data(index, Qt.DisplayRole).toString()
     
     columnIndex = index.column()
     propertyValue = descriptor.property(columnIndex)  
     if propertyValue == u'Visible'\
     or propertyValue== u'Type':
         i = editor.findText(text)
         if i == -1:
             i = 0
         editor.setCurrentIndex(i)
     else:
         editor.setText(text)