From 6bd25b8893a4e918432605bc5c4a69d514c35d23 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 19 Mar 2018 13:35:50 -0300 Subject: [PATCH] Escape single quotes in PropertyStringList --- src/Gui/propertyeditor/PropertyItem.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 5f9ce4368b..0eb3222a45 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -2178,6 +2178,7 @@ QVariant PropertyStringListItem::toString(const QVariant& prop) const list.append(QLatin1String("...")); } QString text = QString::fromUtf8("[%1]").arg(list.join(QLatin1String(","))); + text.replace(QString::fromUtf8("'"),QString::fromUtf8("\\'")); return QVariant(text); } @@ -2204,7 +2205,9 @@ void PropertyStringListItem::setValue(const QVariant& value) QTextStream str(&data); str << "["; for (QStringList::Iterator it = values.begin(); it != values.end(); ++it) { - str << "unicode('" << *it << "', 'utf-8'),"; + QString text(*it); + text.replace(QString::fromUtf8("'"),QString::fromUtf8("\\'")); + str << "unicode('" << text << "', 'utf-8'),"; } str << "]"; setPropertyValue(data);