Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator 16 set clang format version
Forum Updated to NodeBB v4.3 + New Features

Qt Creator 16 set clang format version

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 2 Posters 398 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mos90
    wrote on last edited by
    #1

    Hi,

    Is it possible to use a custom clang-format executable in Qt Creator and not the built in version? The current Qt Creator ships with version 19 something.
    But on our build machine there is a different clang format version and despite using the same .clang-format file the formatting result sometimes differs for different clang format versions.
    I would like to fix the clang format version to something independent of qt creator. Is that possible?
    Other llvm executables like clangd can easily be customized..

    1 Reply Last reply
    0
    • Axel SpoerlA Offline
      Axel SpoerlA Offline
      Axel Spoerl
      Moderators
      wrote on last edited by
      #2

      You can probably achieve that by installing the Beautifier plugin.
      Under Preferences->Beautifier, you can then specify a clang-format executable.

      Software Engineer
      The Qt Company, Oslo

      1 Reply Last reply
      1
      • M Offline
        M Offline
        Mos90
        wrote on last edited by
        #3

        Thanks, I need to try if that really picks the correct version in the editor. I find it a bit confusing, because there seem to be at least two different options for using clang format in Qt creator.

        1. There is a "ClangFormat" extension which lets me do auto formatting of the code, but without having the possibility to choose another than the built-in version of clang-format. It is configurable under Preferences->C++->Code Style.
        2. Having activated the Beautifier plugin I can set a specific version under Preferences->Beautifier->ClangFormat.

        But it seems I can have both plugins active at the same time and then I don't know what happens.

        I have disabled the ClangFormat extension for now (which is enabled by default) and enabled only the beautifier plugin. Will report here how it goes.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mos90
          wrote on last edited by
          #4

          So, with the beautifier we made it work now. In the end we had to remove

          LineEnding: CRLF
          

          From our .clang-format file, since this was breaking completely the formatting in Qt Creator. Running clang format from the command line worked fine though.

          The ClangFormat extension does not apply the formatting on the full file, but only on changed lines, which we did not want. Also it made the settings dialog of Qt Creator extremely slow somehow.

          1 Reply Last reply
          0
          • M Mos90 has marked this topic as solved on

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved