Skip to content

Commit

Permalink
[TD]Fix mishandling of escaped html in Templates
Browse files Browse the repository at this point in the history
  • Loading branch information
WandererFan committed Sep 17, 2019
1 parent b50b215 commit c04a823
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Mod/TechDraw/Gui/TemplateTextField.cpp
Expand Up @@ -29,6 +29,8 @@
#include <QTextDocument>
#endif // #ifndef _PreCmp_

#include <Base/Console.h>

#include "DlgTemplateField.h"
#include "TemplateTextField.h"

Expand Down Expand Up @@ -64,11 +66,15 @@ void TemplateTextField::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
ui.setFieldContent(tmplte->EditableTexts[fieldNameStr]);

if (ui.exec() == QDialog::Accepted) {
#if QT_VERSION >= 0x050000
QString qsClean = ui.getFieldContent().toHtmlEscaped();
#else
QString qsClean = Qt::escape( ui.getFieldContent() );
#endif
//WF: why is this escaped?
// "<" is converted elsewhere and no other characters cause problems.
// escaping causes "&" to appear as "&amp;" etc
//#if QT_VERSION >= 0x050000
// QString qsClean = ui.getFieldContent().toHtmlEscaped();
//#else
// QString qsClean = Qt::escape( ui.getFieldContent() );
//#endif
QString qsClean = ui.getFieldContent();
std::string utf8Content = qsClean.toUtf8().constData();
tmplte->EditableTexts.setValue(fieldNameStr, utf8Content);
}
Expand Down

0 comments on commit c04a823

Please sign in to comment.