Hi Eric, No problem ;-) this functionality was developed by Nicolas in separate plugin: http://gitorious.org/creator-plugins
I think, this more clean way. Also, it can be developed/tested/used independ of main Qt Creator development. I think that this comments will be interesting for Nicolas also. But, thanks for comments, I will remember its :-) В Mon, 1 Mar 2010 17:59:38 +0100 <[email protected]> пишет: EVC> Hello Alexander, EVC> EVC> On Feb 21, 2010, at 9:16 , ext Alexander 'hatred' Drozdoff wrote: EVC> EVC> > Hi all, EVC> > EVC> > I prepare patch that may be helpful in development process. EVC> > EVC> > With this patch you can go to Header file, write function prototype (or method prototype in EVC> > class definition), press Shift-F2 (or press Right mouse button on prototype and select item EVC> > "Switch between Method Declaration/Definition"), in case when definition does not present, EVC> > you can see message box: Implementation does not found. Will I try to create it? [Yes/No] EVC> > If you answer Yes, template of method will created and you moved to it. EVC> EVC> I am afraid I will have to reject this patch, for the following two reasons: EVC> EVC> First, it iterates over all files in the project. This might lead to iterating over a lot of EVC> files (4810 when I have Creator loaded), and might very well find the wrong one if one of them EVC> just happens to include the header file. Now in C++ it is actually allowed to put the method EVC> in any file which gets linked into the target (or nowhere if it is never used), but a good EVC> heuristic might be to first search for the file where the constructor is defined. Or if none EVC> is declared, to find the first preceding or following symbol declaration (not definition) and EVC> go to the file where it is defined. (And then I am ignoring the cases where you might want to EVC> define them inline in the header file, but outside the class.) EVC> EVC> The second reason is that it does not take namespaces into account, but appends it to the end EVC> of the file. A typical (easy) use-case is when a user uses the new-class-wizard and enters EVC> "MyNamespace::MyClass" as the class name. This will result in a namespace in the .cpp file, EVC> which, by default, closes at the end of the file. So the definition will incorrectly end up EVC> outside the namespace. EVC> EVC> Now this last one is actually the reason why we did not implement this yet. And getter/setter EVC> generation has the same "exciting" (corner-)cases. For example, if somebody puts a EVC> struct/class/enum declaration inside a class, code generation for the definitions would not EVC> only have to check for "using namespace" and truncate the types accordingly, but also the EVC> other way around: it might need to add qualifiers to types (but obviously not too many of EVC> them). It is definitely solvable, but be prepared to fix lots of corner cases. EVC> EVC> Regards, EVC> Erik. -- WBR Alexander Drozdov _______________________________________________ Qt-creator mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-creator
