Alex Rivera | Logout

How to delete an already existing layout on a widget?

Asked 2011-09-23T12:06:32.733
17

You must first delete the existing layout manager (returned by layout()) before you can call setLayout() with the new layout.

from http://doc.qt.io/qt-5.9/qwidget.html#setLayout

Which function is used for deleting the previous layout?

Edit
Report

1 Answer

16

You just use

delete layout;

like you would with any other pointer you created using new.

answered 2011-09-23T12:10:22.373

Your Answer