Hello,

What's the proper way to set default values for a relational table model when adding a new row?

The documentation for setData() says that for relational columns, the value must be the index, not the display value. Yet when I do this, the table view displays the numeral rather than the string value associated with it via setRelation(). I've tried adding Qt.EditRole or Qt.DisplayRole to setData() to no avail. eg:

self.taskModel.setData(self.taskModel.index(row, COLOR_ID), QtCore.QVariant(name), QtCore.Qt.EditRole)

Suggestions?

Thanks in advance!
Scott


_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to