diff options
author | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-04-28 13:42:46 +0200 |
---|---|---|
committer | Thomas Hartmann <thomas.hartmann@qt.io> | 2020-04-29 08:36:00 +0000 |
commit | c01fef0a78e61cbf11b044ef342e5fb9d4e2b150 (patch) | |
tree | 25ecaa7b67654d7517a29d29c4916b6729104327 /src/plugins/qmldesigner | |
parent | 91f696b3f30e4748f2abbe405939b9fba12fc795 (diff) |
QmlDesigner: Fix bindings in metainfo file
Since the parser update the string
is not escaped anymore.
Which to me is the more correct behavior.
We have to remove the escape characters
ourselves.
Task-number: QDS-2019
Change-Id: I5d03e99ab87b27bfcb22170138b96e50f646e5e4
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner')
-rw-r--r-- | src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp b/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp index 66aa3313b5..8ad521f6ff 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/metainforeader.cpp @@ -258,6 +258,22 @@ void MetaInfoReader::readItemLibraryEntryProperty(const QString &name, const QVa } } +inline QString deEscape(const QString &value) +{ + QString result = value; + + result.replace(QStringLiteral("\\\""), QStringLiteral("\"")); + result.replace(QStringLiteral("\\\\"), QStringLiteral("\\")); + + return result; +} + +inline QVariant deEscapeVariant(const QVariant &value) +{ + if (value.canConvert<QString>()) + return deEscape(value.toString()); + return value; +} void MetaInfoReader::readPropertyProperty(const QString &name, const QVariant &value) { if (name == QStringLiteral("name")) { @@ -265,7 +281,7 @@ void MetaInfoReader::readPropertyProperty(const QString &name, const QVariant &v } else if (name == QStringLiteral("type")) { m_currentPropertyType = value.toString(); } else if (name == QStringLiteral("value")) { - m_currentPropertyValue = value; + m_currentPropertyValue = deEscapeVariant(value); } else { addError(tr("Unknown property for Property %1").arg(name), currentSourceLocation()); setParserState(Error); |