File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -165,3 +165,8 @@ void QmlUtils::deleteTextWrapper(QObject *w)
165165 w->deleteLater ();
166166 }
167167}
168+
169+ QString QmlUtils::escapeHtmlEntities (const QString &t)
170+ {
171+ return t.toHtmlEscaped ();
172+ }
Original file line number Diff line number Diff line change @@ -22,4 +22,5 @@ class QmlUtils : public QObject
2222 Q_INVOKABLE void addNewValueToDynamicChart (QtCharts::QXYSeries* series, double value);
2323 Q_INVOKABLE QObject* wrapLargeText (const QByteArray &text);
2424 Q_INVOKABLE void deleteTextWrapper (QObject* w);
25+ Q_INVOKABLE QString escapeHtmlEntities (const QString& t);
2526};
Original file line number Diff line number Diff line change @@ -38,9 +38,9 @@ Rectangle {
3838 function addOutput (text , type ) {
3939
4040 if (type == " error" ) {
41- textArea .append (" <span style='color: red'>" + text + ' </span>' )
41+ textArea .append (" <span style='color: red'>" + qmlUtils . escapeHtmlEntities ( text) + ' </span>' )
4242 } else {
43- textArea .append (" <pre style='color: white'>" + text + ' </pre>' )
43+ textArea .append (" <pre style='color: white'>" + qmlUtils . escapeHtmlEntities ( text) + ' </pre>' )
4444 }
4545
4646 if (type == " complete" || type == " error" ) {
You can’t perform that action at this time.
0 commit comments