Sharing Project Settings | Qt Creator Manual

Qt Creator Manual | Sharing Project Settings

Qt Creator Manual 4.8.0

Specifying Dependencies ◦ Managing Sessions

# Sharing Project Settings

Qt Creator stores user-specific project settings in a .pro.user file. You can share these settings between several projects as a .pro.shared file. It has the same XML structure as a .pro.user file, but only contains the settings to share.

## Creating Shared Settings File

The easiest way to create a .pro.shared file is to copy settings from the .pro.user file. Typically, you would share some of the values in the `ProjectExplorer.Project.EditorSettings` section.

Note: You must always specify the `ProjectExplorer.Project.Updater.FileVersion` variable and use the same value for it as in the .pro.user file.

You can then deliver the .pro.shared file to other developers or copy it to other development PCs.

The following is an example of a pro.shared file:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE QtCreatorProject>
      <qtcreator>
          <data>
              <variable>ProjectExplorer.Project.EditorSettings</variable>
              <valuemap type="QVariantMap">
                  <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
                  <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
                  <value type="int" key="EditorConfiguration.TabSize">14</value>
                  <value type="int" key="EditorConfiguration.IndentSize">4</value>
              </valuemap>
              </data>
          <data>
              <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
              <value type="int">10</value>
          </data>
      </qtcreator>

## Updating Shared Settings

The first time Qt Creator loads the project after you added pro.shared settings, it overwrites the pro.user settings with them. If you open the project for the first time and Qt Creator has not created a .pro.user file, the settings in the .pro.shared file take effect immediately.

If you receive a .pro.shared file and do not want to use a particular setting in it, you can change it. Qt Creator marks it a sticky setting. The next time you open a project, the setting is not updated. Qt Creator tracks sticky settings in the .pro.user file and removes the mark if the values in the pro.user and pro.shared files eventually become identical. This is to avoid a permanent sticky setting that was created just because you wanted to try something out.

Specifying Dependencies ◦ Managing Sessions