25

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?

1 Answer 1

36

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.doxygen.nl/

http://www.doxygen.nl/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.

4
  • 4
    You know, Qt documentation is usually freaking amazing, but there's these edge cases like this (and using style sheets, for me) where I have no idea how to find the right documentation for a feature, if it exists at all. Thanks for such detailed info.
    – Cory Klein
    Jul 30, 2013 at 20:00
  • No problem. The QStyleSheets stuff does require some trial and error, but it isn't too different from CSS behavior. If you are messing around a lot with QStyleSheets, I would modify and load a different one on the fly. Here is the most advanced thing I've done with stylesheets: stackoverflow.com/questions/13564823/qlist-out-of-memory/… Good luck.
    – phyatt
    Jul 31, 2013 at 0:00
  • Enable Doxygen blocks not sure what does it do? Should it autocomplete doxygen tags? Shows nothing to me - no autocomplete. Any ideas? May 5, 2017 at 13:15
  • 1
    @AlekseyKontsevich it does exactly what the initial poster was asking for (there's also a tooltip on the checkbox, at least nowadays) : it creates the skeleton for a doxygen comment when pressing enter after /**. I wish I could configure it to generate \brief and \param instead of @brief and @param though.... Sep 9, 2021 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.