QLayout的removeWidget与QButtonGroup的removeButton
测试:QLayout的removeWidget会不会把widget给delete掉。
QVBoxLayout * v_layout=new QVBoxLayout;
this->centralWidget()->setLayout(v_layout);
QPushButton * btn=new QPushButton;
btn->setText("111");
v_layout->addWidget(btn);
v_layout->removeWidget(btn);
qDebug()<<btn->text();
delete btn;
结果:
"111"
不会!!!
测试:QButtonGroup的removeButton会不会把QPushButton对象delete掉。
QButtonGroup * group=new QButtonGroup(this);
QPushButton *btn=new QPushButton();
btn->setText("111");
group->addButton(btn);
group->removeButton(btn);
qDebug()<<btn->text();
结果:
"111"
不会!!!