[Development] The future of QProperty and QBindable

Ulf Hermann ulf.hermann at qt.io
Fri Mar 7 13:37:09 CET 2025


> That neither does the change comparison, nor will it automatically notify about changes.
> You'd have to code both manually. I don't see a major improvement. Also, I guess this forces me to make the members public.
> Not really an alternative.

You don't need to make the members public. The moc-generated code can 
still access them if they're private. Correctly setting the value from 
C++ indeed requires some code this way, though. You can use 
setProperty("x", 14), but that is slow. In principle we could have moc 
generate code for the setter the same way it generates the signal 
implementation. In fact it already does generate such code, for the 
setProperty(), just in the wrong place. We'd need some syntax to 
instruct moc to generate the setter.

best regards,
Ulf


More information about the Development mailing list