[PyKDE] Problems with QWidgetFactory
Fredrik Juhlin
laz at strakt.com
Mon Jul 5 09:59:00 BST 2004
Hi,
We've been working on making sure that our application works with the latest
versions of Qt, SIP and PyQt (3.3.2, 4.0 and 3.12, respectively.) Doing that,
we've come across a problem with QWidgetFactory.
Something seems to happen to ownership of the widget returned by
QWidgetFactory.create(). If one doesn't keep a reference to the widget it
gets destroyed immediately, even if it is given a parent widget.
At first I thought that maybe it was intentional (even though it doesn't work
that way in older versions) but if we do keep a reference to the widget
throughout its life, the program seg faults when the reference is cleaned up.
In our application we use our own, subclassed widget factory to create special
widgets, but I wrote a simple example using the built-in widget factory to
demonstrate the behavior. The example is attached to this mail, along with a
trivial .ui-file defining a widget with a QLineEdit and a QPushButton in a
QVBoxLayout.
The example code displays the behavior when not keeping a reference, but by
commenting the chunk of code marked with 1. and de-commenting the chunk
marked 2. the widget gets displayed but the app segfaults when it's about to
exit.
Any help on this matter would be much appreciated!
//Fredrik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: application/x-python
Size: 542 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20040705/626c3e19/test.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: form1.ui
Type: application/x-designer
Size: 1021 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20040705/626c3e19/form1.bin
More information about the PyQt
mailing list