[PyKDE] Deleting a layout in PyQt as opposed to Qt...
Sundance
sundance at ierne.eu.org
Wed Feb 28 11:17:03 GMT 2007
Hi peeps,
The Qt documentation informs us that the proper way to replace the
layout on a widget is to first delete the current layout and then
install a new one. Setting a new layout before the previous one is
deleted won't work. All fine and dandy.
The C++ syntax for removing a widget's layout is:
delete widget.layout();
However, the Python equivalent does not work:
del widget.layout()
In Python, del only unlinks the named reference from its current
namespace, triggering the actual deletion if the object's refcount
falls to 0.
Meaning that 1) you can't call del on the method call itself, and 2) if
you assign the method call's return value to a local variable to be
deleted, then del only unlinks that variable but the layout itself
still has a reference from the widget, and is thus not deleted.
Am I missing something? Is this an oversight in PyQt, or is there a
nice, clean Python equivalent that I've overlooked?
Thanks!
-- S.
More information about the PyQt
mailing list