Is There Any Way To Remove A Qwidget In A Qgridlayout?
What I want is to completely remove a widget (purge it, delete it, etc...), but it's in a gridlayout, so even when calling removeWidget, it still keeps a pointer, so python doesn't
Solution 1:
Layouts re-parent the widgets to the containers. So even if you remove it from the layout, container widget is still the parent, so that widget is not removed. You should call .deleteLater()
to tell Qt to get rid of that widget (effectively clearing all references for the widget so that Python can purge it):
defremRow(self, row):
self.gridlayout.removeWidget(self.entries[row])
self.entries[row].deleteLater()
del self.entries[row]
Post a Comment for "Is There Any Way To Remove A Qwidget In A Qgridlayout?"