Search code examples
qtqt-creatorqmake

How to create a subdirectory for a project QtCreator?


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?


Solution

  • One method you could use is to add a project include file for each sub directory.

    Qt Creator displays these in the GUI in a nested fashion, and allows you to add files to them.

    e.g.

    in project.pro

    include(folder1/include.pri)
    

    in folder1/include.pri

    HEADERS += MyClass.h
    SOURCES += MyClass.cpp
    

    etc