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….
Patching Doxygen
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
cd doxygen-svn/src
wget -O doxygen.diff http://blog.dixo.net/doxygen.diff
patch < doxygen.diff
cd ..
Then configure and build doxygen with any options you might need. Most people should be able to simply do this
./configure
make
make install
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!
This is awesome. I have been looking for something like this. I am not ready to manually compile Doxygen yet (out of fear of breaking other stuff). Hopefully these changes will be pushed out from Doxygen soon enough. Thanks for post.
By the way, do you have a link to to the Doxygen bug track for incorporating this path?
Looking at the patch, it looks like the changes in it were committed to the doxygen subversion on Jun 22 – see http://doxygen.svn.sourceforge.net/viewvc/doxygen?view=rev&revision=697
So I’d assume that the next release of doxygen will have this patch.
I’d like to point out that generating QHP files with doxygen is currently broken.
Compiling a QT creator help file works, but you will not be taken to the exact function or class member when pressing F1, instead you will always be shown the top of the page of the respective class.
Versions that I know where it doesn’t work are everything from doxygen 1.6.3 (which is the version of doxygen in eg Ubuntu Lucid Lynx) till 1.7.1 (the latest)
However there is a fix (that will be included in the first upcoming release of doxygen)
Read about it here:
https://bugzilla.gnome.org/show_bug.cgi?id=623673
It’s actually quite easy to fix, only one line has to be changed, as shown in the attached diff file ( http://bugzilla-attachments.gnome.org/attachment.cgi?id=165352 )
Recompile the source and it should work 🙂
EDIT of my previous post:
It’s actually even easier, just checkout the latest svn version, it’s fixed there.
Doing this should be enough, and also replaces all the commands of the original post:
svn co https://doxygen.svn.sourceforge.net/svnroot/doxygen/trunk doxygen-svn
cd doxygen-svn/
./configure
make
make install