diff --git a/src/app/qmlutils.cpp b/src/app/qmlutils.cpp index eeb763cb9..c205e7d74 100644 --- a/src/app/qmlutils.cpp +++ b/src/app/qmlutils.cpp @@ -165,3 +165,8 @@ void QmlUtils::deleteTextWrapper(QObject *w) w->deleteLater(); } } + +QString QmlUtils::escapeHtmlEntities(const QString &t) +{ + return t.toHtmlEscaped(); +} diff --git a/src/app/qmlutils.h b/src/app/qmlutils.h index 4fee0ee44..c6116c961 100644 --- a/src/app/qmlutils.h +++ b/src/app/qmlutils.h @@ -22,4 +22,5 @@ class QmlUtils : public QObject Q_INVOKABLE void addNewValueToDynamicChart(QtCharts::QXYSeries* series, double value); Q_INVOKABLE QObject* wrapLargeText(const QByteArray &text); Q_INVOKABLE void deleteTextWrapper(QObject* w); + Q_INVOKABLE QString escapeHtmlEntities(const QString& t); }; diff --git a/src/qml/console/QConsole.qml b/src/qml/console/QConsole.qml index 0899d2d14..05ea0a5cd 100644 --- a/src/qml/console/QConsole.qml +++ b/src/qml/console/QConsole.qml @@ -38,9 +38,9 @@ Rectangle { function addOutput(text, type) { if (type == "error") { - textArea.append("" + text + '') + textArea.append("" + qmlUtils.escapeHtmlEntities(text) + '') } else { - textArea.append("
" + text + '
') + textArea.append("
" + qmlUtils.escapeHtmlEntities(text) + '
') } if (type == "complete" || type == "error") {