-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaddabiturdocsdialog.cpp
65 lines (51 loc) · 2.04 KB
/
maddabiturdocsdialog.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
#include "maddabiturdocsdialog.h"
#include "ui_maddabiturdocsdialog.h"
mAddAbiturDocsDialog::mAddAbiturDocsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::mAddAbiturDocsDialog)
{
ui->setupUi(this);
Qt::WindowFlags flags(this->windowFlags());
setWindowFlags(flags ^ Qt::WindowContextHelpButtonHint
| Qt::MSWindowsFixedSizeDialogHint
);
setWindowTitle("Документ");
setAttribute(Qt::WA_DeleteOnClose);
ntm = new QSqlTableModel (this, QSqlDatabase::database(QString(DBName)));
ntm->setTable("document_types");
ntm->select();
ui->docNameComboBox->setModel(ntm);
ui->docNameComboBox->setModelColumn(1);
this->connect(ui->cancelPushButton,
SIGNAL(clicked(bool)), SLOT(reject()));
this->connect(ui->okPushButton,
SIGNAL(clicked(bool)), SLOT(formCortege()));
}
mAddAbiturDocsDialog::~mAddAbiturDocsDialog()
{
delete ui;
}
void mAddAbiturDocsDialog::formCortege() {
QList<QVariant> vl;
vl << ntm->record(ui->docNameComboBox->currentIndex()).value("document_type_id")
<< ui->docNumLineEdit->text()
<< ui->docSeriesLineEdit->text()
<< ui->receiveDateEdit->date()
<< ui->receivedFromTextEdit->toPlainText()
<< ui->docCountLineEdit->text()
<< ui->copyCheckBox->isChecked()
<< ui->issuedCheckBox->isChecked();
setVisible(false);
emit cortegeFormed(vl);
close();
}
void mAddAbiturDocsDialog::fillCortege(const QSqlRecord & rec) {
ui->docNameComboBox->setCurrentText(rec.value("name").toString());
ui->docNumLineEdit->setText(rec.value("number").toString());
ui->docSeriesLineEdit->setText(rec.value("series").toString());
ui->receiveDateEdit->setDate(rec.value("date").toDate());
ui->receivedFromTextEdit->setText(rec.value("issued_by").toString());
ui->docCountLineEdit->setText(rec.value("count").toString());
ui->copyCheckBox->setChecked(rec.value("is_copy").toBool());
ui->issuedCheckBox->setChecked(rec.value("is_issued").toBool());
}