Solved Hot to organize the project in diferent folders
-
I've done it before but after long years without using Qt, I no longer remember how to do it.
How do I organize project files in separate folders? I want to create a directory division like MVC patern.
Qt Creator doesn't do this, it keeps all files in the same directory.
I remember that this involves some configuration in the .pro file for Qt Creator to display the folders created with their respective files.Models |___anyfileaboutmodel.cpp |___anyfileaboutmodel.hpp Views |___anyfileaboutview.cpp |___anyfileaboutview.hpp controls |___anyfileaboutcontrol.cpp |___anyfileaboutcontrol.hpp dal |___anyfileaboutdataacces.cpp |___anyfileaboutdataacces.hpp res |___anyresourcefile
-
In that case, just create the folders in your project folder and in your .pro file:
SOURCES += \ $$PWD/controls/anyfileaboutcontol.cpp
or alternatively you can add a .pri file per subfolder that you will include in your main .pro file.
-
Hi,
Do you mean you just want to have your classes in different sub folders or are these different sub projects ?
-
@SGaist said in Hot to organize the project in diferent folders:
Hi,
Do you mean you just want to have your classes in different sub folders or are these different sub projects ?As in this case it is a single executable, so it is the first option.
I will need to create sub-projects too but this is another time.
In addition to classes I also want to place resource files in a folder called res or resources. -
In that case, just create the folders in your project folder and in your .pro file:
SOURCES += \ $$PWD/controls/anyfileaboutcontol.cpp
or alternatively you can add a .pri file per subfolder that you will include in your main .pro file.