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