KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
This doesn't seem easy. Basically, I add QPushButton s through a function to a layout, and when the function executes, I want to clear the layout first (removing all QPushButton s and whatever else is in there), because more buttons just get appended to the scrollview . header QVBoxLayout* _layout; cpp void MainWindow::removeButtonsThenAddMore(const QString &item) { //remove buttons/widgets QVBoxLayout* _layout = new QVBoxLayout(this); QPushButton button = new QPushButton(item); _layout->addWidget(button); QPushButton button = new QPushButton("button"); _layout->addWidget(button); QWidget* widget = new QWidget(); widget->setLayout(_layout); QScrollArea* scroll = new QScrollArea(); scroll->setWidget(widget); scroll->show(); }
Tags (comma-separated)
Save Edits
Cancel