C++: Add settings dialog for pointer declaration formatting

The dialog is at Tools > Options > C++ > Code Style > Edit... > Pointers
and References.

Currently the settings are referenced when applying the following
QuickFixes:
 - Adapting function signature in declaration/definition
   (FunctionDeclDefLink)
 - Inserting declaration from definition (InsertDeclOperation)
 - Inserting definition from declaration (InsertDefOperation)
 - Extracting a function (ExtractFunctionOperation)
 - Add Local Declaration (AddLocalDeclarationOp::Operation)

In these cases the code style of the current project is used. If there
is no current project open, the current global code style is used.

Task-number: QTCREATORBUG-6169

Change-Id: I3e4e502b3103f7f754ac9b39594ad461d89d9304
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-01-15 14:26:24 +01:00
parent 138066792e
commit 8fe25d0a4a
7 changed files with 309 additions and 31 deletions

View File

@@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="categoryTab">
<property name="currentIndex">
<number>0</number>
<number>5</number>
</property>
<widget class="QWidget" name="generalTab">
<attribute name="title">
@@ -404,6 +404,86 @@ if they would align to the next line</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="typesTab">
<attribute name="title">
<string>Pointers and References</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QGroupBox" name="pointerReferencesGroupBox">
<property name="title">
<string>Bind '*' and '&amp;&amp;' in types/declarations to</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="bindStarToIdentifier">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;This does not apply to the star and reference symbol in pointer/reference to functions and arrays, e.g.:
&lt;pre&gt; int (&amp;rf)() = ...;
int (*pf)() = ...;
int (&amp;ra)[2] = ...;
int (*pa)[2] = ...;
&lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Identifier</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="bindStarToTypeName">
<property name="text">
<string>Type name</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="bindStarToLeftSpecifier">
<property name="text">
<string>Left const/volatile</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="bindStarToRightSpecifier">
<property name="toolTip">
<string>This does not apply to references.</string>
</property>
<property name="text">
<string>Right const/volatile</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_6">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="TextEditor::SnippetEditorWidget" name="previewTextEditPointerReferences">
<property name="plainText">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>