Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add an entire directory to a QT creator project

Tags:

qt

qt-creator

I have an existing QT Creator project. I want to add an entire directory to this project. I see that I can right click in the project file browser tree and "Add Existing Files..." However through this dialog box, I can only add individual files. How can I include an entire directory?

like image 759
tir38 Avatar asked Jun 11 '13 18:06

tir38


People also ask

How do I add a folder to Qt?

So you can see the 'Create Directory' button on the right side of the application. Once this button is pressed, a new directory is created according to the path specified in the line edit element. So the first thing you have to do is create a Qt widget application.

Where does Qt Creator store settings?

On macOS, the files are located in ~/. config/QtProject and ~/Library/Application Support/QtProject/Qt Creator . On Windows, the files are located in %appdata%\QtProject and %localappdata%\QtProject .

How do I create a subfolder in Qt?

you can add folders in your folders manager but they should contain a file, then go QT and right-click on your project then click on "add existing directory" and select your folder. if the folder is empty it's not going to show up. it's only based on what I've done yesterday, after missing around with it.


2 Answers

Nowadays you can just right click on project name and select Add existing directory

like image 178
532465747 Avatar answered Oct 03 '22 13:10

532465747


qmake provides a convenient files function for this very purpose. Adding the following line to your project file will add .cpp files inside the src/ directory:

SOURCES += $$files(src/*.cpp)

By default, this is non-recursive. Setting the second parameter to true recursively finds all files:

SOURCES += $$files(src/*.cpp, true)

The files function was introduced since Qt 5.10.

like image 26
TrebledJ Avatar answered Oct 03 '22 12:10

TrebledJ