同一個信號和同一個槽多次 connect的後果:
connect n次,槽函數觸發 n次!
使用容器時注意檢查邊界
使用容器的 .last .first .removelast .removefirst 等方法時要確保容器不爲空,否則會發生越界。 原來以爲容器類裏面會做檢查,其實不然
刪除一個佈局管理器中的所有控件
QLayoutItem *child;
while(child=this->verticalLayout->layout()->takeAt(0)) {
delete child;
}
想使用信號和槽