Discussion:
Refreshing the project tree
a***@fastmail.fm
2013-09-13 02:56:57 UTC
Permalink
Hello,

My team and I find it very convenient to use wildcards in defining
HEADERS and SOURCES:

HEADERS += $$files(*.h)
SOURCES += $$files(*.cpp)

Unfortunately, when we add a new header or source file, the Qt Creator
project tree needs to be manually refreshed to show the new file(s). I
usually do this by going to the .pro file, adding a space, deleting a
space and saving the file.

Is there a better/more "official" way of refreshing the project tree? I
looked through the Qt Creator menus and couldn't find anything. A way to
trigger a project tree refresh through a keyboard shortcut would be even
better.

Thanks!

Alfonso
André Pönitz
2013-09-13 18:10:45 UTC
Permalink
On Thu, Sep 12, 2013 at 07:56:57PM -0700, ***@fastmail.fm wrote:
> Hello,
>
> My team and I find it very convenient to use wildcards in defining
> HEADERS and SOURCES:
>
> HEADERS += $$files(*.h)
> SOURCES += $$files(*.cpp)
>
> Unfortunately, when we add a new header or source file, the Qt Creator
> project tree needs to be manually refreshed to show the new file(s). I
> usually do this by going to the .pro file, adding a space, deleting a
> space and saving the file.
>
> Is there a better/more "official" way of refreshing the project tree?

The official way is indeed to list the files explicitly, and not use the
glob facility.

> I looked through the Qt Creator menus and couldn't find anything. A way to
> trigger a project tree refresh through a keyboard shortcut would be even
> better.

Would explicitly running "Build->Run qmake" help?

Andre'
a***@fastmail.fm
2013-09-13 21:34:26 UTC
Permalink
Hi Andre,

Currently running qmake doesn't seem to update the project tree. If
running qmake did update it, that would be fine. I don't know if there
are other use cases where it may be desirable (or clearer) to have a
separate explicit "refresh project tree" button available.

One question related to the request of this functionality is if there is
some way one could trigger this refresh (either as a qmake call or as an
explicit "refresh project tree" operation) from the context of a Qt
Creator external tool. The use case for this is for updating the project
tree after a code generator has been run. The idea is for the developer
to modify a meta data file (in our case we use QML), trigger the code
generator through a Qt Creator external tool and then see the new files
in the project tree without having to do any extra work themselves.

How would one accomplish this? Is this possible?

Thanks,

Alfonso

On Fri, Sep 13, 2013, at 11:10 AM, André Pönitz wrote:
> On Thu, Sep 12, 2013 at 07:56:57PM -0700, ***@fastmail.fm wrote:
> > Hello,
> >
> > My team and I find it very convenient to use wildcards in defining
> > HEADERS and SOURCES:
> >
> > HEADERS += $$files(*.h)
> > SOURCES += $$files(*.cpp)
> >
> > Unfortunately, when we add a new header or source file, the Qt Creator
> > project tree needs to be manually refreshed to show the new file(s). I
> > usually do this by going to the .pro file, adding a space, deleting a
> > space and saving the file.
> >
> > Is there a better/more "official" way of refreshing the project tree?
>
> The official way is indeed to list the files explicitly, and not use the
> glob facility.
>
> > I looked through the Qt Creator menus and couldn't find anything. A way to
> > trigger a project tree refresh through a keyboard shortcut would be even
> > better.
>
> Would explicitly running "Build->Run qmake" help?
>
> Andre'
Hunger Tobias
2013-09-16 09:32:58 UTC
Permalink
> Currently running qmake doesn't seem to update the project tree. If
> running qmake did update it, that would be fine. I don't know if there
> are other use cases where it may be desirable (or clearer) to have a
> separate explicit "refresh project tree" button available.

That is correct: I am not aware of forcing a reparse short of touching a .pro file.

> One question related to the request of this functionality is if there is
> some way one could tri gger this refresh (either as a qmake call or as an
> explicit "refresh projecttree" operation) from the context of a Qt
> Creator external tool. The use case for this is for updating the project
> tree after a code generator has been run. The idea is for the developer
> to modify a meta data file (in our case we use QML), trigger the code
> generator through a Qt Creator external tool and then see the new files
> in the project tree without having to do any extra work themselves.

