在Qt5的QtCreator套件设置中使用像%{buildDir}这样的变量 [英] Use of variables like %{buildDir} in QtCreator kit settings in Qt5
问题描述
在本文档中(在将自定义可执行文件指定为运行"),我注意到在工作目录"字段中提到了一个变量%{buildDir}
.
In this documentation (under section "Specifying a Custom Executable to Run") I noticed that there is mention of what looks like a variable %{buildDir}
in the field "Working directory".
我已经为寻找该功能的文档而苦苦挣扎了一段时间.我想首先了解在某处是否有此文档?.
I have struggled for a while now to find documentation for this feature. I would like to know first of all is there documentation for this somewhere?.
次要问题:
- 还有哪些其他变量?
- 可以在哪些字段中使用它们?
- 我可以访问在项目的
.pro
文件中创建的变量吗? - 还有其他评估功能吗?还是这种机制仅限于变量?
- What other variables are available?
- In which fields can they be used?
- Can I access variables that I created in my project's
.pro
file? - Are there any other eval features or is this mechanism limited to variables?
谢谢!
推荐答案
如注释中所述,有一个变量"按钮……据说可以在整个qt环境中使用.但是我只发现它在不太有用的不起眼的地方可用!
As mentioned in the comments there is a "variables" button... supposedly for use all over the qt environment. However I have only found it available in obscure places that are not very useful!
但是,您至少可以从这些位置获取var列表,并在实际需要它们的地方使用它们.要找到它,请导航至:
However, you can at least get the list of vars from these places and use them where you actually need them. To find this, navigate to:
- 工具(菜单)->选项->环境(标签)->外部工具
- 点击更新翻译..."
- 在工作目录.."内部单击,您应该在右侧看到一个带有颜色的"AB->"图标.
- 单击图标以显示您的变量列表.
您会注意到样式与%{BuildDir}
略有不同,但我相信等同于%{CurrentProject:BuildPath}
-您可以在第二个我右键单击的屏幕快照中看到它,它询问您要插入的内容(变量或变量的值).
You will notice that the style is a little different then %{BuildDir}
but I believe the equivalent is %{CurrentProject:BuildPath}
- You can see on the second screen shot I have right clicked and it asks you what you want to insert (the variable, or the value of the variable).
令人讨厌的是,我无法弄清楚如何复制/粘贴整个列表,因为它只是单行单击……也许更聪明的人可以弄清楚这一点,我们可以将该列表粘贴在一些Qt Wiki中:o
Annoyingly I could not figure out how to copy / paste the whole list as it is single line click only... maybe someone more clever can figure that out and we can stick that list in some Qt wiki :o
以下是屏幕截图...请注意,在屏幕截图1中,工作目录"文本编辑框右侧的小图标.
Here are the screen shots... Notice in screen shot 1 the little icon at the right side of "Working Directory" text-edit box.
这篇关于在Qt5的QtCreator套件设置中使用像%{buildDir}这样的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!