Problem removing widget from a layout
-
Hi,
this seems like something that should just work, but it doesn't.
I have a layout and I want to remove a widget for which I have a pointer to and it is just not doing it.
I am using removeWidget(*widget) , like this:
@extLayout->removeWidget(treeWidget);
@Do I need to do something extra?
thanks
-malena
-
Hi mmesarina,
Is you interest in deleting the widget? From the docs of "QLayout":http://doc.qt.nokia.com/4.7-snapshot/qlayout.html#removeWidget seems that the widget still exists, and it is your responsibility to put in in another layout. Try adding it to a different layout, or if you don't need it anymore, just delete the pointer to this QWidget.
Hope this helps,
wladek -
As others have said, the code you posted is sufficient to remove the widget from the layout. However it is not sufficient to hide it or delete it or reparent it or add it to another layout. And so the widget will still be visible. What are you trying to achieve?