That will touch the .pro/.pri files, won't it? That in turn will trigger a reparsing.

Or are you relying on wildcards here? That would be strange, considering that
you generate the code and could just add it to the .pro files while at it anyway.
But even with wildcards it should be trivial to just touch any .pro/.pri file.

Best Regards,
Tobias

--
Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
André Pönitz
2013-09-16 17:20:10 UTC
Permalink
On Mon, Sep 16, 2013 at 09:32:58AM +0000, Hunger Tobias wrote:
> > Currently running qmake doesn't seem to update the project tree. If
> > running qmake did update it, that would be fine. I don't know if there
> > are other use cases where it may be desirable (or clearer) to have a
> > separate explicit "refresh project tree" button available.
>
> That is correct: I am not aware of forcing a reparse short of touching a
> .pro file. [...]
> Or are you relying on wildcards here? That would be strange, considering
> that you generate the code and could just add it to the .pro files while
> at it anyway. But even with wildcards it should be trivial to just touch
> any .pro/.pri file.

Giving the discussion I wonder whether this should simply be forced
when running Build->Run qmake explicitly.

This should ease Alfonso's pain and not really hurt other uses.

Andre'
Orgad Shaneh
2013-09-16 18:03:38 UTC
Permalink
On Mon, Sep 16, 2013 at 8:20 PM, André Pönitz <
***@mathematik.tu-chemnitz.de> wrote:

> On Mon, Sep 16, 2013 at 09:32:58AM +0000, Hunger Tobias wrote:
> > > Currently running qmake doesn't seem to update the project tree. If
> > > running qmake did update it, that would be fine. I don't know if there
> > > are other use cases where it may be desirable (or clearer) to have a
> > > separate explicit "refresh project tree" button available.
> >
> > That is correct: I am not aware of forcing a reparse short of touching a
> > .pro file. [...]
> > Or are you relying on wildcards here? That would be strange, considering
> > that you generate the code and could just add it to the .pro files while
> > at it anyway. But even with wildcards it should be trivial to just touch
> > any .pro/.pri file.
>
> Giving the discussion I wonder whether this should simply be forced
> when running Build->Run qmake explicitly.
>
> This should ease Alfonso's pain and not really hurt other uses.
>
> I disagree. We have a project with thousands of files, and the
"Evaluating" phase takes at least 10-15 seconds (not to mention the
subsequent Parsing).

I wouldn't want to reparse the project every time I run qmake.

That said, it would be very useful for us as well to have an action for
reparsing the project. We use wildcards for source files as well as INI
files (in OTHER_FILES).

- Orgad
André Pönitz
2013-09-16 18:24:58 UTC
Permalink
On Mon, Sep 16, 2013 at 08:03:38PM +0200, Orgad Shaneh wrote:
> On Mon, Sep 16, 2013 at 8:20 PM, André Pönitz <
> ***@mathematik.tu-chemnitz.de> wrote:
>
> On Mon, Sep 16, 2013 at 09:32:58AM +0000, Hunger Tobias wrote:
> > > Currently running qmake doesn't seem to update the project tree. If
> > > running qmake did update it, that would be fine. I don't know if there
> > > are other use cases where it may be desirable (or clearer) to have a
> > > separate explicit "refresh project tree" button available.
> >
> > That is correct: I am not aware of forcing a reparse short of touching a
> > .pro file. [...]
> > Or are you relying on wildcards here? That would be strange, considering
> > that you generate the code and could just add it to the .pro files while
> > at it anyway.  But even with wildcards it should be trivial to just touch
> > any .pro/.pri file.
>
> Giving the discussion I wonder whether this should simply be forced
> when running Build->Run qmake explicitly.
>
> This should ease Alfonso's pain and not really hurt other uses.
>
>
> I disagree. We have a project with thousands of files, and the "Evaluating"
> phase takes at least 10-15 seconds (not to mention the subsequent Parsing).

How often do you manually trigger that action? (Serious question, I barely
use it, but then I regularly build from the command line)

> I wouldn't want to reparse the project every time I run qmake.
>
> That said, it would be very useful for us as well to have an action for
> reparsing the project. We use wildcards for source files as well as INI files
> (in OTHER_FILES).

