-
Notifications
You must be signed in to change notification settings - Fork 0
/
notewindow.cpp
57 lines (52 loc) · 1.31 KB
/
notewindow.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
#include "notewindow.h"
#include "ui_notewindow.h"
extern int yearG;
extern int date[3];
extern QMap <QString, QString> notes;
extern QMap <QString, int> impNote;
NoteWindow::NoteWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::NoteWindow)
{
ui->setupUi(this);
QString s1,s2,s3,txt,s4,s5,s6;
txt = "Заметка на ";
if (date[0] <10){
s1 = "0" + s1.setNum(date[0]);
} else {
s1.setNum(date[0]);
}
if (date[1] <10){
s2 = "0" + s2.setNum(date[1]);
} else {
s2.setNum(date[1]);
}
s3.setNum(date[2]);
ui->lblNoteDate->setText(txt+s1+"."+s2+"."+s3);
ui->lblNoteDate->setStyleSheet("font: bold 17px black;");
ui->lblNoteDate->setAlignment(Qt::AlignHCenter);
s1.setNum(date[0]);
s2.setNum(date[1]);
ui->txtNote->insertPlainText(notes[s1+":"+s2+":"+s3]);
ui->spinIm->setValue(impNote[s1+":"+s2+":"+s3]);
}
NoteWindow::~NoteWindow()
{
delete ui;
}
void NoteWindow::on_btnNoteCancel_clicked()
{
this->close();
}
void NoteWindow::on_btnSaveNote_clicked()
{
QString str = ui->txtNote->toPlainText();
int val = ui->spinIm->value();
QString s1,s2,s3;
s1.setNum(date[0]);
s2.setNum(date[1]);
s3.setNum(yearG);
notes[s1+":"+s2+":"+s3] = str;
impNote[s1+":"+s2+":"+s3] = val;
this->close();
}