Hello Phil!
On Tue, Mar 10, 2009 at 7:34 PM, Phil Thompson
<[email protected]> wrote:
>
> This will be fixed in tonight's SIP snapshot.
>
Thanks it works fine again, I just tested the current snapshot :)
But some other behaviour changed and I wonder if this is intentional.
The attached example with QTextBlockUserData works with stable PyQt
but not with the development snapshot. Keeping an extra reference to
the custom user data object fixes this but that was not needed until
now.
I remember that I once kept references to user data objects and got
segfaults when the related text block was destroyed. Maybe that works
now, I will try to test it tomorrow.
Greets
Henning
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
class MyUserData(QTextBlockUserData):
def __init__(self, value):
QTextBlockUserData.__init__(self)
self.value = value
app = QApplication(sys.argv)
edit = QPlainTextEdit(None)
edit.setPlainText(open("test_userdata.py").read())
cursor = edit.textCursor()
block = cursor.block()
print block.userData() # None
block.setUserData(MyUserData(123))
userdata = block.userData()
print userdata # is QTextBlockUserData and not MyUserData
print userdata.value # fails with AttributeError_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt