> On Dec 8, 2020, at 00:27, Kevin André <hyperquan...@gmail.com> wrote: > > Hi, > > Every time I use the dialog for adding a new class, there is still a > lot that I need to do manually after the files were generated: > > 1. Add cpp file and often the header file as well to CMakeLists.txt
Unfortunately automatically adapting CMakeLists.txt files is a bit difficult. > 2. Add GPL header to each file (copy from another file and update the > year if necessary) In Options > C++ > File Naming (not the best heading), there is “license template” where you can point Qt Creator to a file that should be copied to the top of generated source files. Unfortunately that is not available as a project setting, only globally. > 3. Add namespace to each file You can type MyNameSpace::MyClass for the class name to generate it in a namespace. > 4. Change naming of include guards (add prefix) > 5. Remove comment "// MYCLASS_H" at the #endif line > 6. Change "signals" to "Q_SIGNALS" in the header file > 7. Change "ClassName *parent" to "ClassName* parent" in the > constructor (if it inherits QObject) Hm, not sure, can’t you specify that in C++ > Coding Style ? > > It would be really useful if these actions could be automated as well. > > 1. It may be possible to add the new files everywhere its peers are > mentioned as well. So add "newclass.cpp" everywhere > "existingclass.cpp" occurs and add "newclass.h" everywhere > "existingclass.h" is found. The existing class should be a similar > class in the same directory. > > 2. I guess it should be possible to automatically extract the GPL from > an existing file, copy it to the new file, find the copyright line and > change the year(s) mentioned there to the current year. > > 3. By looking in the bug database I discovered that the wizard already > provides this in a very obscure way. This should be made explicit in > the user interface, either by adding a separate "namespace: " field or > by a visible note mentioning that the namespace can be specified along > the class name. > > 4. It would be really great if a heuristic could figure out the naming > scheme for include guards from existing header files in the same > directory. > > 5. I wouldn't mind the comment so much if I didn't have to fix the > name of the include guard several times for each header. > > 6. Maybe add a code style setting that says "don't use the Qt > keywords" and obey that setting. > > 7. This can be fixed by taking the code style settings into account > when generating the files. > > Should I add a separate suggestion for each of these to the bug database? 1+2: No. 3: Not sure. What where the arguments against a separate namespace field? I don’t see any issues with adding one. 4+5: Yes, though we usually don’t like magic so much, so an explicit setting providing a template would be preferred IMO. 6: Yes, could be done. 7: I see, so we don’t apply the code style after generation? Yes -> bug. > > I've already seen multiple bugs mentioning the third item but they all > seem to be closed. Adding yet another might result in it getting > dismissed again I'm afraid(?) > > All issues aside, thanks for this great IDE! > > > Regards, > > Kevin > _______________________________________________ > Qt-creator mailing list > Qt-creator@qt-project.org > https://lists.qt-project.org/listinfo/qt-creator -- Eike Ziller Principal Software Engineer The Qt Company GmbH Erich-Thilo-Straße 10 D-12489 Berlin eike.zil...@qt.io http://qt.io Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B _______________________________________________ Qt-creator mailing list Qt-creator@qt-project.org https://lists.qt-project.org/listinfo/qt-creator