How to remove widget's layout w/o deleting it's children widgets?
I have MainWindow with many frames created when the application starts. I want to switch between them like that:
if (this->layout() != Q_NULLPTR) delete this->layout();
QVBoxLayout *const frame_layout = new QVBoxLayout(ui->frame);
but basicSettings_frame is being deleted, causing error. Do I really should reload all the controls (and recreate the frame before that) every time the user switches between frames or I somehow can tell the frame to not be the child of the layout anymore?
No, you don't have to (and should not) recreate the layout contents. Just take the widget out of the layout before you delete. Use takeAt() for that.