QGridLayout删除旧窗口还有清干净

//先清除
QLayoutItem *child;
while ((child = ui.gridLayout->takeAt(0)) != nullptr)
{
if (child->widget())
{
child->widget()->setParent(nullptr);//setParent(nullptr),防止删除之后界面不消失
}
}

posted @ 2025-01-26 22:21  一字千金  阅读(45)  评论(0)    收藏  举报