Solved Project hierarchy with subfolders
-
hello!
when I create new project, I don't have subfolders such as header, source and form folders for my project files. all my files are located at one folder (project folder).
How can I change the organization of project files?this is part of my .pro file
SOURCES += \ album.cpp \ pictures.cpp \ databasemanager.cpp \ albumdao.cpp HEADERS += \ album.h \ gallery-core_global.h \ pictures.h \ databasemanager.h \ albumdao.h
and this is screen shot of the project hierarchy:
thanks for help! :)
-
@YoniBE You can put your files in subdirectories and edit the pro file to reflect these changes:
SOURCES += \ somedir/album.cpp \ somedir/pictures.cpp \ somedir/databasemanager.cpp \ somedir/albumdao.cpp HEADERS += \ someotherdir/album.h \ someotherdir/gallery-core_global.h \ someotherdir/pictures.h \ someotherdir/databasemanager.h \ someotherdir/albumdao.h
-
to add to @jsulm
if you include files from an other directory you'll have to adjust the include statement:
#include "someotherdir/pictures.h"
or add the directory to your Includepath in your *pro file
INCLUDEPATH +=$$PWD/someotherdir
-
@jsulm @J-Hilk
Dosen't work..
I create new folder at the project folder named "sources", then I added to pro fileSOURCES += \ sources/album.cpp \ sources/pictures.cpp \ sources/databasemanager.cpp \ sources/albumdao.cpp
But I don't see any difference at the project hierarchy. I tried to create a new project and do the same but still I don't see any difference.
I remember that once it was automatically... like in visual studio -
@YoniBE You should run qmake after editing pro file
-
@jsulm
still, I don't see any differences.
this is the output of the qmake11:35:33: Running steps for project untitled... 11:35:33: Starting: "C:\Qt\5.11.1\msvc2017_64\bin\qmake.exe" "C:\Users\yonib\Documents\QT\Mastering QT\1\untitled\untitled.pro" -spec win32-msvc "CONFIG+=debug" "CONFIG+=qml_debug" 11:35:33: The process "C:\Qt\5.11.1\msvc2017_64\bin\qmake.exe" exited normally. 11:35:33: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe" qmake_all jom 1.1.2 - empower your cores 11:35:33: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited normally. 11:35:33: Elapsed time: 00:01.
-
slove it.
I changed the hierarchy view to file system view instead of project view and it worked.
Thanks!!