<div dir="ltr"><div>Cool - thanks Eike!<br><br>Is there a way to turn that on per-project? I don't see anything in the project settings for that. Aside from my own work, I work on several open-source projects and switch back-and-forth frequently. Unfortunately I'm not in a position to force them to use the One True Format...</div><div><br></div><div>Another suggestion - it would be very useful to be able to read the clang-format config per-project from a file (".clang-format.cfg?"). (Does this already exist too?) This would help avoid misconfiguration when several developers are on the same codebase. <br></div><div><br></div><div>If we had that, maybe a non-standard "AutoFormatOnSave" option could be added to it?<br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>---<br>Andy Maloney  //  <a href="https://asmaloney.com" target="_blank">https://asmaloney.com</a><br><div>twitter ~ <span dir="ltr"><a href="https://twitter.com/asmaloney" target="_blank">@<span>asmaloney</span></a></span></div><br></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Tue, Aug 22, 2017 at 9:18 AM, Eike Ziller <span dir="ltr"><<a href="mailto:Eike.Ziller@qt.io" target="_blank">Eike.Ziller@qt.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On Aug 22, 2017, at 14:36, Andy <<a href="mailto:asmaloney@gmail.com">asmaloney@gmail.com</a>> wrote:<br>
><br>
> My 2 cents:<br>
><br>
> I watched the video (good stuff - thanks!) grabbed clang-format, found this awesome site to create the configuration:<br>
><br>
>   <a href="https://zed0.co.uk/clang-format-configurator/" rel="noreferrer" target="_blank">https://zed0.co.uk/clang-<wbr>format-configurator/</a><br>
><br>
> and played with it in Qt Creator.<br>
><br>
> Overall I think it's great. I've done some work with Go and I love that go-fmt is run every time I save a file (in Atom). It would be amazing to have that capability with clang-format and Qt Creator.<br>
<br>
</span>Options > Beautifier > General > Enable auto format on file save (needs enabled Beautifier plugin)<br>
<div class="HOEnZb"><div class="h5"><br>
> The one thing I couldn't get it to do is indent code after accessor keywords. Using "AccessModifierOffset" I can do this:<br>
><br>
> {<br>
> public:<br>
>    void foo();<br>
> }<br>
><br>
> or this:<br>
><br>
> {<br>
>    public:<br>
>    void foo();<br>
> }<br>
><br>
> But not the one I want, which is this:<br>
><br>
> {<br>
>    public:<br>
>       void foo();<br>
> }<br>
><br>
> If anyone has clues on how to accomplish this I'll be a happy humanoid.<br>
><br>
><br>
> ---<br>
> Andy Maloney  //  <a href="https://asmaloney.com" rel="noreferrer" target="_blank">https://asmaloney.com</a><br>
> twitter ~ @asmaloney<br>
><br>
><br>
> On Tue, Aug 22, 2017 at 3:29 AM, Nikolai Kosjar <<a href="mailto:nikolai.kosjar@qt.io">nikolai.kosjar@qt.io</a>> wrote:<br>
> On 08/21/2017 08:18 PM, Timur Kristóf wrote:<br>
> Hi,<br>
><br>
> I noticed that the built-in code style options somewhat clash with the<br>
> beautifier plugin. (I notice that the code style settings don't affect<br>
> the beautifier plugin at all, and the beautifier settings are rather<br>
> rudimentary at the moment.)<br>
><br>
> What are the long-term plans in this regard?<br>
><br>
> Do you guys intend to improve the built-in code styling, or do you want<br>
> to eventually replace it with either the beautifier or something based<br>
> on clang-format?<br>
> Evaluation is on-going :)<br>
><br>
> I'm playing around with clang-format for the Qt Creator code base to see whether it can replace our built-in code style use cases and how well it can handle our code style/formatting.<br>
><br>
> Some general observations:<br>
><br>
> 1. Qt Creator has a built-in *indenter*, handling/controlling whitespace before the first token of a line.<br>
><br>
> 2. clang-format does this and more:<br>
>  * it handles/controls whitespace everywhere, also taking a maximum column count into account<br>
>  * it can e.g. also sort your includes and add comments at the closing curly brace of namespaces: "} // namespace X".<br>
><br>
> 3. The beautifier-plugin for clang-format allows to format the entire file or text selections of it. Changed lines are properly indicated by red vertical stripes in the left editor margin, which is cool. The plugin does not yet make use of the -cursor argument, which allows to format the AST at cursor position and probably would be useful/needed to replace current on-enter-indendation.<br>
><br>
> Nikolai<br>
><br>
> ______________________________<wbr>_________________<br>
> Qt-creator mailing list<br>
> <a href="mailto:Qt-creator@qt-project.org">Qt-creator@qt-project.org</a><br>
> <a href="http://lists.qt-project.org/mailman/listinfo/qt-creator" rel="noreferrer" target="_blank">http://lists.qt-project.org/<wbr>mailman/listinfo/qt-creator</a><br>
><br>
> ______________________________<wbr>_________________<br>
> Qt-creator mailing list<br>
> <a href="mailto:Qt-creator@qt-project.org">Qt-creator@qt-project.org</a><br>
> <a href="http://lists.qt-project.org/mailman/listinfo/qt-creator" rel="noreferrer" target="_blank">http://lists.qt-project.org/<wbr>mailman/listinfo/qt-creator</a><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Eike Ziller<br>
Principal Software Engineer<br>
<br>
The Qt Company GmbH<br>
Rudower Chaussee 13<br>
D-12489 Berlin<br>
<a href="mailto:eike.ziller@qt.io">eike.ziller@qt.io</a><br>
<a href="http://qt.io" rel="noreferrer" target="_blank">http://qt.io</a><br>
Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho<br>
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B<br>
<br>
</font></span></blockquote></div><br></div>