Trying to replace widget
-
Hello
I've designed a main window in Designer (frame with button on top, frame with button on bottom, frame with placeholder between them).
Now I want to replace central frame with a different widget (a widget with a vertical-centered progress bar, than, after setup, with a QCustomPlot).
However, centralWidget->layout()->replaceWidget removes a widget without adding anything; attempt to add a widget into central widget (ui->areaHolder->layout()->addWidget(wb);) adds it somewhere under existing spacer.How do I replace a widget in Designer-generated UI?
-
Hello
I've designed a main window in Designer (frame with button on top, frame with button on bottom, frame with placeholder between them).
Now I want to replace central frame with a different widget (a widget with a vertical-centered progress bar, than, after setup, with a QCustomPlot).
However, centralWidget->layout()->replaceWidget removes a widget without adding anything; attempt to add a widget into central widget (ui->areaHolder->layout()->addWidget(wb);) adds it somewhere under existing spacer.How do I replace a widget in Designer-generated UI?
@Alex-Povolotsky Why do you need to replace the central widget? You can simply use the existing one. If you need to switch between different widgets you should use QTabWidget.
-
I did not quite get what I've done, but it works now.