Doxygen for QML components

Aleix Pol aleixpol at kde.org
Wed Oct 17 15:28:16 UTC 2012


On Wed, Oct 17, 2012 at 4:58 PM, Aurélien Gâteau <agateau at kde.org> wrote:
> Le mercredi 17 octobre 2012 16:20:26 Aleix Pol a écrit :
>> > The crude, done in 10 minutes one:
>> > Define a custom comment to set on the property alias to document the type.
>> >
>> > Something like this:
>> >   property alias text: label.text // doxyqml: type=string
>> >
>> > I consider the second option more in line with the phylosophy of the
>> > current code :), so I am probably going to implement it that way, unless
>> > one of you has a smarter idea.
>> >
>> > An interesting bonus point of this annotation is that it could be used to
>> > provide more precise information about the type. For example a property
>> > which>
>> > takes a QtObject but actually expects a model could be marked as such:
>> >   property QtObject model // doxyqml: type=QAbstractItemModel
>
>> Just FWIW, it's what they do with Python and PHP as well (at least).
>> We even use that information for type inference from KDevelop.
>>
>> Maybe you can get inspired with what syntax they use there, though.
>
> Ah, so I am not completely smocking crack there :) Using a similar syntax
> makes sense indeed. Do you have an example of such comments?
>
> Aurélien
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel

A quick search pointed me to this example [1]:
/**
 * @param My_Type $obj
 */
public function myMethod($obj) {}

If you want more examples you can also see in kde:kdev-php repository,
there's this phpfunctions.php file that we use to add documentation
for some built-in functions. I don't know where to find python
examples, but I guess you can contact scummos in #kdevelop and he'll
be able to point it out to you.

Cheers!
Aleix

[1] http://stackoverflow.com/questions/7861375/why-declare-php-variable-type-in-a-comment


More information about the Plasma-devel mailing list