[Development] [Feature] Q_INFO: Annotations for classes, methods, properties and enums

Saether Jan-Arve Jan-Arve.Saether at digia.com
Wed Sep 11 09:41:03 CEST 2013


> -----Original Message-----
>> Other people have suggested adding the info to the Q_PROPERTY
>> expansion.
>> This would avoid a sequence of Q_INFO / Q_PROPERTY pairs in the
>> class that might be difficult to read:
>> 
>> 	Q_INFO("foo", "bar")
>> 	Q_PROPERTY(int bar READ bar)
>> 	Q_INFO("foo", "baz")
>> 	Q_PROPERTY(int baz READ baz)
> 
> Right. I'd be fine with supporting something like
>    Q_PROPERTY( ... INFO "foo" = "bar") Though IMO that's way less easy
> to read. Would be fine as alternative syntax.

I think "foo" = "bar" is easier to read.
Why not use the same syntax for the regular Q_INFO annotations too:
Q_INFO("foo" = "bar")

I also think that the name Q_INFO is way too generic (everything in a source file is information, so it's just redundant).
I would therefore prefer to just use Q_ANNOTATE.

My last suggestion is to remove the quotes around the key. Having the key without quotes makes it fit in better with the rest of the information in the Q_PROPERTY macro.
So summarizing my three suggestions we'd get:
Q_ANNOTATE(foo = "bar")
and
Q_PROPERTY( ... ANNOTATE foo = "bar")

In my mind, this is more readable.

Jan Arve



More information about the Development mailing list