[Qt-creator] Settings for naming conventions

Nikolai Kosjar nikolai.kosjar at theqtcompany.com
Wed Jan 13 13:19:18 CET 2016


Hi again,

let me enumerate your requirements and propose something addressing those.


Requirements:

  R1. Global and per project settings
  R2. API working on those settings, converting names
  R3. Settings/API used by:
     - Wizards
     - Refactoring Code
     - Text Editor to validate identifiers


Proposal:

Enhance CppTools::CppCodeStyleSettings with the specific C++ settings 
you need. This is fine since naming conventions are usually part of 
coding styles/rules. This does not introduces anything in the text 
editor, but uses the infrastructure that is provided by it and the 
project explorer (CppCodeStyleSettings are managed by 
CppCodeStylePreferences, which is a TextEditor::ICodeStylePreferences). 
Thus, you get R1 for free.

For R2, just introduce and export your new class in cpptools. This class 
uses CppTools::CppCodeStyleSettings.

Regarding R3:
CppCodeStyleSettings is already exported and can be used.

* Wizards - The plugins of the wizard that wants to use the settings/api 
obviously needs to depend on cpptools. Is this a problem for the wizards 
you had in mind?

* Refactoring Code - No problem since this is already in cpptools 
itself. qmljstools depends on cpptools and thus could also access the 
settings.

* Text Editor to validate identifiers - A virtual function in e.g. 
TextEditorWidget could serve this? And the specific editors have access 
to their settings.

Something along the lines could also be done for QML/JS or other 
languages (e.g. in the projects mode you can already switch the language 
for the coding style).

Would this work?


Nikolai



More information about the Qt-creator mailing list