[Qt-creator] Have Locate... provide all files in a CMake project

Andreas Pakulat apaku at gmx.de
Fri Jan 9 16:30:54 CET 2015


Hi,

On Fri, Jan 9, 2015 at 1:38 PM, Ziller Eike <Eike.Ziller at theqtcompany.com>
wrote:

>
> > On Jan 9, 2015, at 12:57 PM, Andreas Pakulat <apaku at gmx.de> wrote:
> >
> > I'm working with qtcreator on a cmake-based project that has plenty of
> conditionally-included source files in the CMakeLists.txt. That is various
> files are only included when building on mac or win32. Hence these files do
> not end up in the generated codeblocks project file.
> >
> > It seems QtCreator bases its 'files in project' locator solely on this
> list of files from the codeblocks file and I'm wondering wether there's an
> easy way to make it consider all files that are part of the git repository
> or at least all files in directories it has in the projects tree.
> >
> > Even though I don't want to and cannot edit these files since I cannot
> compile them I regularly read them to check certain things and having to
> switch to another machine just for that would be quite annoying. Similarly
> annoying is to have to use the normal file-open dialog to open these after
> having opened another file in that directory and that does not work at all
> if a whole subdir is disabled on my platform in cmake.
>
> Since we do not parse the cmake files ourselves, Qt Creator only knows
> about the files in the project that are used by the configuration that you
> use to run cmake to generate the codeblocks project file.
>
> Please note that the base directory for the “Files in File System (f)”
> locator filter is the directory of the current editor. That is something
> that I use very often.
>
> You can also create your own filter that provides all files from some
> directory tree(s)
>
> http://doc.qt.io/qtcreator/creator-editor-locator.html#creating-locator-filters
> though these use a static list of directories and are saved globally.
> (Possibly it would make sense to have them optionally saved in the session
> instead.)
>
> A filter that provides access to all included files from all C++ files in
> your projects, even if they are not listed in any project, is also in the
> works
> (https://codereview.qt-project.org/101408) but that will not solve your
> problem for files that belong to a different configuration.
>

Yeah, I'm using the fact that Ctrl+O uses the editor's directory as base as
well. So thats my workaround for now for files in a directory thats known
to cmake already.

It would be nice if the 'Projects' view data model had a switch to either
consider all vcs-known files in addition to what the projects buildsystem
provided (like the generic-project setup) or a mode where it considers
everything in the projects directory to be part of the project. I can see
how the latter would be an issue for projects building in-source or using
special subdirs for their build output, so it would have to be optional I
guess.

Maybe I should check with the cmake list wether there are ways to customize
what ends up in the codeblocks file without having to try to build those
sources similar to how the VS-generator provides some special things to
configure the look of the project in the IDE.

It seems having a custom filter for the project directory could work,
though refreshing it is a little cumbersome (would be nice if that would be
hooked up with filesystem-watcher).

Either way, thanks for confirming that I didn't just overlook something
obvious.

Andreas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20150109/18d8cb3a/attachment.html>


More information about the Qt-creator mailing list