我錯過了這條線:
<value type="bool" key="EditorConfiguration.UseGlobal">false</value>
加入它,Qt Creator的默認使用的自定義配置與正確設置後。
這是我的工作,註釋.pro.shared
文件:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<qtcreator>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">12</value>
</data>
<!-- "Projects > Editor" tab -->
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.UseGlobal">false</value>
<!-- "Tabs And Indentation" section -->
<value type="bool" key="EditorConfiguration.SpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="int" key="EditorConfiguration.TabSize">4</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="int" key="EditorConfiguration.PaddingMode">2</value> <!-- 0="Not At All", 1="With Spaces", 2="With Regular Indent" -->
<!-- "Typing" section -->
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> <!-- 0="None", 1="Follows Previous Indents", 2="Unindents" -->
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> <!-- 0="Never", 1="Always", 2="In Leading White Space" -->
<!-- "Cleanups Upon Saving" section -->
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<!-- "File Encodings" section -->
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> <!-- 0="Add If Encoding Is UTF-8", 1="Keep If Already Present", 2="Always Delete" -->
<!-- "Mouse and Keyboard" section -->
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
</valuemap>
</data>
</qtcreator>