A separate options sounds ok, too, it'd just looks like a bit of clutter in
a top-level menu for a rare use case.

What about yet another checkbox in the global Build&Run settings?

Andre'
a***@fastmail.fm
2013-09-17 02:59:16 UTC
Permalink
I ended up taking a previous suggestion and putting these auto-generated
files in a separate .pri file. This actually works quite well, as Qt
Creator seems to have some kind of file watcher on the .pri file and the
project tree gets updated almost immediately once this file changes.

For our use case at least, this approach seems to be acceptable.

Thanks for the suggestion,

Alfonso

On Mon, Sep 16, 2013, at 11:24 AM, André Pönitz wrote:
> On Mon, Sep 16, 2013 at 08:03:38PM +0200, Orgad Shaneh wrote:
> > On Mon, Sep 16, 2013 at 8:20 PM, André Pönitz <
> > ***@mathematik.tu-chemnitz.de> wrote:
> >
> > On Mon, Sep 16, 2013 at 09:32:58AM +0000, Hunger Tobias wrote:
> > > > Currently running qmake doesn't seem to update the project tree. If
> > > > running qmake did update it, that would be fine. I don't know if there
> > > > are other use cases where it may be desirable (or clearer) to have a
> > > > separate explicit "refresh project tree" button available.
> > >
> > > That is correct: I am not aware of forcing a reparse short of touching a
> > > .pro file. [...]
> > > Or are you relying on wildcards here? That would be strange, considering
> > > that you generate the code and could just add it to the .pro files while
> > > at it anyway.  But even with wildcards it should be trivial to just touch
> > > any .pro/.pri file.
> >
> > Giving the discussion I wonder whether this should simply be forced
> > when running Build->Run qmake explicitly.
> >
> > This should ease Alfonso's pain and not really hurt other uses.
> >
> >
> > I disagree. We have a project with thousands of files, and the "Evaluating"
> > phase takes at least 10-15 seconds (not to mention the subsequent Parsing).
>
> How often do you manually trigger that action? (Serious question, I
> barely
> use it, but then I regularly build from the command line)
>
> > I wouldn't want to reparse the project every time I run qmake.
> >
> > That said, it would be very useful for us as well to have an action for
> > reparsing the project. We use wildcards for source files as well as INI files
> > (in OTHER_FILES).
>
> A separate options sounds ok, too, it'd just looks like a bit of clutter
> in
> a top-level menu for a rare use case.
>
> What about yet another checkbox in the global Build&Run settings?
>
> Andre'
Orgad Shaneh
2013-09-17 08:46:43 UTC
Permalink
On Mon, Sep 16, 2013 at 9:24 PM, André Pönitz <
***@mathematik.tu-chemnitz.de> wrote:

> > Giving the discussion I wonder whether this should simply be forced
> > when running Build->Run qmake explicitly.
> >
> > This should ease Alfonso's pain and not really hurt other uses.
> >
> >
> > I disagree. We have a project with thousands of files, and the
> "Evaluating"
> > phase takes at least 10-15 seconds (not to mention the subsequent
> Parsing).
>
> How often do you manually trigger that action? (Serious question, I barely
> use it, but then I regularly build from the command line)


Actually not much. Still, it isn't intuitive.


> > I wouldn't want to reparse the project every time I run qmake.
> >
> > That said, it would be very useful for us as well to have an action for
> > reparsing the project. We use wildcards for source files as well as INI
> files
> > (in OTHER_FILES).
>
> A separate options sounds ok, too, it'd just looks like a bit of clutter in
> a top-level menu for a rare use case.
>
> What about yet another checkbox in the global Build&Run settings?
>

That will do what? Add the menu entry?

