Search code examples
ideqt-creator

How to add files to a project?


I can add headers to the header path but how can I bring in external headers to be available within Qt Creator for editing in project, so they appear in the file list like other headers created from scratch?

In Xcode, you could just drag files into the project, they'd be copied into the project directory and appear in the IDE for editing.

I'd assume you could do this in Qt Creator but I can't find any way to do so.


Solution

  • Use qmake - project from the command line in the directory containing the files and they will generate a .pro and you can copy that into a .pri and then include the .pri in your project, thus allowing you to access and edit the files from within Creator but segregating them nicely should you choose to use those files in other projects as well, but maintaining a single set of build and qmake settings.