Repository navigation
Expand file tree
/
Copy pathdialog.cpp
More file actions
88 lines (64 loc) · 1.88 KB
/
Copy pathdialog.cpp
File metadata and controls
88 lines (64 loc) · 1.88 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::Dialog)
{
ui->setupUi(this);
init();
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_buttonBox_accepted()
{
accept();
}
void Dialog::hrClicked()
{
QMessageBox::information(this,"HR", "You sent the info to HR");
}
void Dialog::legalClicked()
{
QMessageBox::information(this,"Legal", "You sent the info to Legal");
}
void Dialog::nextClicked()
{
int tab = ui->tabWidget->currentIndex();
int max = ui->tabWidget->count() - 1;
tab++;
if(tab > max) tab = max;
ui->tabWidget->setCurrentIndex(tab);
}
void Dialog::backClicked()
{
int tab = ui->tabWidget->currentIndex();
int min = 0;
tab--;
if(tab < min) tab = min;
ui->tabWidget->setCurrentIndex(tab);
}
void Dialog::init()
{
QPushButton *btnBack = new QPushButton("Back", this);
QPushButton *btnNext = new QPushButton("Next", this);
connect(btnBack,&QPushButton::clicked,this,&Dialog::backClicked);
connect(btnNext,&QPushButton::clicked,this,&Dialog::nextClicked);
ui->buttonBox->addButton(btnBack,QDialogButtonBox::ButtonRole::ActionRole);
ui->buttonBox->addButton(btnNext,QDialogButtonBox::ButtonRole::ActionRole);
//Update the tabs
ui->tabWidget->setTabText(0,"Profile");
ui->tabWidget->setTabText(1,"Notes");
//Add tab
QWidget *widget = new QWidget(this);
ui->tabWidget->addTab(widget,"Send");
QPushButton *btnHr = new QPushButton("Send to Human Resources", this);
QPushButton *btnLegal = new QPushButton("Send to Legal", this);
connect(btnHr,&QPushButton::clicked,this,&Dialog::hrClicked);
connect(btnLegal,&QPushButton::clicked,this,&Dialog::legalClicked);
QVBoxLayout *layout = new QVBoxLayout(widget);
layout->addWidget(btnHr);
layout->addWidget(btnLegal);
widget->setLayout(layout);
}