Cory Klein Cory Klein - 16 days ago 12
C++ Question

Using automatic documentation of my own function with Qt Creator?

I was using Qt Creator and I decided I wanted to document a function I had written so I positioned my cursor above my function definition and typed

/**<ENTER>
like so:

/**<ENTER>
void MyClass::myFunction(int myArg)
{
...


Qt Creator auto-expanded that comment:

/**
* @brief MyClass::myFunction
* @param myArg
*/
void MyClass::myFunction(int myArg)
{
...


What is this? Where is it documented?

Can I use this to generate my own Qt Assistant
qch
help files or something?

Answer

It should be documented here or here, but its not...

So here is some info about it:

The settings for this feature are found here:

Windows:

Qt Creator > Tools > Options > Text Editor > Completion > Documentation Comments

Mac OS X:

Qt Creator > Preferences > Text Editor > Completion > Documentation Comments

The three options it lists are:

  • Enable Doxygen blocks
  • Generate brief description
  • Add leading asterisks

(Found in Qt 2.6, but possibly in earlier versions, too?, or it may be part of the default plugin set at some point.)

The stubs that are created are Doxygen style stubs.

You can use doxygen to run through your source code and create some fancy documentation, both in a chm file and in a html document and pdf.

http://www.stack.nl/~dimitri/doxygen/

http://www.stack.nl/~dimitri/doxygen/manual/output.html (includes qch files)

Here is a related plugin for Qt Creator:

http://dev.kofee.org/projects/qtcreator-doxygen/wiki

And using the QHelpEngine in your own program...

http://qt-project.org/doc/qt-4.8/qthelp-framework.html

And finally, you can use QDesktopServices to handle a help styled url:

http://doc-snapshot.qt-project.org/4.8/qdesktopservices.html#url-handlers

Hope that helps.

Comments