Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
When removing from layout the widget is not fully removed
appollosputnik Banned last edited by
when i am removing widget from QGridLayout, the widget is removed from the corresponding row and column but it is still there on the screen. How to remove it completely.
QWidget *cent = new QWidget(this);
QGridLayout *layout = new QGridLayout(cent);
for(int row=0; row<3; row++)
for(int col=0; col<3; col++)
QTextEdit *text = new QTextEdit(cent);
list[row][col] = text;
TheFox last edited by
bq. Removes the widget widget from the layout. After this call, it is the caller's responsibility to give the widget a reasonable geometry or to put the widget back into a layout.
Note: The ownership of widget remains the same as when it was added
If you want the widget to be deleted, you need to delete it yourself:
@ QTextEdit * widget = list;
Or if you only want to hide it: