I've now started to dabble with Qt and I was wondering if there was a way to get Qt Creator to automatically add variables to the project file. For example, I usually use C++11 code so it would be nice if Qt could put CONFIG += c++11
in the .pro file automatically when I start a new project. I looked around in the options but I can't make sense of some sections so maybe it's right in front of my face?
Asked
Active
Viewed 1,329 times
7

Nejat
- 31,784
- 12
- 106
- 138

Emuser3616399
- 127
- 7
1 Answers
5
You can edit the wizard files of Qt Creator. The files are in the following directory:
Qt-Dir/Tools/QtCreator/share/qtcreator/templates/wizards/
If you look at the directory there are some folders related to different wizards. For example if you look in to the "plaincppapp/qmake" folder, there you can see a "project.pro" file which is a template pro file. You can just edit that file like:
TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
CONFIG += C++11 #added this line
SOURCES += main.cpp
Next time you create a project by that wizard, your custom pro would be created for the project.

Nejat
- 31,784
- 12
- 106
- 138
-
But what @user3616399 is asking for is a way to **put those things automatically in the .pro file**. Wouldn' it be nice to do this automatically? ;) http://stackoverflow.com/questions/23672093/project-variables-and-configuration-in-qtcreator-custom-wizards – Яois May 15 '14 at 08:00
-
3@KeillRandor This will also put the things automatically as you are modifying the wizard. – Nejat May 15 '14 at 08:03
-
3I just asked a slightly different question, directly addressing custom wizards for the same purpose. You kind of answer it in this thread (thank you!!), but If you want you can leave an answer in the other post as well. – Яois May 15 '14 at 08:17