[Development] Property bindings in Qt 6

Olivier Goffart olivier at woboq.com
Thu Sep 26 22:43:23 CEST 2019


On 26.09.19 18:22, Julien Cugnière wrote:
> Le jeu. 26 sept. 2019 à 17:03, Simon Hausmann <Simon.Hausmann at qt.io> a écrit :
>> I would like to propose an API that replaces the setter and getter functions on objects with a new property template class that encapsulates the property value instead, and the ability to tie binding expressions to these properties for automatic updates. In short, it looks like this:
> 
> Hello Simon,
> 
> As a user, I find this project very interesting, as after learning
> QML, I often found myself wanting to use some kind of binding system
> when coding in C++.
> 
> One question that comes to mind when you mention lazy evaluation: how
> does this interact with the "onPropertyChanged" signal? In QML, one
> sometimes sees code like :
> 
>      onFullnameChanged: {
>          console.log("the fullname changed!");
>          foo.bar();
>      }
> 
> At first glance, this doesn't seem compatible with lazy evaluation.

This is possible too. (see the onPropertyChange, in Simon's Patch.)
When you have a change handler on a property, you indeed need to re-evaluate 
that property.



More information about the Development mailing list