80
|
1 |
#include "frameTeam.h"
|
|
2 |
#include "teamselhelper.h"
|
|
3 |
|
|
4 |
#include <QResizeEvent>
|
|
5 |
#include <QCoreApplication>
|
|
6 |
|
|
7 |
using namespace std;
|
|
8 |
|
|
9 |
FrameTeams::FrameTeams(QWidget* parent) :
|
|
10 |
QWidget(parent), mainLayout(this)
|
|
11 |
{
|
|
12 |
}
|
|
13 |
|
117
|
14 |
void FrameTeams::addTeam(HWTeam team)
|
80
|
15 |
{
|
|
16 |
TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team, this);
|
87
|
17 |
// int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
|
80
|
18 |
teamToWidget.insert(make_pair(team, pTeamShowWidget));
|
|
19 |
mainLayout.addWidget(pTeamShowWidget);
|
|
20 |
QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
|
|
21 |
QCoreApplication::postEvent(parentWidget(), pevent);
|
|
22 |
}
|
|
23 |
|
117
|
24 |
void FrameTeams::removeTeam(HWTeam team)
|
80
|
25 |
{
|
|
26 |
tmapTeamToWidget::iterator it=teamToWidget.find(team);
|
|
27 |
mainLayout.removeWidget(it->second);
|
|
28 |
delete it->second;
|
|
29 |
teamToWidget.erase(team);
|
|
30 |
}
|
|
31 |
|
117
|
32 |
QWidget* FrameTeams::getTeamWidget(HWTeam team)
|
80
|
33 |
{
|
|
34 |
tmapTeamToWidget::iterator it=teamToWidget.find(team);
|
|
35 |
QWidget* ret = it!=teamToWidget.end() ? it->second : 0;
|
|
36 |
if(!ret) throw; // FIXME: this is debug exception
|
|
37 |
return ret;
|
|
38 |
}
|