-
Notifications
You must be signed in to change notification settings - Fork 0
/
provapopup.cpp
49 lines (46 loc) · 1.05 KB
/
provapopup.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
#include "provapopup.h"
#include "ui_provapopup.h"
#include <iostream>
ProvaPopup::ProvaPopup(QDialog* parent): QDialog(parent), ui(new Ui::ProvaPopup)
{
ui->setupUi(this);
connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(accept()));
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(reject()));
data.name = "";
}
ProvaPopup::~ProvaPopup(){
delete ui;
}
void ProvaPopup::exec()
{
QDialog::exec();
}
L4_Data* ProvaPopup::get_data()
{
return &data;
}
void ProvaPopup::set_data(L4_Data* data_in)
{
data = *data_in;
ui->lineEdit->setText(QString::fromStdString(data.name));
}
void ProvaPopup::accept()
{
QString text = ui->lineEdit->text();
data.name = text.toStdString();
//TODO controllo name non sia gia in uso
if (data.name != ""){
std::cout <<"name accepted"<<std::endl;
QDialog::accept();
}
else
{
std::cout <<"name refused"<<std::endl;
QDialog::reject();
}
}
void ProvaPopup::reject()
{
std::cout <<"refuse button"<<std::endl;
QDialog::reject();
}