[Qt-creator] Settings for code generation
Leander Schulten
leander.schulten at rwth-aachen.de
Wed Mar 18 11:51:41 CET 2020
Hello,
I am currently working on an improved version of the C++ QuickFixes for the generation of getters, setters, signals, Q_PROPERTY described in QTCREATORBUG-1532 <https://bugreports.qt.io/browse/QTCREATORBUG-1532>. But I think new settings are needed to configure that code generation, otherwise you have options like:
Generate Getter in Header
Generate Getter in Source
Generate Getter Outside Class
Genervte Setter in Header
…
Generate Getter in Header and Setter in Source
…
Generate Q_PROPERTY, Getter in … and Setter in …
…
There was already a Bug with a similar Problem (QTCREATORBUG-16452 <https://bugreports.qt.io/browse/QTCREATORBUG-16452>): Should the function name of a getter <name> or get<name>? A new Settings was introduced at Menu: Tools > Options > Tab: Code Style > Button "Edit..." - in the upcoming dialog, in the tab "Getter and Setter" you can uncheck "Prefer getter names without "get" to get the desired behaviour.
Maybe the setting can be moved to the Menu: Tool > Options > C++ > Qt Class Generation or you introduce a new tab "Quick Fix Style". There you can also define the naming convention of member variables (m_name, name, name_, ...), if you want to use slots for setters or where implementations of setter/getter should be placed (Inside/Outside-Class, .cpp file). Different "Quick Fix Style” should be possible for different projects. Maybe save the styles in a file and load them like the clang format file, so that everyone in a project uses the same generation rules.
Currently every QuickFix does something different: The InsertQtPropertyMembers QuickFix place the implementations inside the class, the GenerateGetterSetter QuickFix place the implementations in the .cpp file.
How should the new settings be implemented?
I have already implemented the generation for headers and started the implementation for source files, when I realised that there are far too many possibilities.
Regards,
Leander Schulten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20200318/ee744879/attachment.html>
More information about the Qt-creator
mailing list