If you’re documenting your classes with Doxygen tags you might be wondering if you can use that help inside QtCreator and get those F1 tooltips whenever you hover a documented class or method.
I wondered the same thing, and it turns out Doxygen needed a little tweaking to make it work. Karsten Heimrich at Nokia rather kindly wrote a patch which will eventually make it into Doxygen, but if you have burning desire to try this, here’s what you do….
Once I hear that Doxygen includes this patch I’ll remove this section – so if you’re reading this, you probably need to patch. So, lets grab the latest sources and apply the patch.
svn co https://doxygen.svn.sourceforge.net/svnroot/doxygen/trunk doxygen-svn
wget -O doxygen.diff http://blog.dixo.net/doxygen.diff
patch < doxygen.diff
Then configure and build doxygen with any options you might need. Most people should be able to simply do this
You should how have the patched doxygen in /usr/local/bin.
Generating the help
There are some Qt Labs posts on generating Qt Help from Doxygen, but here's a quick run through:
To generate a Qt .qch file you'll need the following entries in your doxygen configuration file
GENERATE_QHP = YES
QCH_FILE = /path/to/output/helpfile.qch
QHP_NAMESPACE = com.yourdomain.subdomain
QHP_VIRTUAL_FOLDER = yourfolder
QHG_LOCATION = /your/path/to/qt/bin/qhelpgenerator
Run patched doxygen and you should end up with a .qch file in the filename given by the QCH_FILE option. Almost done!
Installing the help in Qt Creator
- Go to Tools -> Options -> Help, click "Add" and browse for the generated .qch file.
- Click OK and your namespace should now be listed in the registered documentation box
- Click OK to dismiss the options dialog
- Now for the important bit - restart Qt Creator. If you don't do this, the help doesn't get propertly integrated into the IDE, at least on Qt Creator v1.1.
That's it! Now hover the mouse over one of your documented classes and you should get a tooltip suggesting you press F1.
Documentation nirvana! Again, my thanks to Karsten Heimrich for writing the patch, hope someone else finds this useful!