added text edit dialog to text effect
This commit is contained in:
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user