I am not able to remove a particular widget from a cell in a qgridlayout. I tried several codes found in internet... but i failed!! the way how i did the work was, first i created a qwidget class containing button,qpixmap,qplaintextedit. i then created an object of this class and it was set dynamically on the QGridLayout. the layout was then set on the current widget using this pointer. I am able to addwidgets on the gridlayout, but not able to delete it.. i want to delete the whole widget i created only if the pixmap is null!!! Do anyone knows a suitable remedy for this problem??
Asked
Active
Viewed 851 times
1 Answers
1
To remove a widget without deleting it, call
void QLayout::removeWidget(QWidget*)
To remove and delete a widget, just delete it.

Johan Råde
- 20,480
- 21
- 73
- 110