[Qt-creator] add definition to .h ??
Cristian Tibirna
tibirna at kde.org
Mon Jun 11 02:27:46 CEST 2012
On Wednesday 06 June 2012 09:54:03 Leandro T. C. Melo wrote:
> On 06/06/2012 02:00 AM, ext Cristian Tibirna wrote:
> > (NOTE to moderator: this is a repost with a subscribed address, please
> > ignore the precedent that is queued for moderation)
> >
> > Hello
> >
> > Is this known behavior?
> >
> > In QtCreator resulted from compilation of git:3de4c3d I get this behavior:
> >
> > a) add a method definition in a .h either
> >
> > - simply put definition next to declaration
> > - make the method inline thus definition in .h required
> >
> > b) go to the declaration of another method and choose "Add definition
> > in..."
> >
> > It (only) offers to add the definition to the .h file (even if the .cc
> > exists and contains methods) and if I take the offer, it adds it
> > immediately after the method definition from a) (potentially rendering
> > the .h uncompilable).
> >
> > If I comment out the definition of a) the "Add definition in..." offers
> > the
> > .cc again.
> >
> > Known?
>
> Hi,
>
> I don't think so. I'd guess this is side effect from when the algorithm
> which finds the "best" insertion point was improved a while ago.
>
> What we do is to try to find the definition of the nearest declaration
> from the method you are triggering the quick fix. Then it seems the
> inline one is found in your case and therefore this behavior.
>
> I could not reproduce your issue when simply having void f() {} inside a
> class declaration with no inline members. Perhaps it happens to you
> because you still have such an inline function and no other declaration
> with the definition in the corresponding implementation file in between.
>
> If you could please fill a report...
FWIW, I can't reproduce this anymore (at least in a simple test project)
neither for local .h definitions present nor for inline .h definitions.
I will test again at work with the real-life thingie, but I guess it was a
temporary/freak fluke.
Thanks
--
Cristian Tibirna
KDE developer .. tibirna at kde.org .. http://www.kde.org
More information about the Qt-creator
mailing list