This repository was archived by the owner on Nov 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpawnpromotiondialog.cpp
More file actions
66 lines (52 loc) · 2.06 KB
/
pawnpromotiondialog.cpp
File metadata and controls
66 lines (52 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "pawnpromotiondialog.h"
#include <QDebug>
#include <QSize>
PawnPromotionDialog::PawnPromotionDialog(QWidget* parent)
:QDialog(parent)
{
setFixedSize(460,100);
setWindowTitle("Выберите фигуру, на которую будет заменена пешка");
chosenPiece = pawn;
pawnBtn = new QPushButton(this);
rookBtn = new QPushButton(this);
knightBtn = new QPushButton(this);
bishopBtn = new QPushButton(this);
queenBtn = new QPushButton(this);
pawnBtn->setIconSize(QSize(80,80));
rookBtn->setIconSize(QSize(80,80));
bishopBtn->setIconSize(QSize(80,80));
knightBtn->setIconSize(QSize(80,80));
queenBtn->setIconSize(QSize(80,80));
pawnBtn->setGeometry(10,10,80,80);
rookBtn->setGeometry(100,10,80,80);
knightBtn->setGeometry(190,10,80,80);
bishopBtn->setGeometry(280,10,80,80);
queenBtn->setGeometry(370,10,80,80);
connect(pawnBtn, SIGNAL(clicked(bool)), this, SLOT(accept()));
connect(rookBtn, SIGNAL(clicked(bool)), this, SLOT(accept()));
connect(knightBtn, SIGNAL(clicked(bool)), this, SLOT(accept()));
connect(bishopBtn, SIGNAL(clicked(bool)), this, SLOT(accept()));
connect(queenBtn, SIGNAL(clicked(bool)), this, SLOT(accept()));
}
void PawnPromotionDialog::setColor(Color clr) {
if (clr == white)
pawnBtn->setIcon(QPixmap(":/Images/pawn_white.svg"));
else
pawnBtn->setIcon(QPixmap(":/Images/pawn_black.svg"));
if (clr == white)
rookBtn->setIcon(QPixmap(":/Images/rook_white.svg"));
else
rookBtn->setIcon(QPixmap(":/Images/rook_black.svg"));
if (clr == white)
knightBtn->setIcon(QPixmap(":/Images/knight_white.svg"));
else
knightBtn->setIcon(QPixmap(":/Images/knight_black.svg"));
if (clr == white)
bishopBtn->setIcon(QPixmap(":/Images/bishop_white.svg"));
else
bishopBtn->setIcon(QPixmap(":/Images/bishop_black.svg"));
if (clr == white)
queenBtn->setIcon(QPixmap(":/Images/queen_white.svg"));
else
queenBtn->setIcon(QPixmap(":/Images/queen_black.svg"));
}