Display Doxygen generated docs in QT Creator

Posted in Software Development, published on

Tags: QT Doxygen C++ Qt Creator

QT Creator is a great IDE, even more so when you are developing QT based applications. Doxygen is the De Facto documentation generator for C++ based code. This article will show you how to display and integrate your Doxygen based documentation in QT Creator.

Configure Doxygen

The first step is to configure Doxygen to generate your documentation in a format QT Creator can understand.

The following Doxygen options should be set in your Doxyfile:

GENERATE_QHP           = YES
QCH_FILE               = <project>.qch
QHP_NAMESPACE          = <namespace>
QHP_VIRTUAL_FOLDER     = doc
QHG_LOCATION           = qhelpgenerator

The name of the .qch file can be whatever you choose, as is the QHP namespace.

An important note is that the qhelpgenerator tool has to be on your path. I normally add the following setting to my $PATH variable in .zshrc (or .bashrc if you're defaulting):

QT_TOOL_BIN=$HOME/Qt/5.13.1/gcc_64/bin
export PATH=$PATH:$HOME/.bin:$QT_TOOL_BIN

Generate your documentation

Next start Doxygen and update your documenation:

doxygen Doxyfile

This will update your documentation as regular and also create the .qch file as specified. Be sure to check the Doxygen output and verify that the file was created.

Configure QT Creator

Next we need to tell QT Creator where the new documentation can be found. Open the QT Creator options and add the location of the generated .qch file as show below:

Configure QT Creator view image

And we're done!

Now you can press F1 to open the QT Help viewer on any of your classes to read the generated documentation in QT Creator.