[PyQt] Strange problem with item in QTreeView
Nathan Weston
nathan at genarts.com
Thu Jan 5 17:51:18 GMT 2012
I'm using a QTreeView with a custom model. In my application I have a
menu item that adds a new element to the model, fills it with default
data (e.g. "New Item"), then edits it in the tree view so the user can
type in the value they want.
This all works fine except that 1-2 seconds after I call edit(),
something calls setData() on my model (with role=Qt.EditRole), and sets
the data back to "New Item". This happens independently of any action by
the user -- if they have started typing something, it will be overwritten.
My application isn't calling setData() directly anywhere, nor connection
it to any signals. If I throw an exception or print a traceback in
setData(), it doesn't show any caller, so I guess it's coming from the
C++ side somehow. Is it possible to trace the call any further than this?
Does anyone have an idea where this setData call might be coming from?
- Nathan
More information about the PyQt
mailing list