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?
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.
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 .
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.
Nowadays you can just right click on project name and select Add existing directory
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With