forked from qt-creator/qt-creator
FormWizard: Fix newlines being escaped in generated output
Export the form contents as a list of lines and join them when needed instead of hoping to unescape '\\n' in all places where it is necessary. This approach should be a bit saver since it will cause parse errors in the wizard, which are more visible than broken output in the generated files. Task-number: QTCREATORBUG-13456 Change-Id: I434a9227082f92be3c2ce75006f61ac79a2b6fd6 Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -124,10 +124,16 @@ QVariant JsonWizard::value(const QString &n) const
|
||||
{
|
||||
QVariant v = property(n.toUtf8());
|
||||
if (v.isValid()) {
|
||||
if (v.type() == QVariant::String)
|
||||
if (v.type() == QVariant::String) {
|
||||
return m_expander.expand(v.toString());
|
||||
else
|
||||
} if (v.type() == QVariant::StringList) {
|
||||
QStringList tmp = Utils::transform(v.toStringList(), [this](const QString &i) -> QString {
|
||||
return m_expander.expand(i).replace(QLatin1Char('\''), QLatin1String("\\'"));
|
||||
});
|
||||
return QString(QString(QLatin1Char('\'')) + tmp.join(QLatin1String("', '")) + QString(QLatin1Char('\'')));
|
||||
} else {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
if (hasField(n))
|
||||
return field(n); // Can not contain macros!
|
||||
|
||||
Reference in New Issue
Block a user