-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialog.cpp
71 lines (60 loc) · 1.31 KB
/
dialog.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
MIT License
Copyright (c) 2021 Ramesh Choudhary
*/
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
}
void Dialog::setText(QString str)
{
ui->plainTextEdit->setPlainText(str);
}
void Dialog::setNodeNameText(QString str)
{
ui->plainTextEdit_2->setPlainText(str);
}
QString Dialog::getText()
{
return ui->plainTextEdit->toPlainText();
}
void Dialog::setPlaceHolderText(QString text)
{
ui->plainTextEdit->setPlaceholderText(text);
}
void Dialog::setPlaceHolderTextForNodeList(QString text)
{
ui->plainTextEdit_2->setPlaceholderText(text);
}
void Dialog::setTitle(QString title)
{
setWindowTitle(title);
}
QList<QString> Dialog::getNodeNameList()
{
QString text = ui->plainTextEdit_2->toPlainText();
QStringList list = text.split("\n");
QList<QString> ls;
for(int i=0;i<list.size();i++)
{
QString nodeName = list.at(i);
nodeName = nodeName.trimmed();
ls.append(nodeName);
}
if(ls.last().isEmpty())ls.removeLast();
return ls;
}
void Dialog::setReadOnly()
{
ui->plainTextEdit->setReadOnly(true);
ui->plainTextEdit_2->setReadOnly(true);
}
Dialog::~Dialog()
{
delete ui;
}