qt .pro.user file illustrated

When you open the .pro file of a Qt project at the first time, you will be prompted to configure the project. The “Configure Project” dialog shows you the available kits for the project. You need to select one or several building kits, then press the “Configure Project” button. Then you can edit/build/run the project in the workspace.

What happens when you press the “Configure Project” button? Well, qt creator will create a .pro.user file for the project. This xml file will save the settings for the project. The top node in the xml file is <qtcreator>. The settings are stored in its children <data> nodes. Here is the setting list:

  • EnvironmentId
  • ProjectExplorer.Project.ActiveTarget
  • ProjectExplorer.Project.EditorSettings
  • ProjectExplorer.Project.PluginSettings
  • ProjectExplorer.Project.Target.0,ProjectExplorer.Project.Target.1,…
  • ProjectExplorer.Project.TargetCount
  • ProjectExplorer.Project.Updater.FileVersion
  • Version

Most settings are easy to understand from their names. The targets correspond to the build kits you selected. For example, if you choose msvc2017 32bit and mingw 64-bit, you will get two (ProjectExplorer.Project.TargetCount) targets:ProjectExplorer.Project.Target.0 and ProjectExplorer.Project.Target.1. The targets can also be seen in Qt creator:

The highlight one is the active target(ProjectExplorer.Project.ActiveTarget). From the above figure, you can also see for each target, there are three build options:Debug, Profile, and Release. These correspond to the ProjectExplorer.Target.BuildConfiguration.0, ProjectExplorer.Target.BuildConfiguration.1, ProjectExplorer.Target.BuildConfiguration.2 children nodes of ProjectExplorer.Project.Target.x. The highlighted build option is Debug at the moment which corresponds to the value of ProjectExplorer.Target.ActiveBuildConfiguration.

ProjectExplorer.Target.BuildConfiguration.x stores the settings you set on the “Build Settings” dialog of Qt creator. You can go to that dialog by clicking “Project” on the left column, clicking “Build” under one of the kits.

A BuildConfiguration may have several BuildStepList children nodes. ProjectExplorer.BuildConfiguration.BuildStepList.0 correspond to the “Build Steps” section on the “Build Settings” dialog. ProjectExplorer.BuildConfiguration.BuildStepList.1 corresponds to the “Clean Steps” section on the “Build Settings” dialog.

A BuildStepList has several steps: ProjectExplorer.BuildStepList.Step.0, ProjectExplorer.BuildStepList.Step.1, etc. When building a program, the BuildStepList usually includes two steps: qmake and make. When cleaning a project, the BuildStepList(ProjectExplorer.BuildConfiguration.BuildStepList.1) usually contains only one step: make(i.e. make clean).

A BuildConfiguration also has a Build Directory and build environment setting that you can set on the “Build Settings” dialog.

A target also has one or more(ProjectExplorer.Target.DeployConfigurationCount) deploy configurations: ProjectExplorer.Target.DeployConfiguration.0, ProjectExplorer.Target.DeployConfiguration.1, etc.

A target may have one or more(ProjectExplorer.Target.RunConfigurationCount) run configurations: ProjectExplorer.Target.RunConfiguration.0, ProjectExplorer.Target.RunConfiguration.1,etc.

The active deploy configuration # is ProjectExplorer.Target.ActiveDeployConfiguration, and the active run configuration # is ProjectExplorer.Target.ActiveRunConfiguration.

ProjectExplorer.Target.DeployConfiguration.x and ProjectExplorer.Target.RunConfiguration.x store the settings you set on Qt creator’s “Run Settings” dialog. You can go to that dialog by clicking “Projects”, clicking “Run” under one kit.

If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!
Posted in

Leave a Reply