On Wednesday 18 July 2007 15:40, Andreas Pakulat wrote: > On 18.07.07 14:58:11, Tom Brown wrote: > > Hi, > > > > 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() method: > > You don't need to emit dataChanged in setData, you only need to emit > that signal if you change data in custom methods. The documentation says you need to emit dataChanged() if you reimplement the setData() method.
"Note that the dataChanged() signal must be emitted explicitly when reimplementing this function." > Also note: setData shouldn't alter the number of rows or columns in the > model, it should only change the data of an existing "cell". If you want > to add a row/column you should use insertRows/Columns (and eventually > re-implement them). Well, I reimplemented a few required methods like index() and parent(). The error stopped showing up. However, the combobox never shows a value even though there are items in the list. Any ideas on that? Thanks, Tom _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
