-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaddnotes.cpp
More file actions
37 lines (33 loc) · 740 Bytes
/
addnotes.cpp
File metadata and controls
37 lines (33 loc) · 740 Bytes
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
#include "addnotes.h"
#include "ui_addnotes.h"
#include <QFileDialog>
#include <QFile>
#include <QDir>
#include <QDebug>
AddNotes::AddNotes(QWidget *parent) :
QDialog(parent),
ui(new Ui::AddNotes)
{
ui->setupUi(this);
note = NULL;
}
void AddNotes::setNote(QString filepath){
note = new Note(filepath);
ui->textEdit->setText(note->getText());
}
AddNotes::~AddNotes()
{
delete ui;
}
void AddNotes::on_saveChangesBtn_clicked()
{
QString filepath = note->getFilePath();
QFile file(filepath);
if (file.open(QIODevice::WriteOnly | QIODevice::Text)){
QTextStream out(&file);
out << ui->textEdit->toPlainText();
}else{
qDebug() << "File didnt open";
}
file.close();
}