-
Notifications
You must be signed in to change notification settings - Fork 0
/
maddexamdialog.cpp
63 lines (47 loc) · 1.68 KB
/
maddexamdialog.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
#include "maddexamdialog.h"
#include "ui_maddexamdialog.h"
mAddExamDialog::mAddExamDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::mAddExamDialog)
{
ui->setupUi(this);
Qt::WindowFlags flags(this->windowFlags());
setWindowFlags(flags ^ Qt::WindowContextHelpButtonHint
| Qt::MSWindowsFixedSizeDialogHint
);
setWindowTitle("Экзамен");
setAttribute(Qt::WA_DeleteOnClose);
ttm = new QSqlTableModel (this, QSqlDatabase::database(QString(DBName)));
ttm->setTable("exam_types_v");
ttm->select();
ui->typeComboBox->setModel(ttm);
ui->typeComboBox->setModelColumn(0);
dtm = new QSqlTableModel (this, QSqlDatabase::database(QString(DBName)));
dtm->setTable("disciplines");
dtm->select();
ui->disciplineComboBox->setModel(dtm);
ui->disciplineComboBox->setModelColumn(1);
this->connect(ui->cancelPushButton,
SIGNAL(clicked(bool)), SLOT(reject()));
this->connect(ui->okPushButton,
SIGNAL(clicked(bool)), SLOT(formCortege()));
}
mAddExamDialog::~mAddExamDialog()
{
delete ui;
}
void mAddExamDialog::formCortege(){
QList<QVariant> vl;
vl << ui->markLineEdit->text()
<< dtm->record(ui->disciplineComboBox->currentIndex())
.value("discipline_id")
<< ui->typeComboBox->currentText();
setVisible(false);
emit cortegeFormed(vl);
close();
}
void mAddExamDialog::fillCortege(const QSqlRecord & rec) {
ui->markLineEdit->setText(rec.value("score").toString());
ui->typeComboBox->setCurrentText(rec.value("exam_type").toString());
ui->disciplineComboBox->setCurrentText(rec.value("name").toString());
}