-
Notifications
You must be signed in to change notification settings - Fork 0
/
maddspecialitiessetsdialog.cpp
73 lines (55 loc) · 2.22 KB
/
maddspecialitiessetsdialog.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include "maddspecialitiessetsdialog.h"
#include "ui_maddspecialitiessetsdialog.h"
mAddSpecialitiesSetsDialog::mAddSpecialitiesSetsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::mAddSpecialitiesSetsDialog)
{
ui->setupUi(this);
Qt::WindowFlags flags(this->windowFlags());
setWindowFlags(flags ^ Qt::WindowContextHelpButtonHint
| Qt::MSWindowsFixedSizeDialogHint
);
setWindowTitle("Контрольные цифры");
setAttribute(Qt::WA_DeleteOnClose);
pstm = new QSqlTableModel(this, QSqlDatabase::database(DBName));
pstm->setTable("specialities");
pstm->select();
ui->specComboBox->setModel(pstm);
ui->specComboBox->setModelColumn(1);
pftm = new QSqlTableModel(this, QSqlDatabase::database(DBName));
pftm->setTable("finance_form_v");
pftm->select();
ui->financeFormComboBox->setModel(pftm);
ui->financeFormComboBox->setModelColumn(0);
petm = new QSqlTableModel(this, QSqlDatabase::database(DBName));
petm->setTable("educ_form_v");
petm->select();
ui->educFormComboBox->setModel(petm);
ui->educFormComboBox->setModelColumn(0);
this->connect(ui->cancelPushButton,
SIGNAL(clicked(bool)), SLOT(reject()));
this->connect(ui->okPushButton,
SIGNAL(clicked(bool)), SLOT(formCortege()));
}
void mAddSpecialitiesSetsDialog::formCortege() {
QList <QVariant> tmp;
tmp << pstm->record(ui->specComboBox->currentIndex()).value("spec_id")
<< ui->educFormComboBox->currentText()
<< ui->countLineEdit->text()
<< ui->financeFormComboBox->currentText()
<< ui->yearLineEdit->text();
setVisible(false);
emit cortegeFormed(tmp);
close();
}
void mAddSpecialitiesSetsDialog::fillCortege(const QSqlRecord & rec) {
ui->specComboBox->setCurrentText(rec.value(1).toString());
ui->educFormComboBox->setCurrentText(rec.value("educ_form").toString());
ui->countLineEdit->setText(rec.value("position_numbers").toString());
ui->financeFormComboBox->setCurrentText(rec.value("finance_form").toString());
ui->yearLineEdit->setText(rec.value("year").toString());
}
mAddSpecialitiesSetsDialog::~mAddSpecialitiesSetsDialog()
{
delete ui;
}