[Development] Property bindings in Qt 6
edward.welbourne at qt.io
Mon Sep 30 10:41:34 CEST 2019
On 26 Sep 2019, at 17:44, Simon Hausmann <Simon.Hausmann at qt.io> wrote:
>>> 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.
On 26. Sep 2019, at 18:14, Shawn Rutledge <Shawn.Rutledge at qt.io> wrote:
>> Override operator= maybe?
>> But it might be interesting to have a proper way of signalling errors
>> when a setter fails, instead of having to just use qWarning and hope
>> the developer notices.
Simon Hausmann (28 September 2019 08:37) replied:
> That’s a neat idea!:)
> It may require additional tricks to emphasize compatibility with the
> underlying type, but with a bit of luck that’s limited to qml.
> Regarding failing setters: Is there another language/ environment
> where you have seen this before?
> The only one I can think of off the top of my head would be that
Same in python; a class's __setattr__(key, value) can do anything it
likes, including raising an exception.
More information about the Development