How to create a subdirectory for a project QtCreat

2019-01-16 08:55发布

I would like to divide my Qt project into several directories because it is growing pretty large. However, when I click on browse in QtCreator, there is no 'Add directory' and no such thing in 'Add new'. Can this be done somehow?

8条回答
做个烂人
2楼-- · 2019-01-16 09:28

Just had the same issue, and found out a relatively simple answer.

All you need to do to move file.cpp to newFolder is to rename the file (right click -> Rename) to newFolder\file.cpp.

Qt Creator will move it to the new folder and automatically update the .pro file.

查看更多
可以哭但决不认输i
3楼-- · 2019-01-16 09:29

It only seems to be impossible to create sub-directories in QT-CREATOR.

Try the following:

  1. Create a number of sub-directories, with a file-explorer or by command line within the project-folder (for example net/, gui/, test/, data/ ...)!
  2. Move exisiting files into these new folders. And change their paths within the *.proj file!
  3. Create new also files from beginning within the new folders (By AddNew...)!

... QT-CREATOR displays only such folders which contain files that are written with their names into the *.pro or a *.pri file. At root level QT-CREATOR distinguishes between HEADERS, SOURCES, FORMS and OTHER FILES. Within these root folders you can find project-own subfolders, repeatedly. (Not covered in this text is splitting into sub-projects.)

查看更多
登录 后发表回答