added text edit dialog to text effect

This commit is contained in:
itsmattkc
2019-01-11 23:30:15 +11:00
parent 731300539a
commit e8f632940c
7 changed files with 90 additions and 7 deletions
+36
View File
@@ -0,0 +1,36 @@
#include "texteditdialog.h"
#include <QVBoxLayout>
#include <QPlainTextEdit>
#include <QDialogButtonBox>
TextEditDialog::TextEditDialog(QWidget *parent, const QString &s) :
QDialog(parent)
{
setWindowTitle("Edit Text");
QVBoxLayout* layout = new QVBoxLayout();
setLayout(layout);
textEdit = new QPlainTextEdit();
textEdit->setPlainText(s);
layout->addWidget(textEdit);
QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
layout->addWidget(buttons);
connect(buttons, SIGNAL(accepted()), this, SLOT(save()));
connect(buttons, SIGNAL(rejected()), this, SLOT(cancel()));
}
const QString& TextEditDialog::get_string() {
return result_str;
}
void TextEditDialog::save() {
result_str = textEdit->toPlainText();
accept();
}
void TextEditDialog::cancel() {
reject();
}