14

I want to change the braces coding style in Qt Creator 2.7.1. Currently, it is:

void bar(int i)
{
    static int counter = 0;
    counter += i;
}

But I want to change it to:

void bar(int i) {
    static int counter = 0;
    counter += i;
}

If I go to Options -> C++ -> Edit -> Braces, I can only change the indent of the braces. Changing the position of the braces manually in the preview text field, doesn't take any effect.

László Papp
  • 51,870
  • 39
  • 111
  • 135
Niklas
  • 23,674
  • 33
  • 131
  • 170

3 Answers3

3

I've opened public suggestion at Qt Creator bug tracker -- https://bugreports.qt.io/browse/QTCREATORBUG-11033.

Think, that it would be more helpful to pay more attention to bug tracker.

Hope, this feature will be added in Qt Creator 3.0.

Hi-Angel
  • 4,933
  • 8
  • 63
  • 86
NG_
  • 6,895
  • 7
  • 45
  • 67
1

Artistic Style Plugin for Qt Creator IDE:

  1. Download plugin for your Qt Creator IDE version (for v2.7.1 download 2.7.0 version).

  2. Unpack.

  3. Edit dependency version description in ArtisticStyle.pluginspec into already-installed version:

    • On terminal (Ctrl+Alt+T) run qtcreator -version to get dependency version.

    • Example version description for v2.7.0:

      <dependency name="Core" version="2.7.0"/>
      <dependency name="TextEditor" version="2.7.0"/>
      <dependency name="ProjectExplorer" version="2.7.0"/>
      <dependency name="Qt4ProjectManager" version="2.7.0"/>
      

      Change to (for v2.7.1):

      <dependency name="Core" version="2.7.1"/>
      <dependency name="TextEditor" version="2.7.1"/>
      <dependency name="ProjectExplorer" version="2.7.1"/>
      <dependency name="Qt4ProjectManager" version="2.7.1"/>
      
  4. Follow the normal steps from website to install the plugin.

  5. Change the style through Preference -> Artistic… -> Style.

  6. Add your own style and add --style=java.

user4157124
  • 2,809
  • 13
  • 27
  • 42
Abdillah
  • 982
  • 11
  • 28
0

As of recent Creator versions (not googled when this change was made) this is controlled by clang-format. This option hould control it.

stellarpower
  • 332
  • 3
  • 13