Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-generate setters/getters with QTCreator?

Tags:

c++

qt

qt-creator

Despite some searchs, I wasn't able to find a way to auto-generate getters and setters for a C++ class, using QT Creator 2.3.1. Would you guys know some way to do so ?

like image 439
merours Avatar asked Nov 01 '13 14:11

merours


People also ask

What is getter and setter in laravel?

this->attributes['last_name']; } } The above Model which has function setPasswordAttribute will save the password with bcrypted value (which is basically called Setters or Mutators), And the function getFullNameAttribute will append first name and last name retrived from database (which is called Getters or Accessors)


2 Answers

Do a right click on your member then Refactor then Generate Getter and Setter member function and you're done :)

example


On Qt Creator 3.2.x, create the member, then click on it and press alt+Enter :

enter image description here

like image 112
Thomas Ayoub Avatar answered Oct 21 '22 21:10

Thomas Ayoub


Position your text cursor at the member variable in class definition, then hit Alt+Enter.

like image 21
yzn-pku Avatar answered Oct 21 '22 21:10

yzn-pku