Might it be possible to detect wildcards then use a filesystemwatcher for
the relevant directories? Sounds reasonable for qmake projects, harder for
qbs projects (which may contains **/*)

- Orgad
Ziller Eike
2013-09-23 15:05:18 UTC
Permalink
On 16.09.2013, at 19:20, André Pönitz <***@mathematik.tu-chemnitz.de> wrote:

> On Mon, Sep 16, 2013 at 09:32:58AM +0000, Hunger Tobias wrote:
>>> Currently running qmake doesn't seem to update the project tree. If
>>> running qmake did update it, that would be fine. I don't know if there
>>> are other use cases where it may be desirable (or clearer) to have a
>>> separate explicit "refresh project tree" button available.
>>
>> That is correct: I am not aware of forcing a reparse short of touching a
>> .pro file. [...]
>> Or are you relying on wildcards here? That would be strange, considering
>> that you generate the code and could just add it to the .pro files while
>> at it anyway. But even with wildcards it should be trivial to just touch
>> any .pro/.pri file.
>
> Giving the discussion I wonder whether this should simply be forced
> when running Build->Run qmake explicitly.
>
> This should ease Alfonso's pain and not really hurt other uses.


Why not simply a "refresh project tree" item in the project's context menu? That shouldn't hurt anyone either and would actually be explicit, not a magic side effect of something that also does a whole lot more (like generating files in the build directory).

Br, Eike

--
Eike Ziller, Senior Software Engineer - Digia, Qt

Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Anja Wasenius
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
André Pönitz
2013-09-23 20:33:49 UTC
Permalink
On Mon, Sep 23, 2013 at 03:05:18PM +0000, Ziller Eike wrote:
>
> On 16.09.2013, at 19:20, André Pönitz
> <***@mathematik.tu-chemnitz.de> wrote:
>
> > On Mon, Sep 16, 2013 at 09:32:58AM +0000, Hunger Tobias wrote:
> >>> Currently running qmake doesn't seem to update the project tree. If
> >>> running qmake did update it, that would be fine. I don't know if
> >>> there are other use cases where it may be desirable (or clearer) to
> >>> have a separate explicit "refresh project tree" button available.
> >>
> >> That is correct: I am not aware of forcing a reparse short of touching
> >> a .pro file. [...] Or are you relying on wildcards here? That would be
> >> strange, considering that you generate the code and could just add it
> >> to the .pro files while at it anyway. But even with wildcards it
> >> should be trivial to just touch any .pro/.pri file.
> >
> > Giving the discussion I wonder whether this should simply be forced
> > when running Build->Run qmake explicitly.
> >
> > This should ease Alfonso's pain and not really hurt other uses.
>
>
> Why not simply a "refresh project tree" item in the project's context
> menu? That shouldn't hurt anyone either and would actually be explicit,
> not a magic side effect of something that also does a whole lot more
> (like generating files in the build directory).

Sounds good to me.

Andre'
a***@fastmail.fm
2013-09-23 21:48:00 UTC
Permalink
That would be a great feature (if possible, please make sure this action
can be assigned to a keyboard shortcut :).

Thanks,

-Alfonso

On Mon, Sep 23, 2013, at 01:33 PM, André Pönitz wrote:
> On Mon, Sep 23, 2013 at 03:05:18PM +0000, Ziller Eike wrote:
> >
> > On 16.09.2013, at 19:20, André Pönitz
> > <***@mathematik.tu-chemnitz.de> wrote:
> >
> > > On Mon, Sep 16, 2013 at 09:32:58AM +0000, Hunger Tobias wrote:
> > >>> Currently running qmake doesn't seem to update the project tree. If
> > >>> running qmake did update it, that would be fine. I don't know if
> > >>> there are other use cases where it may be desirable (or clearer) to
> > >>> have a separate explicit "refresh project tree" button available.
> > >>
> > >> That is correct: I am not aware of forcing a reparse short of touching
> > >> a .pro file. [...] Or are you relying on wildcards here? That would be
> > >> strange, considering that you generate the code and could just add it
> > >> to the .pro files while at it anyway. But even with wildcards it
> > >> should be trivial to just touch any .pro/.pri file.
> > >
> > > Giving the discussion I wonder whether this should simply be forced
> > > when running Build->Run qmake explicitly.
> > >
> > > This should ease Alfonso's pain and not really hurt other uses.
> >
> >
> > Why not simply a "refresh project tree" item in the project's context
> > menu? That shouldn't hurt anyone either and would actually be explicit,
> > not a magic side effect of something that also does a whole lot more
> > (like generating files in the build directory).
>
> Sounds good to me.
>
> Andre'
Continue reading on narkive:
Loading...