[Development] Request for early MOC support for C++20 Modules

Kai Uwe Broulik kde at privat.broulik.de
Fri Dec 15 14:42:20 CET 2023


Hi,

 > On a related note, when moving a class to modules, it would be handy to
 > have a way to skip the 'Generate Missing Q_PROPERTY Members' boilerplate
 > code. My current classes are mostly 50% getter/setter boilerplate, and
 > in my opinion, this is only manageable because we split our code into
 > header and source files. This will be gone when using modules. So, I
 > would like to see something like *Q_PROP(QString text)*, that generates
 > default get/set/notify code, and if needed, one could still use the old
 > *Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged
 > FINAL)* if they need to add additional logic into the get/set functions.

Sounds like a job for a Q_SYNTHESIZE (modeled after Objective C’s 
@synthesize).

Cheers
Kai Uwe


More information about the Development mailing list