Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
921 views
in Technique[技术] by (71.8m points)

qt - Use of variables like %{buildDir} in QtCreator kit settings in Qt5

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

enter image description here

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

Secondary questions:

  • 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?

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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!

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:

  • Tools (menu) --> Options --> Environment (tab) --> External Tools
  • Click "Update Translations..."
  • Click inside "Working Directory.." and you should see a "AB->" icon in colour to the right.
  • Click the icon for your list of vars.

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

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

Here are the screen shots... Notice in screen shot 1 the little icon at the right side of "Working Directory" text-edit box.

enter image description here

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...