Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use version control with Qt Creator's project settings with many users?

When using Qt Creator with qmake projects, let's say example.pro, then Qt Creator's own configuration is normally stored in example.pro.user file. But this file contains user-specific settings, so if many people are working on the project, it is not a good idea to commit it to shared version control repository. Still, this file often contains complex settings for deployment and environment variables, and it would be very good to store these to version control.

Is there a way to store personal project specific Qt Creator settings in version control, and otherwise share them, so that settings of different developers do not get mixed up?

like image 630
hyde Avatar asked Oct 11 '13 07:10

hyde


1 Answers

You can use QTC_EXTENSION environment variable. So if you normally have

example.pro.user

Then having environment variable

QTC_EXTENSION=foobar

When you launch Qt Creater will instead make it use file

example.pro.foobar

I'm not sure if it is documented anywhere, but it is implemented in this source file (updated May 2015) and has been around since 2011 at least.

To clone settings for new user, simply copy a settings file to a new name, and set the environment variable to match the one you want. However, I don't know of an easy way to merge changes after that, other than manually copy-pasting (either with two Qt Creators open at the same time, or by opening the XML files as text).


Then there is also a way to share settings by manually creating example.pro.shared file (configurable with QTC_SHARED_EXTENSION environment variable, same way as user specific settings). It is usually created by copying a .pro.user file and then editing it to remove non-shared parts, as documented here (updated May 2015).

like image 78
hyde Avatar answered Sep 28 '22 06:09

hyde