[Development] Proposing QUIP 22: Define Rules for Q_PROPERTYs in Qt

Ulf Hermann ulf.hermann at qt.io
Wed Feb 14 11:35:08 CET 2024


Hi,

we cannot retroactively make properties FINAL as that can be source 
incompatible in QML. However, FINAL properties result in a significant 
performance boost for QML. qmlcachegen, if it can prove that a property 
you use in your code is actually the property it expects, does not have 
to wrap it in QVariant and type-check it at run time. You may want to 
read 
https://www.qt.io/blog/qt-6.6-and-6.7-make-qml-faster-than-ever-a-new-benchmark-and-analysis 
and compare the numbers for "Shadowable" and "Static" in the graph. 
qmlsc has an extra (dangerous) argument "static" that makes it treat all 
properties as FINAL. If you make your properties FINAL to begin with, 
you get the same benefit without qmlsc and the extra argument.

So here is my proposal for QUIP 22: 
https://codereview.qt-project.org/c/meta/quips/+/539986

I've thrown in rules for BINDABLE and REVISION there, too. Those also 
come up quite frequently.

best regards,
Ulf


More information about the Development mailing list