[Development] Documenting JavaScript with QDoc

Milian Wolff milian.wolff at kdab.com
Thu Apr 17 12:38:36 CEST 2014


Hello!

I'm trying to add documentation to the JavaScript API of QWebChannel. It is a 
fundamental part of this module and as such, I think proper documentation is 
crucial.

So far, I have not found a way to get qdoc to generate a page for my .js file 
for me. Can it? Or do I have to create a separate .qdoc file, and - if so - 
what commands to I need to use in that file?

I tried something like this:

/*!
    \title Qt WebChannel JavaScript API
    \page javascript.html

    To communicate with a QWebChannel or WebChannel, any HTML client must use 
and setup the
    JavaScript API provided by \c qwebchannel.js.
*/

/*!
  \qmltype foo

  asdfsadf
*/

/*!
  \qmlmethod bool foo::test();

  foo bar
*/

On the javascript.html page, I then cannot see anything about foo nor 
foo::test... Is there maybe a module out there which documents "pure" .js 
files? In QtDeclarative, I only found documentation for  .cpp/.qml functions 
so far. Even things like qsTr are actually documentation for a .cpp method 
which gets renamed using \qmlmethod...

Hope anyone can help me here. The only potential workaround I could think of 
so far would be adding a dummy .cpp file for the documentation of the .js API 
of the QWebChannel.

Thanks

-- 
Qt Developer Days 2014 - October 6 - 8 at BCC, Berlin

Milian Wolff | milian.wolff at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions




More information about the Development mailing list