1

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??

jencir
  • 36
  • 2
  • Removing items from a layout which are contained within nested child layouts can be difficult. See my answer [here](http://stackoverflow.com/a/19256990/1070129) for a general solution. – emkey08 Oct 08 '13 at 20:13

1 Answers1

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