-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditordialog.cpp
More file actions
49 lines (41 loc) · 965 Bytes
/
Copy patheditordialog.cpp
File metadata and controls
49 lines (41 loc) · 965 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
41
42
43
44
45
46
47
48
49
#include "editordialog.h"
#include "ui_editordialog.h"
EditorDialog::EditorDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::EditorDialog)
{
ui->setupUi(this);
}
EditorDialog::~EditorDialog()
{
delete ui;
}
QString EditorDialog::text() const
{
return ui->edit->toPlainText();
}
void EditorDialog::setText(const QString &text)
{
ui->edit->setPlainText(text);
}
bool EditorDialog::wordWrap() const
{
return ui->edit->wordWrapMode() != QTextOption::NoWrap;
}
void EditorDialog::setWordWrap(bool wrap)
{
ui->edit->setWordWrapMode(wrap ? QTextOption::WordWrap : QTextOption::NoWrap);
}
bool EditorDialog::readOnly() const
{
return ui->edit->isReadOnly();
}
void EditorDialog::setReadOnly(bool ro)
{
ui->edit->setReadOnly(ro);
if (ro) {
ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok);
} else {
ui->buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
}
}