Auto adding definition and mutator method
I was wondering if there is any way in the Creator to auto add the definition of methods in the .cpp, when I declare
the prototype in the .h or auto add getter and setter methods when I declare a member variable.
This features are a great improvement, but I’m still missing them in the Creator.
I would be happy if there is a way to get this features.
Thanks for the information.
I am not sure when this was introduced (before 2.1 feature freeze or afterwards): Add a method to a .h file, move cursor on the method name and hit Alt-Enter.
Not really obvious, I agree. The refactoring indicator is still missing in C++ files.
I am not aware about anything for the getter/setter methods though.
Andre: But then it would be too obvious:-)
Technically it is a C++ Quick Fix operation and we trigger those by Alt-Enter. There are more (like make a char array translatable, turn one into a QLatin1String, etc.), but as I said before: The indication when those can be triggered are still missing… which would make this really nice feature way more useful since people actually have a chance to find it.
Thats a nice idea, as far as i can affect the behavior of these methods.
Obviously. I was thinking about something like this:
- //not actual code, just an idea
- Q_PROPERTY (QString myString READ myString MEMBER m_myString GENERATED_WRITE setMyString GENERATED_NOTIFY myStringChanged)
The idea is that you specify the member variable to use, and that the macro can generate the getter, setter and/or the signal by using a different keyword than the standard READ and WRITE. In this case, the read method would not be generated, but the write and the signal would be.
Ok, but this approach would generate the most basic kind of getter and setter methods right ?
This is a nice way to save much time for basic member access.
IMHO it would be enough to generate the mutator methods. If I want to add more logic to these methods i guess that would be a good and easy to maintain approach.
Other IDEs already offer these features. The Creator is a fantastic piece of software but there are some nice features missing yet.
You guys are developers, so I am looking forward to your Merge Requests about those helpers;-)
Seriously: It is not that hard to write them, using the existing examples as a guide. http://qt.gitorious.org/qt-creator/qt-creator/blobs/master/src/plugins/cppeditor/cppquickfixes.cpp has most of the code of the existing ones.
Andre: We try to process MRs as fast as possible, but sometimes they do stall:-( The people doing the reviews are the developers that work on creator. Unfortunately we all are rather swamped with work… We try to keep up, but some MRs fall through the cracks, others are reviewed but awaiting action by the submitters. Gitorious does not send notification on updates to MRs, so sending a mail to the reviewer does help getting your MRs through the review faster.
Feel free to send me a message if you feel your MR did not get the attention it deserved. I’m happy to poke my coworkers;-)