问题描述
删掉原有的按钮列表,新建新的按钮列表。发现原按钮列表成员没能成功删除,仍可操作。
QGridLayout *layout = (QGridLayout*)ui.frame_die_layout->layout();
if (layout != NULL)
{
QList<QPushButton*> listBtn = ui.frame_die_layout->findChildren<QPushButton*>();
for (QPushButton* btn : listBtn)
{
ui.frame_die_layout->layout()->removeWidget(btn);
btn->setProperty("index", -1);
btn->deleteLater();
}
}
问题处理
不得已增加"index"元素判断原按钮列表成员。