Doxygen for QML components

Aurélien Gâteau agateau at kde.org
Wed Oct 17 14:09:51 UTC 2012


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


More information about the Plasma-devel mailing list