[Development] Why don't we have notify signal for all of the properties?
andre at familiesomers.nl
Fri Jul 6 13:56:00 CEST 2012
Op 6-7-2012 13:30, Olivier Goffart schreef:
> On Friday 06 July 2012 13:02:16 André Somers wrote:
>> Op 6-7-2012 12:45, Tr3wory schreef:
>>> Hi all!
>>> I found the QML's property binding system really powerful, but as far
>>> as I understand on the C++ side it relies on the property's NOTIFY
>>> I know the notify signal is added around Qt 4.6, and as far as I
>>> understand we couldn't add more signals to existing properties in the
>>> 4.x timeframe because of the binary compatibility. (Please correct me
>>> if I'm wrong about this.)
> As already pointed out, adding NOTIFY signal is not binary incompatible. Feel
> free to submit patches that add them :-)
>> I'm curious what other signals you see room for? I can't think of other
>> useful signals in the contect of a property.
>> What I *would* like, is to have a mechanism of having additional
>> attributes for properties. That would make creating property-editor like
>> interfaces much easier. However, I am not sure if extending this is all
>> that useful for the majority of uses of Qt.
> There is already quite a lot of possible attributes.
> What others attribute do you need?
I guess I misunderstood the OP. I had the impression he wanted to add
more signals than the one NOTIFY signal _per property_.
Adding other attributes I already brought up at QtCS last year. It was
in the context of a property-editor like interface that I was using, and
that needed additional attributes to function well. In that context, I
ended up adding a set of attributes:
and, for use with an FileName editor:
These are far to specific to add directly, but it would be useful were
it possible to attach an 'attribute bag' to a property somehow. What I
did, was use the dynamic property method. If I wanted to add attributes
to a property, I would add a (dymanic) property called
<property_name>__attributes__ and give it a QVariantHash as the value.
The hash would contain the attribute names above as keys for the
attributes. Downside is that you have to do that per _object_, instead
of per _class_. Having a way to extend the already existing attributes
of properties with other attributes that make sense in the context of
the application would be very helpful for these types of applications.
More information about the Development