[PyQt] QAbstractItemModel.setData() and emit

Andreas Pakulat apaku at gmx.de
Wed Jul 18 23:40:40 BST 2007

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.

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).


Best of all is never to have been born.  Second best is to die soon.

More information about the PyQt mailing list