Instead of the default (and pretty bugprone) qtcreator header guard CLASS_H, this defines a safer one in the form NAMESPACE_NESTED_NAMESPACES_CLASS_H. It is more likelly to comply with llvm-header-guard check of clang-tidy, if your namespaces matches your folder architecture.
Copy the three files (file.cpp
file.h
wizard.json
) in your local qtcreator template folder:
$HOME/.config/QtProject/qtcreator/templates/wizards/classes/cpp/
on Linux and macOS
or %APPDATA%\QtProject\qtcreator\templates\wizards\classes\cpp\
on Windows.
You may need to restart qtcreator for this to be considered.
They are a copy of the original ones from the QtCreator project, with only the line 20 in wizard.json changed:
{ "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard('%{Class}', '%{JS: Util.suffix('%{HdrFileName}')}')}" },