diff --git a/share/qtcreator/templates/wizards/files/form/file.ui b/share/qtcreator/templates/wizards/files/form/file.ui index a12c1fffb0a..d83113033f1 100644 --- a/share/qtcreator/templates/wizards/files/form/file.ui +++ b/share/qtcreator/templates/wizards/files/form/file.ui @@ -1 +1 @@ -%{FormContents}\ +%{JS: [ %{FormContents} ].join('\n')}\ diff --git a/share/qtcreator/templates/wizards/files/form/wizard.json b/share/qtcreator/templates/wizards/files/form/wizard.json index 510f2d0ae1c..835ccf8ffbb 100644 --- a/share/qtcreator/templates/wizards/files/form/wizard.json +++ b/share/qtcreator/templates/wizards/files/form/wizard.json @@ -10,7 +10,7 @@ "featuresRequired": [ "Plugin.Designer" ], "options": [ - { "key": "UiClass", "value": "%{JS: QtSupport.uiClassName('%{FormContents}') }" }, + { "key": "UiClass", "value": "%{JS: QtSupport.uiClassName([ %{FormContents} ].join('\\n'))}" }, { "key": "Extension", "value": "%{JS: Util.preferredSuffix('application/x-designer')}"}, { "key": "InitialFileName", "value": "%{JS: Cpp.classToFileName('%{UiClass}', '%{Extension}') }" } ], diff --git a/src/plugins/designer/formtemplatewizardpage.cpp b/src/plugins/designer/formtemplatewizardpage.cpp index 6d5abd5d79b..f12c770ffa9 100644 --- a/src/plugins/designer/formtemplatewizardpage.cpp +++ b/src/plugins/designer/formtemplatewizardpage.cpp @@ -122,7 +122,7 @@ bool FormTemplateWizardPage::validatePage() QMessageBox::critical(this, tr("%1 - Error").arg(title()), errorMessage); return false; } - wizard()->setProperty("FormContents", m_templateContents.replace(QLatin1Char('\n'), QLatin1String("\\n"))); + wizard()->setProperty("FormContents", m_templateContents.split(QLatin1Char('\n'))); return true; } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp index d5372b79238..ab9ba1a722e 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp @@ -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!