QTfrontend/frameTeam.cpp
changeset 348 c91b983de18f
parent 341 184230eb4151
child 352 4665bfe25470
equal deleted inserted replaced
347:6521e1b2cd40 348:c91b983de18f
    46 
    46 
    47 void FrameTeams::addTeam(HWTeam team, bool willPlay)
    47 void FrameTeams::addTeam(HWTeam team, bool willPlay)
    48 {
    48 {
    49   TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this);
    49   TeamShowWidget* pTeamShowWidget = new TeamShowWidget(team, willPlay, this);
    50 //  int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
    50 //  int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
    51   teamToWidget.insert(make_pair(team, pTeamShowWidget));
    51   teamToWidget.insert(team, pTeamShowWidget);
    52   mainLayout.addWidget(pTeamShowWidget);
    52   mainLayout.addWidget(pTeamShowWidget);
    53   QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
    53   QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
    54   QCoreApplication::postEvent(parentWidget(), pevent);
    54   QCoreApplication::postEvent(parentWidget(), pevent);
    55 }
    55 }
    56 
    56 
    57 void FrameTeams::removeTeam(HWTeam team)
    57 void FrameTeams::removeTeam(HWTeam team)
    58 {
    58 {
    59   tmapTeamToWidget::iterator it=teamToWidget.find(team);
    59   tmapTeamToWidget::iterator it=teamToWidget.find(team);
    60   mainLayout.removeWidget(it->second);
    60   mainLayout.removeWidget(it.value());
    61   delete it->second;
    61   delete it.value();
    62   teamToWidget.erase(team);
    62   teamToWidget.erase(it);
    63 }
    63 }
    64 
    64 
    65 QWidget* FrameTeams::getTeamWidget(HWTeam team)
    65 QWidget* FrameTeams::getTeamWidget(HWTeam team)
    66 {
    66 {
    67   tmapTeamToWidget::iterator it=teamToWidget.find(team);
    67   tmapTeamToWidget::iterator it=teamToWidget.find(team);
    68   QWidget* ret = it!=teamToWidget.end() ? it->second : 0;
    68   QWidget* ret = it!=teamToWidget.end() ? it.value() : 0;
    69   return ret;
    69   return ret;
    70 }
    70 }
    71 
    71 
    72 bool FrameTeams::isFullTeams() const
    72 bool FrameTeams::isFullTeams() const
    73 {
    73 {