-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchoose_button.cpp
54 lines (46 loc) · 1.23 KB
/
choose_button.cpp
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
#include "choose_button.h"
#include "ui_choose_button.h"
choose_button::choose_button(QWidget *parent) :
QDialog(parent),
ui(new Ui::choose_button)
{
ui->setupUi(this);
}
choose_button::~choose_button()
{
delete ui;
}
void choose_button::set_button(QPB_modify *pb, int i, int j)
{
ui->buttons_grid->addWidget(pb, i, j);
pb->setVisible(true);
}
void choose_button::open_button(QImage img, int i, int j, QString code)
{
QPB_modify *pb = new QPB_modify;
QSize button_size(50,50);
pb->setMaximumSize(button_size);
pb->setMinimumSize(button_size);
pb->setIcon(QIcon(QPixmap::fromImage(img)));
pb->setIconSize(pb->size());
pb->reverse_img = img;
pb->i = i;
pb->j = j;
pb->was_opening = true;
pb->rune_code = code;
connect(pb, &QPushButton::clicked, [this, pb](){
if (pb->reverse_img.isNull())
QMessageBox::information(this,"Oops", "Я же говорил, что ничего не будет");
else
{
emit i_choose_img(pb->reverse_img, pb->i, pb->j, pb->rune_code);
this->close();
}
});
set_button(pb, i, j);
}
void choose_button::on_button_cancel_clicked()
{
emit this->reject();
this->close();
}