How to remove files from a QtCreator project

Maybe a very newbie question, but I cannot find a way to delete files from my projects in QtCreator. Thanks!

+6
qt-creator
source share
6 answers

If your project was created from CMake, the list of files is determined by the CMakeLists.txt file, and you cannot add or delete files manually from the source tree in QtCreator. Especially if your CMakeLists file specifies a glob statement for the list of project files, you must manually delete the files from disk and re-run CMake from QtCreator by going to Build-> Run CMake (QtCreator 3.3.0). This will update the list of files, but will also restore the project file (cbp) - restarting CMake outside of QtCreator will not update the project file, and you will have ghostly records of deleted files displayed in the source tree if you deleted them from disk.

+6
source share

Right-click on the file you want to delete and select "Delete File ..."

Checking the "Delete file permanently" checkbox will delete the file, otherwise it will simply be deleted from the project.

+2
source share

Could not find a one-touch action, as in Eclipse, to remove a class:

1) Right-click on the file / class, and then select "delete file ..."; (u can mark "forever" to remove from the hard drive if you want).

2) Do this with .CPP and .H files.

3) Then check your .pro file that the class no longer exists.

Note. Some compilers will continue to search for this file / class in compilation. Just delete the compilation directory and compile again.

0
source share

If you mess up like me and accidentally add a lot of files to qml.qrc , this can help to find out that they are listed in the actual qml.qrc file, which you can edit to delete these files.

0
source share

just delete the project folder with hdd.

-one
source share

For Linux, edit the file ~ / .config / QtProject / QtCreator.ini

In [ProjectExplorer], delete the project name and its corresponding configuration file from the following two lists:

RecentProjects \ DisplayNames
RecentProjects \ FileNames

for example, given the following RecentProjects \ DisplayNames = proj1, proj2, proj3
RecentProjects \ FileNames = <proj1_dir> /CMakeLists.txt, <proj2_dir> /proj2.pro, <proj3_dir> /proj3.pro

to remove proj1 from the qtcreator start page, edit the above two lists as

RecentProjects \ DisplayNames = proj2, proj3
RecentProjects \ FileNames = <proj2_dir> /proj2.pro, <proj3_dir> /proj3.pro

-one
source share

All Articles