void Tool::cleanLayout(QLayout *layout)
{
if(nullptr == layout)
{
return;
}
QLayoutItem *pItem = nullptr;
while ((pItem = layout->takeAt(0)))
{
QWidget *widget = pItem->widget();
if (widget)
{
widget->setParent(nullptr);
widget->deleteLater();
}
delete pItem;
pItem = nullptr;
}
}
删除布局中所有控件
于 2021-01-31 10:35:18 首次发布