Hi folks,
I have a family of classes (based on the same parent class) that are data cells in a QTableWidget (so they are all derived from QItemDelegate).
I'm trying to create a signal that these classes can pass up to the controller to communicate data changes.
I can't find the right combination (despite much experimentation and reading) which accomplished. Here's my class structure:
Base Class:
class Criteria(QItemDelegate):
def bind(self, update):
self.connect(self,SIGNAL("criteriaChange(int, int, QVariant)"),update)
def emitCommitData(self):
self.emit(SIGNAL("criteriaChange(int, int, QVariant)"), self.Row, self.Col, self.getValue())
Example Sub-class (just the relevant parts -- LMK if more info needed):
class YesNo(Criteria):
....
def createEditor(self, parent, option, index):
self.comboBox = QComboBox(parent)
for item in self.getChoices():
self.comboBox.addItem(item)
self.comboBox.activated.connect(self.emitCommitData)
return self.comboBox
....
Here's the relevant portion of my master class:
@pyqtSlot(int, int, QVariant, name='criteriaChanged')
def setItem(self, row, col, item):
print row, col, item.toString() # TODO: Remove when tested
self.Data[row][col] = item.toString()
def addCriteria(self, row, cname, ctype):
self.setDirty()
c = YesNo(cname, "YesNo")
c.bind(self.setItem)
The above code gives an "Underlying C++ object has been deleted". I've tried this:
def addCriteria(self, row, cname, ctype):
self.setDirty()
c = YesNo(cname, "YesNo")
self.connect(c,SIGNAL("criteriaChange(int, int, QVariant)"),self.setItem)
Any suggestions? I don't have to use this method, but rather need a way to get that data out of the individual controls.
TIA
Mike