[PyKDE] Strange problem with signal/slot
Thomas Muders
thomas.muders at gmail.com
Sat Jan 28 21:25:19 GMT 2006
Hi List,
i've used PyQt3 before and now I'm getting started with PyQt4. I'm
interested in the Interview (Model/View) framework and so I have been
"porting" a C++ tutorial using Interview to PyQt. I'm using the
20060126 version with Qt 4.1.0 under Linux as the 20060127 version
didn't work.
I've a strange problem with emit:
in a subclass of QAbstractItemModel I have the following code in the
method set Data:
def setData(self, idx, value, role):
[...]
if ok:
self.emit(SIGNAL("dataChanged(QModelIndex&,QModelIndex&)"),
(idx,idx))
curExpense.convertedAmount = curExpense.originalAmount * \
curExpense.conversionRate
cellIndex = self.index(idx.row(), ConvertedAmount, QModelIndex())
self.emit(SIGNAL("dataChanged(QModelIndex&,QModelIndex&)"),
(cellIndex,cellIndex))
return ok
OK is a bool, which is the required return type for the function. If I
don't have the emit's, everything is OK. When the emit's are there
like in the sample, I get the following error on the console:
TypeError: invalid result type from ExpenseModel.setData()
I verified with print that the type of ok is in fact bool, so there is
no problem (anyway without emit it works)
is this a bug in PyQt or a misunderstanding?
Thomas
More information about the PyQt
mailing list