aboutsummaryrefslogtreecommitdiffstats
path: root/share/qtcreator/templates
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-05-31 15:29:05 +0200
committerEike Ziller <eike.ziller@qt.io>2019-06-03 06:46:52 +0000
commit23c222f61b260b56c10775197d6100f130d558b4 (patch)
tree513c9d0f65d9f7f9ec4884c64db7f92f858beaa2 /share/qtcreator/templates
parentd73c27125952bcce920a2abd55c7c3758e850ac0 (diff)
Fix C++ Library wizard when compiled with Qt < 5.12
Only Qt 5.12 got true ECMA Script capabilities, so arrow function expressions are not supported before that. To be able to use "regular" inline functions, we allow usage of } by escaping with backslash. For variables that do not start with "JS:" we already supported backslash for escaping. Fixes: QTCREATORBUG-22336 Change-Id: I9fc638e64d2757a21fffc16355635e2fcff87a36 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'share/qtcreator/templates')
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp2
-rw-r--r--share/qtcreator/templates/wizards/projects/cpplibrary/lib.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp
index dcdacae6d3..6eb6c86faa 100644
--- a/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.cpp
@@ -11,7 +11,7 @@
: %{BaseClassName}(parent)
{
}
-%{JS: '%{PluginMethods}'.split('|').map(s => '\n' + s.replace(/([a-zA-Z0-9]+\()/, '%{CN}::$1') + '\n\u007B\n static_assert(false, "You need to implement this function");\n\u007D').join('\n')}\
+%{JS: '%{PluginMethods}'.split('|').map(function(s) { return '\\n' + s.replace(/([a-zA-Z0-9]+\\()/, '%{CN}::$1') + '\\n\{\\n static_assert(false, "You need to implement this function");\\n\}'; \}).join('\\n')}\
@endif
%{JS: Cpp.closeNamespaces('%{Class}')}\
diff --git a/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h
index 4a5d1247a4..ae2c90a313 100644
--- a/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h
+++ b/share/qtcreator/templates/wizards/projects/cpplibrary/lib.h
@@ -36,7 +36,7 @@ public:
explicit %{CN}(QObject *parent = nullptr);
private:
-%{JS: '%{PluginMethods}'.split('|').map(s => ' ' + s + ' override;').join('\n')}
+%{JS: '%{PluginMethods}'.split('|').map(function(s) { return ' ' + s + ' override;'; \}).join('\\n')}
};
@endif
%{JS: Cpp.closeNamespaces('%{Class}')}\