-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdialoghtmledit.cpp
More file actions
45 lines (41 loc) · 1.05 KB
/
Copy pathdialoghtmledit.cpp
File metadata and controls
45 lines (41 loc) · 1.05 KB
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
#include "dialoghtmledit.h"
#include "ui_dialoghtmledit.h"
DialogHtmlEdit::DialogHtmlEdit(QWidget *parent)
: QDialog(parent)
, ui(new Ui::DialogHtmlEdit)
{
ui->setupUi(this);
config = Configuration::instance();
connect(ui->htmlText, &QPlainTextEdit::textChanged, this, [=]{
if(!textChangeing)
{
textChangeing = true;
htmlText = ui->htmlText->toPlainText();
ui->textEdit->setHtml(htmlText);
textChangeing=false;
}
});
connect(ui->textEdit, &QTextEdit::textChanged, this, [=]{
if(!textChangeing)
{
textChangeing = true;
htmlText = ui->textEdit->toHtml();
ui->htmlText->setPlainText(htmlText);
textChangeing=false;
}
});
}
DialogHtmlEdit::~DialogHtmlEdit()
{
delete ui;
}
void DialogHtmlEdit::setData(QString text)
{
ui->htmlText->setPlainText(text);
htmlText = text;
ui->textEdit->setHtml(text);
}
QString DialogHtmlEdit::getSource()
{
return ui->htmlText->toPlainText();
}