[Qt-creator] Tabs vs Spaces?

Michael Jackson mike.jackson at bluequartz.net
Fri Mar 6 18:56:44 CET 2020

I will echo Henry and say that clang-format and git-clang-format in combination with QtCreator 4.10 and newer have let our project all live with the same formatting rules. As I type code QtCreator uses our clang-format file to format my code. Git-clang-format for changes made through other text editors.

Mike Jackson

´╗┐On 3/6/20, 12:04 PM, "Qt-creator on behalf of Miller Henry" <qt-creator-bounces at qt-project.org on behalf of MillerHenry at JohnDeere.com> wrote:

    The obvious thing is to create a clang-format rule that formats things to your preferences, and then back to the repo preferences.  A git hook can reformat files to the repo preferences before you check them in, though I'm not sure how you reformat to your preferences. Beware that if you do this you need to get everybody to agree to the repo format and run the tool before their checkins as well, otherwise 'git blame' will put your name on most of the code when your only contribution was to change whitespace to what it should have been in the first place.
    Clang-format is the best-known tool for this today. I've also used uncrustify in the past for formatting, and I've seen a few other tools.  Your project can choose.
    -----Original Message-----
    From: Qt-creator <qt-creator-bounces at qt-project.org> On Behalf Of Jason H
    Sent: Friday, March 6, 2020 10:38 AM
    To: qt-creator <qt-creator at qt-project.org>
    Subject: [Qt-creator] Tabs vs Spaces?
    I am a tabs guy. I change the Qt style to use tabs. I tab all the things!!
    Anyway, I now have other contributors to my project that are spaces people. How can we live in harmony? One side effect is that it seems git considers whitespace changes so his code is indented with spaces, mine are tabs and it's making a mess in git.
    Or should this be handled by git? (And if so, how?)

More information about the Qt-creator mailing list