Prettify dialog to change EditableTexts
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#endif // #ifndef _PreCmp_
|
||||
|
||||
#include "TemplateTextField.h"
|
||||
#include "DlgTemplateField.h"
|
||||
|
||||
//#include<QDebug>
|
||||
|
||||
@@ -48,14 +49,15 @@ TemplateTextField::~TemplateTextField()
|
||||
void TemplateTextField::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
//TODO: Add a command to change template text, and call it from here
|
||||
bool ok;
|
||||
QString curStr = QString::fromUtf8(tmplte->EditableTexts[fieldNameStr].c_str());
|
||||
QString newStr = QInputDialog::getText(NULL, QObject::tr("Change template text"),
|
||||
QObject::tr("Enter a new value for ") +
|
||||
QString::fromUtf8(fieldNameStr.c_str()),
|
||||
QLineEdit::Normal, curStr, &ok);
|
||||
if (ok && !newStr.isEmpty()) {
|
||||
tmplte->EditableTexts.setValue(fieldNameStr, newStr.toUtf8().constData());
|
||||
// ...Interpreter....("App.ActiveDocument().%s.%s.setTextField(%s,%s)",pageName,templateName,fieldName,fieldValue)
|
||||
DlgTemplateField* ui = new DlgTemplateField(nullptr);
|
||||
ui->setFieldName(fieldNameStr);
|
||||
ui->setFieldContent(tmplte->EditableTexts[fieldNameStr]);
|
||||
int uiCode = ui->exec();
|
||||
std::string newContent = "";
|
||||
if(uiCode == QDialog::Accepted) {
|
||||
std::string newContent = ui->getFieldContent();
|
||||
tmplte->EditableTexts.setValue(fieldNameStr, newContent);
|
||||
}
|
||||
ui->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user