[PyQt] QAbstractSpinBox.fixup() error

David Wolfe dwolfe at fifthsally.com
Tue Feb 16 20:26:37 GMT 2010


>> I thought I could do 'final' validation by overriding fixup(), but I
>> keep seeing the following error in the console:
>>
>>     TypeError: invalid result type from IdSpinBox.fixup()

> The input is a mutable QString. Your normalize_id() function needs to
> modify the QString it is passed.

Thanks, Phil, that eliminates one possible cause of the problem I'm
having.  My fixup() function is now getting called, and modifying its
(mutable) 'input' argument; however, something else seems to be
modifying the value after that.

I think the problem has to do with the fact that the spinbox is created
by a QItemDelegate instance set on a table view.  Everything works fine
when I exit the field by pressing Enter, but I can't get valid values to
'take' if I exit the field by pressing TAB; they always get set back to
their original value.  Anybody know how to work around this behavior?


More information about the PyQt mailing list