Doxygen for QML components

Aleix Pol aleixpol at kde.org
Wed Oct 17 14:20:26 UTC 2012


On Wed, Oct 17, 2012 at 4:09 PM, Aurélien Gâteau <agateau at kde.org> wrote:
> Le mardi 16 octobre 2012 21:39:15 Marco Martin a écrit :
>> On Tuesday 16 October 2012, Aurélien Gâteau wrote:
>> > - document class elements with comment blocks located next to the
>> > documented element
>> >
>> > The code is available from kde:scratch/gateau/doxyqml . It is just a hack
>> > right now, using a proper grammar file would be more reliable, but it
>> > works
>> > reasonably well right now.
>>
>> +1, i like the idea, still not perfect but is already an improvement
>
> As I said, the main problem is finding the type of property aliases. I see two
> options here:
>
> The correct, complicated one:
> Use a real parser to parse the QML files and find out the information. This is
> non-trivial as it will often imply parsing other QML and C++ files.
>
> 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
>
> Are you OK with me following up with maintainers of api.kde.org so that
> doxyqml is used to generate documentation there?
>
> Aurélien
> _______________________________________________
> Plasma-devel mailing list
> Plasma-devel at kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel

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.

Aleix


More information about the Plasma-devel mailing list