-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoteeditor.cpp
More file actions
40 lines (33 loc) · 829 Bytes
/
noteeditor.cpp
File metadata and controls
40 lines (33 loc) · 829 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
38
39
40
#include "noteeditor.h"
#include "ui_noteeditor.h"
NoteEditor::NoteEditor(QWidget *parent, const QString &filename)
: QDialog(parent), ui(new Ui::NoteEditor), fileName(filename)
{
ui->setupUi(this);
// Connect the button click to our slot
connect(ui->saveButton, &QPushButton::clicked, this, &NoteEditor::onSave);
}
NoteEditor::~NoteEditor()
{
delete ui;
}
void NoteEditor::onSave() // IMPLEMENT THE SLOT
{
accept(); // Close the dialog with Accepted status
}
QString NoteEditor::getContent() const
{
return ui->textEdit->toPlainText();
}
QString NoteEditor::getTags() const
{
return ui->tagsEdit->text();
}
void NoteEditor::setContent(const QString &content)
{
ui->textEdit->setPlainText(content);
}
void NoteEditor::setTags(const QString &tags)
{
ui->tagsEdit->setText(tags);
}