[Qt-creator] How can I make a global cpp code style config

Kobus Jaroslaw Jaroslaw.Kobus at theqtcompany.com
Thu Jun 18 16:20:35 CEST 2015


Hi,

Unfortunately, currently templates for code styles are read only from local resource path, i.e. from ~/.config/QtProject/qtcreator/codestyles/Cpp/mycodingstyle.xml (the cpp code style settings like in Eike's example). If you copy your style there and set value for [CppCodeStyleSettings] | CurrentPreferences to: "@ByteArray(mycodingstyle)" inside your local settings (~/.config/QtProject/QtCreator.ini) then it should work. Alternatively, you may clear your local setting  for CurrentPreferences (~/.config/QtProject/QtCreator.ini) and set it globally like Eike suggested, this should also work, but please remember that mycodingstyle.xml can be placed only locally (not in /opt/...).

Hope this helps

Regards

Jarek

________________________________________
From: qt-creator-bounces+jaroslaw.kobus=theqtcompany.com at qt-project.org <qt-creator-bounces+jaroslaw.kobus=theqtcompany.com at qt-project.org> on behalf of Miller Henry <MillerHenry at JohnDeere.com>
Sent: 18 June 2015 15:40
To: Ziller Eike
Cc: qt-creator at qt-project.org
Subject: Re: [Qt-creator] How can I make a global cpp code style config

That is what I expected, my style isn't picked up even though from what I can tell my QtCreator.ini is correct

[CppCodeStyleSettings]
LegacyTransformed=true
CurrentPreferences=JohnDeereStyle

I even deleted everything in ~/.config/QtProject, my global style still isn't used.


-----Original Message-----
From: Ziller Eike [mailto:Eike.Ziller at theqtcompany.com]
Sent: Thursday, June 18, 2015 5:22 AM
To: Miller Henry
Cc: qt-creator at qt-project.org
Subject: Re: [Qt-creator] How can I make a global cpp code style config


> On Jun 17, 2015, at 3:12 PM, Miller Henry <MillerHenry at JohnDeere.com> wrote:
>
> I’m packaging qt creator for my company, and I want to make our coding style rules the default.  Creating the .xml style is easy enough, but I can’t seem to find a way to get this as the default style.
>
> We are installing qt creator into /opt/QtCreator, and we have working template wizards installed into /opt/QtCreator/share/qtcreator/templates/wizards .  I expect that I just need to install QtCreator.ini into /opt/QtCreator/share/qtcreator/QtProject/ and our code style .xml into /opt/QtCreator/share/qtcreator/QtProject/codestyles/Cpp/. This doesn’t seem to work though – qt creator doesn’t seem to pick up the style.  Is there something more that I’m missing?

Hi,

as far as I can see, there is setting for “default” coding style. That means, that if you add something like

[CppCodeStyleSettings]
CurrentPreferences=@ByteArray(mycodingstyle)

to the “install settings” (/opt/QtCreator/share/qtcreator/QtProject/QtCreator.ini looks correct to me), then this will set the coding style only if there are no user settings at all.
I.e. when running Qt Creator with a clean settingspath (e.g. with -settingspath /tmp/foosettings).

--
Eike Ziller, Senior Software Engineer - The Qt Company GmbH

The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

_______________________________________________
Qt-creator mailing list
Qt-creator at qt-project.org
http://lists.qt-project.org/mailman/listinfo/qt-creator



More information about the Qt-creator mailing list