diff --git a/share/qtcreator/templates/wizards/files/cppheader/wizard.json b/share/qtcreator/templates/wizards/files/cppheader/wizard.json index db6809b0b9d..6ea6fe5b09a 100644 --- a/share/qtcreator/templates/wizards/files/cppheader/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppheader/wizard.json @@ -32,7 +32,7 @@ "source": "file.h", "target": "%{FileName}", "openInEditor": true, - "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.completeBaseName('%{FileName}')}" } + "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName('%{FileName}')}" } } } ] diff --git a/share/qtcreator/templates/wizards/files/cppsource/wizard.json b/share/qtcreator/templates/wizards/files/cppsource/wizard.json index bad4ad1f27c..504de97238e 100644 --- a/share/qtcreator/templates/wizards/files/cppsource/wizard.json +++ b/share/qtcreator/templates/wizards/files/cppsource/wizard.json @@ -32,7 +32,7 @@ "source": "file.cpp", "target": "%{FileName}", "openInEditor": true, - "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.completeBaseName('%{FileName}')}" } + "options": { "key": "Cpp:License:FileName", "value": "%{JS: Util.fileName('%{FileName}')}" } } } ] diff --git a/src/plugins/coreplugin/corejsextensions.cpp b/src/plugins/coreplugin/corejsextensions.cpp index 81e193f263b..806a5054e18 100644 --- a/src/plugins/coreplugin/corejsextensions.cpp +++ b/src/plugins/coreplugin/corejsextensions.cpp @@ -52,6 +52,12 @@ QString UtilsJsExtension::baseName(const QString &in) const return fi.baseName(); } +QString UtilsJsExtension::fileName(const QString &in) const +{ + QFileInfo fi(in); + return fi.fileName(); +} + QString UtilsJsExtension::completeBaseName(const QString &in) const { QFileInfo fi(in); diff --git a/src/plugins/coreplugin/corejsextensions.h b/src/plugins/coreplugin/corejsextensions.h index 861e10bd016..78e1bc99daa 100644 --- a/src/plugins/coreplugin/corejsextensions.h +++ b/src/plugins/coreplugin/corejsextensions.h @@ -46,6 +46,7 @@ public: Q_INVOKABLE QString fromNativeSeparators(const QString &in) const; Q_INVOKABLE QString baseName(const QString &in) const; + Q_INVOKABLE QString fileName(const QString &in) const; Q_INVOKABLE QString completeBaseName(const QString &in) const; Q_INVOKABLE QString suffix(const QString &in) const; Q_INVOKABLE QString completeSuffix(const QString &in) const;