-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaddspecdialog.cpp
69 lines (53 loc) · 2.01 KB
/
maddspecdialog.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
#include "maddspecdialog.h"
#include "ui_maddspecdialog.h"
mAddSpecDialog::mAddSpecDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::mAddSpecDialog)
{
ui->setupUi(this);
Qt::WindowFlags flags(this->windowFlags());
setWindowFlags(flags ^ Qt::WindowContextHelpButtonHint
| Qt::MSWindowsFixedSizeDialogHint
);
setWindowTitle("Специальность");
pstm = new QSqlTableModel(this, QSqlDatabase::database(QString(DBName)));
pstm->setTable("specialities");
pstm->select();
ui->specComboBox->setModel(pstm);
ui->specComboBox->setModelColumn(1);
petm = new QSqlTableModel(this, QSqlDatabase::database(QString(DBName)));
petm->setTable("educ_form_v");
petm->select();
ui->educFormComboBox->setModel(petm);
ui->educFormComboBox->setModelColumn(0);
pftm = new QSqlTableModel(this, QSqlDatabase::database(QString(DBName)));
pftm->setTable("finance_form_v");
pftm->select();
ui->financeFormComboBox->setModel(pftm);
ui->financeFormComboBox->setModelColumn(0);
this->connect(ui->cancelPushButton,
SIGNAL(clicked(bool)), SLOT(reject()));
QObject::connect(ui->okPushButton, SIGNAL(clicked(bool)),
this, SLOT(formCortege()));
}
void mAddSpecDialog::formCortege() {
QList <QVariant> tmp;
tmp << pstm->record(ui->specComboBox->currentIndex()).value("spec_id").toInt()
<< ui->educFormComboBox->currentText()
<< ui->financeFormComboBox->currentText()
<< ui->prioritySpinBox->value();
qDebug() << tmp;
setVisible(false);
emit cortegeFormed(tmp);
close();
}
void mAddSpecDialog::fillCortege(const QSqlRecord & rec) {
ui->specComboBox->setCurrentText(rec.value(2).toString());
ui->educFormComboBox->setCurrentText(rec.value(4).toString());
ui->financeFormComboBox->setCurrentText(rec.value(5).toString());
ui->prioritySpinBox->setValue(rec.value("priority").toInt());
}
mAddSpecDialog::~mAddSpecDialog()
{
delete ui;
}