author | unc0rr |
Sun, 20 Aug 2006 19:22:12 +0000 | |
changeset 123 | 6987769ced3d |
parent 120 | 87264c35b09a |
child 132 | 2d0f404cdf05 |
permissions | -rw-r--r-- |
80 | 1 |
#include "teamselhelper.h" |
2 |
||
3 |
#include <QPixmap> |
|
4 |
#include <QPushButton> |
|
123 | 5 |
#include "hwconsts.h" |
80 | 6 |
|
7 |
void TeamLabel::teamButtonClicked() |
|
8 |
{ |
|
9 |
emit teamActivated(text()); |
|
10 |
} |
|
11 |
||
117 | 12 |
TeamShowWidget::TeamShowWidget(HWTeam team, QWidget * parent) : |
80 | 13 |
QWidget(parent), mainLayout(this), m_team(team) |
14 |
{ |
|
86
664b536a1c27
Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents:
84
diff
changeset
|
15 |
this->setMaximumHeight(40); |
123 | 16 |
QPixmap* px=new QPixmap(QPixmap(datadir->absolutePath() + "/Forts/" + m_team.Fort + "L.png").scaled(40, 40)); |
80 | 17 |
|
120 | 18 |
QPushButton* butt=new QPushButton(*px, "", this); |
19 |
butt->setFlat(true); |
|
20 |
butt->setGeometry(0, 0, 30, 30); |
|
86
664b536a1c27
Predefined teams, 'simple game' doesn't need to create team
unc0rr
parents:
84
diff
changeset
|
21 |
butt->setMaximumWidth(30); |
80 | 22 |
mainLayout.addWidget(butt); |
120 | 23 |
butt->setIconSize(butt->size()); |
24 |
||
25 |
QPushButton* bText=new QPushButton(team.TeamName, this); |
|
26 |
QPalette newPalette = palette(); |
|
27 |
newPalette.setColor(QPalette::Button, palette().color(backgroundRole())); |
|
28 |
bText->setPalette(newPalette); |
|
29 |
bText->setFlat(true); |
|
30 |
mainLayout.addWidget(bText); |
|
80 | 31 |
|
32 |
QObject::connect(butt, SIGNAL(clicked()), this, SLOT(activateTeam())); |
|
120 | 33 |
QObject::connect(bText, SIGNAL(clicked()), this, SLOT(activateTeam())); |
80 | 34 |
} |
35 |
||
36 |
void TeamShowWidget::activateTeam() |
|
37 |
{ |
|
38 |
emit teamStatusChanged(m_team); |
|
39 |
} |