Qt里怎么从layout里移除控件
1个回答
展开全部
void CentralWidget::setDrivePlateAddrAndElectronStorageCabinetCount(int drivePlateAddr, int electronStorageCabinetCount)
{
int prevCount = info->getElectronStorageCabinetCount();
for(int i = 0; i < prevCount; ++i)
{
delete labels[i];
labels[i] = NULL;
}
labels.clear();
for(int i = 0; i < electronStorageCabinetCount; ++i)
labels.append(new Label(this));
for(int i = 0; i < electronStorageCabinetCount; ++i)
{
int row = i / LINE_COUNT;
int column = i % LINE_COUNT;
gridLayout->addWidget(labels[i], row, column);
}
for(int i = 0; i < labels.count(); ++i)
{
connect(labels[i], SIGNAL(updateBoxDoorCheckState(int)), this, SLOT(updateBoxDoorCheckState(int)));
connect(labels[i], SIGNAL(updateGoodsCheckState(int)), this, SLOT(updateGoodsCheckState(int)));
}
info->initInfo(drivePlateAddr, electronStorageCabinetCount);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询