I found out that Qt Creator can insert a license template header when creating a new file and fill certain placeholders automatically like file name and year:
/**
@file %FILENAME%
Copyright (c) %YEAR%
*/
Are these placeholders documented anywhere ? Maybe in some kind of a list ?
PS: Under this bug report (QTCREATORBUG-14726) Tobias Hunger commented that a new macro style of this format: %{CurrentDate:FORMATSTRING}
is being used. But I can't find a documentation for this either!
I can't see anything where there is a license file already stored, but on Qt website it says this:
Adding a License Header Template for C++ Code
A file containing a license header for C++ can be specified under Tools > Options > C++ > License Template. It may contain special placeholders enclosed in %% that are replaced when generating a new file:
%YEAR%: Year %MONTH%: Month %DAY%: Day of the month %DATE%: Date %USER%: Username %FILENAME%: File name %CLASS%: Class name (if applicable) %$VARIABLE%: Contents of environment variable VARIABLE.
which can be set in:
Tools->Options...->C++->File Naming
After some digging around the issue mention in the OP the following seems to work with QtCreator 4.2.0:
%{Cpp:License:FileName}
%{Env:<Environmentalvar>} E.g: %{Env:PATH}
%{CurrentDate:yyyy-MM-dd}
%{Cpp:License:ClassName}
From the QtCreator Sources. It would be nice to get this properly documented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With