[Development] Property bindings in Qt 6

Jason H jhihn at gmx.com
Thu Sep 26 18:09:54 CEST 2019

> Sent: Thursday, September 26, 2019 at 11:44 AM
> From: "Simon Hausmann" <Simon.Hausmann at qt.io>
> To: "Mitch Curtis" <mitch.curtis at qt.io>
> Cc: "development at qt-project.org" <development at qt-project.org>
> Subject: Re: [Development] Property bindings in Qt 6
> Hi,
> Yeah, custom setters are required.
> One option would be to say that such properties are implemented using the traditional property system altogether — bridging will be necessary anyway.
> Another option would be to implement what you described, perhaps in a more convenient way though.
> Simon

It looks pretty cool so far. Forgive me as I don't know the internals of QML as well as I should, but what about if you could set a std::function lambda as a custom setter, and if set that code runs? Or something similar?

QProperty<QString> firstname("John" /* to be set with custom setter*/, /* custom setter*/ [&]{ 
    value=md5sum(value); emit valueChanged(value) }

Or set it as a member function later, but that would be messy unless you had a subclass to always do it. 

Feel free to ignore any or all of this, just thinking out-loud.

More information about the Development mailing list