Qt-jambi-interest Archive, October 2007
Re: delete/replace layout manager
Message 1 in thread
Hi Sander
The way that you tried to do this, is the correct way. And you have helped us
find a bug that has been fixed now.
As a workaround until the next version:
Re-enable garbage collection for the layout, and make sure to keep a reference
to it. Your code should look something like this:
if (currentLayout != null)
currentLayout.dispose();
currentLayout = new QHBoxLayout(this);
currentLayout.reenableGarbageCollection();
Hope this fixes your problem, and thanks again for helping us improve Qt
Jambi :-)
Regards,
HÃvard F
On Saturday 29 September 2007 15:16, S. van de Merwe wrote:
> Hi all,
>
> I'm trying to replace a layout manager placed on a widget, but can't get it
> to work.
> According to the documentation of the C++ version of Qt, you need to do
> "delete widget->layout()". Naturally, this can't be done in Java this way.
> I tried to use widget.layout().dispose() and even
> widget.layout().nativePointer().dispose(). The latter seems to set the
> layout() to null, but still, it complains an existing layout manager is
> installed if I subsequently call setLayout().
>
> Any ideas?
>
> Thanks in advance,
> Sander