[PyQt] QAbstractItemModel.setData() and emit

Tom Brown brown at esteem.com
Wed Jul 18 22:58:11 BST 2007


I am using PyQt4 with Qt 4.2.3. I have subclassed QAbstractItemModel to create 
a custom model for a custom combobox. I have overridden the setData() method 
and keep getting this error:

TypeError: invalid result type from ECBModel.setData()

When I remove the call to emit(), the error goes away. Here is my setData() 

  def setData(self, index, value, role):
    if self.insertRecord(str(value.toString())):
      self.refresh() # re-query data
      self.emit(SIGNAL('dataChanged(const QModelIndex &, '
        'const QModelIndex &)'), index, index)
      return True
    return False

Any ideas on why I'm getting the above error?


More information about the PyQt mailing list