equal
deleted
inserted
replaced
21 |
21 |
22 #include <QPushButton> |
22 #include <QPushButton> |
23 #include <QGridLayout> |
23 #include <QGridLayout> |
24 #include <QHBoxLayout> |
24 #include <QHBoxLayout> |
25 #include <QLabel> |
25 #include <QLabel> |
|
26 #include <QBitmap> |
26 |
27 |
27 QImage getAmmoImage(int num) |
28 QImage getAmmoImage(int num) |
28 { |
29 { |
29 static QImage ammo(":Ammos.png"); |
30 static QImage ammo(":Ammos.png"); |
30 return ammo.copy(0, num*32, 32, 32); |
31 return ammo.copy(0, num*32, 32, 32); |
33 SelWeaponItem::SelWeaponItem(int num, QWidget* parent) : |
34 SelWeaponItem::SelWeaponItem(int num, QWidget* parent) : |
34 QWidget(parent) |
35 QWidget(parent) |
35 { |
36 { |
36 QHBoxLayout* hbLayout = new QHBoxLayout(this); |
37 QHBoxLayout* hbLayout = new QHBoxLayout(this); |
37 |
38 |
38 QLabel* lbl = new QLabel("1"); |
39 QLabel* lbl = new QLabel(); |
39 lbl->setPixmap(QPixmap::fromImage(getAmmoImage(num))); |
40 QPixmap px(QPixmap::fromImage(getAmmoImage(num))); |
|
41 px.setMask(px.createMaskFromColor(QColor(0,0,0))); |
|
42 lbl->setPixmap(px); |
40 |
43 |
41 hbLayout->addWidget(lbl); |
44 hbLayout->addWidget(lbl); |
42 WeaponItem* item=new WeaponItem(QImage(":/res/M2Round2.jpg"), this); |
45 WeaponItem* item=new WeaponItem(QImage(":/res/M2Round2.jpg"), this); |
43 hbLayout->addWidget(item); |
46 hbLayout->addWidget(item); |
44 } |
47 } |