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. Need help with clang-format settings in QtCreator
Forum Updated to NodeBB v4.3 + New Features

Need help with clang-format settings in QtCreator

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
1 Posts 1 Posters 337 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.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by
    #1

    I have used Qt Creator many years, with the original built-in formatting options (Preferences->C++->Code style and then Tabs "General" through "Pointers and References", completely disabling clang-format)

    Things got buggy, especially with newer language features. So I bit the bullet and tried to put my code style into clang-format rules.

    So I went through The Clang format style options from top to bottom (took me a while), and tried to apply each option as best as I could.

    Most things seem to work, but I struggle in one particular configuration:

    // What I'd like to have:
    {
        auto fLambda = []()
            {
                return;
            };
    }
    
    // What I get:
    {
        auto fLambda = []()
        {
            return;
        };
    }
    

    This may be related to my switch/case configuration, which is as follows:

    {
        switch(value)
        {
            case 0:
            {
                break;
            }
        }
    }
    

    So I cannot just globally make a rule that braces should be indented. I'd like to NOT indent after control statements, but DO intent the body of a lambda.
    Any ideas?

    1 Reply Last reply
    0

    • Login

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