[PyQt] QTextBlockUserData unexpected behavior
Phil Thompson
phil at riverbankcomputing.com
Tue Jul 23 15:37:18 BST 2013
On Tue, 23 Jul 2013 07:28:06 -0400, Grant Roch <grant.roch at gmail.com>
wrote:
> I'm trying to use QTextBlockUserData to hold info about blocks, but am
> seeing some strange behavior. I know there was a related issue posted
in
> March (
> http://www.riverbankcomputing.com/pipermail/pyqt/2013-March/032457.html)
> but I'm not sure if what I'm seeing is related. Here are two cases:
> 1. Run the below script as is will hold onto the userData only for a
short
> period. After setFirstBlock is called and it goes back into main, the
> block no longer has userData with value.
> 2. Comment out "line set A" and uncomment "line set B". Now userData
holds
> onto the value even after the button is pressed. This is the same code
so
> something else is going on.
Fixed in tonight's PyQt4 snapshot. The workaround is the keep a reference
to self.document().
> Also, are we expected to be able to subclass QTextBlockUserData in order
to
> add custom methods (suggested in the documentation)? I am not seeing
this
> work either as they always come back as QTextClockUserData rather than
my
> subclass.
Works for me (at least with the above fix).
> My versions are:
> ('Qt version:', '4.8.2')
> ('SIP version:', '4.15-snapshot-972540270afa')
> ('PyQt version:', '4.10.3-snapshot-05a01eef7a2e')
Thanks,
Phil
More information about the PyQt
mailing list