[Qt-creator] Editor style setting for a submodule (+EditorConfig)

Eike Ziller Eike.Ziller at qt.io
Mon Mar 4 09:01:43 CET 2019

> On 3. Mar 2019, at 19:38, Andy <asmaloney at gmail.com> wrote:
> Is there a way to have two different editor style settings - one for the main project and one for a submodule?
> Use-case: I have my own code in a submodule (lib) within a project that's "not mine". (Using cmake.) When editing in the main project I want to use its style, but when I edit my own code I want it in my style...
> Right now everything uses the main project's style.
> Secondary question: is there a way to persist styles in a repo so everyone uses the same settings? Preferably using a "standard" like EditorConfig so that non QtC-users can participate as well?

I’d try enabling the Beautifier plugin and using one of the code styling tools that it supports (clang-format, astyle, uncrustify). You can check the format definitions for these into the repo, and Qt Creator should take the first definition it finds in the parent folder hierarchy (or at least can be configured to do so).
Creating the definition files for these is up to you though.
Also, these are not used for formatting while typing, only on saving or explicit request. Except if you use clang-format and try the new experimental ClangFormat plugin (instead of Beautifier), which has the feature of formatting while typing in Qt Creator 4.9.

Br, Eike

> I don't see anything here:
>   https://doc.qt.io/qtcreator/creator-code-style-settings.html
> Thanks!
> ---
> Andy Maloney  //  https://asmaloney.com
> twitter ~ @asmaloney
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> https://lists.qt-project.org/listinfo/qt-creator

Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

More information about the Qt-creator mailing list