📜 ARCHIVED: This post is very old and the content likely outdated! It is here merely for future reference and to preserve any existing links.

Adding Subfolders in Qt Creator

Tuesday, 15 July, 2014

Organizing source code in hierachical subfolders is, in my humble opinion, a mandatory task for keeping code tidy, structured and comprehensible.

Due to this I was pretty astonished about Qt Creator’s lack of an intuitive procedure to create and display subfolders. I would have expected to find an option like “create subdirectory here” next to “Add New…” in the context menu of my project, but was disappointed.

A little research lead me to a stackoverflow thread with solutions to the aforementioned problem.

For moving an existing file into a subdirectory one has to create that subdirectory beforehand. Subsequently the file has to be renamed to subdirectory/file. When creating new files it is possible to specify a subdirectory the same way in the Header / Source file field.

Those are obviously not the most intuitive interactions that one could have thought of, but they get the job done.

I hope this may have been of help for someone out there.