Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

After removing widgets from layout with vertical spacer the spacer doesn't work anymore

$
0
0
After clearing the content of a vertical layout it seems that the spacer that was there is also removed. At least, after the widgets in the layout are removed, and new widgets are added, the spacer doesn’t seem to work. How can I remove the widgets and keep the verticalSpacer to work? This is how I remove the widgets from the layout.   QLayoutItem* child;   while ((child = ui->layout->takeAt(0)) != 0)   {     QWidget* widget = child->widget();     if (widget)     {       delete child->widget();       delete child;     }   } This is what I want: from startup, with vertical spacer, before clearing This is what I’ve got after clearing and adding two widgets, vertical spacer removed or not working? Files: lwmainwindow.cpp [pastebin.com] lwmainwindow.h [pastebin.com] lwmainwindow.ui [pastebin.com]

Viewing all articles
Browse latest Browse all 18427

Trending Articles