At first glance qt creator seems to be a feature rich ide however it still lacks many basic features such as being able to add sub folders for code to projects through the project explorer window. The following tutorial demonstrates how to get around the ide limitation by adding the folders manually.
The goal is to achive the below folder strucutre, project being the root, and “ModuleA” being the folder we need to add.
1 2 3 4 5 6 7 |
|
Start by navigating to the projects root directory, and create a new folder:
1
|
|
Create a new file inside named “modulea.pri”. If you are going to copy existing files into this new folder you need to add them to the pri file. (Adding new files can be done through the qt creator gui once the project is configured properly)
Note the path names must be relative from the project root
1 2 3 4 5 |
|
Now we need to include the new .pri file for the folder in the project configuration. Open up the .pro file located in the project root directory and add the following line:
1
|
|
Reload the project, the new ModuleA folder should now be visible as a subfolder in your main project. Right clicking on it will give you the option to add new files. Simply repeat the above process for each new sub folder you wish to add.