QTfrontend/frameTeam.cpp
changeset 383 09a8795105a4
parent 382 e7220e48ead1
child 486 7ea71cd3acd5
--- a/QTfrontend/frameTeam.cpp	Sat Feb 03 21:40:50 2007 +0000
+++ b/QTfrontend/frameTeam.cpp	Sun Feb 04 14:35:28 2007 +0000
@@ -67,8 +67,8 @@
   TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this);
   if(nonInteractive) pTeamShowWidget->setNonInteractive();
 //  int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
+  mainLayout.addWidget(pTeamShowWidget);
   teamToWidget.insert(team, pTeamShowWidget);
-  mainLayout.addWidget(pTeamShowWidget);
   QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
   QCoreApplication::postEvent(parentWidget(), pevent);
 }
@@ -76,11 +76,21 @@
 void FrameTeams::removeTeam(HWTeam team)
 {
   tmapTeamToWidget::iterator it=teamToWidget.find(team);
+  if(it==teamToWidget.end()) return;
   mainLayout.removeWidget(it.value());
   delete it.value();
   teamToWidget.erase(it);
 }
 
+void FrameTeams::resetTeams()
+{
+  for(tmapTeamToWidget::iterator it=teamToWidget.begin(); it!=teamToWidget.end(); ) {
+    mainLayout.removeWidget(it.value());
+    delete it.value();
+    teamToWidget.erase(it++);
+  }
+}
+
 void FrameTeams::setHHNum(const HWTeam& team)
 {
   TeamShowWidget* pTeamShowWidget = dynamic_cast<TeamShowWidget*>(getTeamWidget(team));