如何在 Qt Creator 的项目设置中使用多用户的版本控制? [英] How to use version control with Qt Creator's project settings with many users?

查看:112
本文介绍了如何在 Qt Creator 的项目设置中使用多用户的版本控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当在qmake项目中使用Qt Creator时,比方说example.pro,那么Qt Creator自己的配置通常存储在example.pro.user文件.但是这个文件包含用户特定的设置,所以如果有很多人在做这个项目,把它提交到共享版本控制存储库不是一个好主意.不过,该文件通常包含复杂的部署和环境变量设置,最好将这些设置存储到版本控制中.

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.

有没有办法在版本控制中存储个人项目特定的 Qt Creator 设置,并以其他方式共享它们,这样不同开发者的设置就不会混淆?

推荐答案

您可以使用 QTC_EXTENSION 环境变量.所以如果你通常有

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

example.pro.user

然后有环境变量

QTC_EXTENSION=foobar

当您启动 Qt Creater 时,它会改为使用文件

When you launch Qt Creater will instead make it use file

example.pro.foobar

我不确定它是否被记录在任何地方,但它是在 此源文件(2015 年 5 月更新),至少自 2011 年以来一直存在.

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.

要为新用户克隆设置,只需将设置文件复制到新名称,然后将环境变量设置为与您想要的匹配.但是,除了手动复制粘贴(同时打开两个 Qt Creator,或以文本形式打开 XML 文件)之外,我不知道在此之后合并更改的简单方法.

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).

然后还有一种方法是通过手动创建example.pro.shared 文件来共享设置(可使用QTC_SHARED_EXTENSION 环境变量进行配置,与用户特定设置的方式相同).它通常是通过复制一个 .pro.user 文件然后编辑它以删除非共享部分来创建的,如文档 此处(2015 年 5 月更新).

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).

这篇关于如何在 Qt Creator 的项目设置中使用多用户的版本控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