[Interest] QtProperty System

André Somers andre at familiesomers.nl
Fri Feb 21 12:50:51 CET 2014


Bo Thorsen schreef op 21-2-2014 12:33:
> Den 21-02-2014 09:01, Graham Labdon skrev:
>> Hi
>> I have been reading about Qt's property system, in particular the NOTIFY optional specifier.
>> Can NOTIFY be used with non Qml/QtQuick applications?
> You can, but it doesn't do anything unless you code this yourself. The
> NOTIFY just tells the introspection what signal is used to notify
> changes. Unless you use this information for something yourself, it is
> useless.
>
> QML uses this to update the bindings. You can do something similar yourself.
>
>
I always consider Qt properties as mostly a conceptual bundeling of a 
set of related methods. You conceptually bind together a number of 
methods that read, write, reset or notify on changes of a value. That 
bundling may be used to do tricks like QML bindings or implement things 
like property editors via introspection, but for me, in its core, it is 
mainly a tool that expresses such conceptual relations between methods 
in the syntax. Just seeing a Q_PROPERTY specified like that, will tell 
any user of your code (including you yourself in a year from now) about 
the relations the methods in it have and what they are for, thus making 
your code easier to understand.

André




More information about the Interest mailing list