Getter/Setter generation

Milian Wolff mail at
Thu Oct 1 13:30:08 BST 2015

On Dienstag, 29. September 2015 09:00:36 CEST Felix Mauch wrote:
> Hey there,
> I've been using QtCreator for a while now and recently switched to
> KDevelop because of its awesome code navigation and its ability to
> change the UI to my needs.
> However, I was shocked when I didn't find a way to automatically create
> getter and setter methods (in C++). Did I just miss it or does this
> feature not exist?
> I found an old review request on
> which seems like it never got
> merged.
> Is there any way I can achieve this? Otherwise I guess, I should try to
> implement something myself...
> Personally I'd prefer a refactoring-entry: "Create Get- and Set-methods"
> in the context menu over a full blown GUI for this purpose. Maybe that's
> doable via a lightweigt plugin?

It really isn't implemented yet, and I totally agree that we should come up 
with a solution here. The existing patches we got where always far too dialog 
centric and - imo - got too much into the way.

What I'd love to see is someone taking our feedback into account and creating 
a new solution. Something like:

- detect that there is a member called m_foo
- during code completion in the header, offer to add a getter/setter for foo 
when it's not there yet
- outside the class, we can reuse the existing "implement function" code to 
then create the declaration.

That sounds doable to me, and is much better than having a complicated dialog 
which you need to open in order to create a getter/setter.

It would be sufficient to add a simple implementation first, and then later 
add per-project config options that allow you to specify the style of the 
getter/setter. I.e. prefixes, suffixes, return style, ...

Milian Wolff
mail at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the KDevelop mailing list