Contextual Help QtCreator

In QtCreator, when pressing “F1” while editing your code you can get help on the selected word.

Natively, this is working well for Qt classes, but not for std::vector nor itk::Image and so on…

In fact it is possible to add dedicated help file to QtCreator: see here.

The way to add a new help file (say .qch file) in Qt Creator is every time the same:

  1. Get the desired qch file
  2. in QtCreator go in Tools –> options –> Help. The documentation tab and clic “add”, then select your .qch file.
  3. restart QtCreator

On the previous link you can found many ressources about classical libraries. Here is my own selection (the qch file are linked):

 

Configuring help

 

In order to generate new qch files, Doxygen is able to produce QHP files. Then there is a tool from Qt that produces the QCH file from QHP. If well configured, doxygen can produce a .qch file. remind to set properly these flags:

  • GENERATE_QHP = YES       (produce QHP file)
  • QCH_FILE  = TheFile.qch     (as said in the help file : you have to specify QHG_LOCATIION)
  • QHP_NAMESPACE = The.Lib.name
  • QHG_LOCATION  =  /bin/qhelpgenerator     (or qhelpgenerator … the tool to go from qhp to qch)

As example for ITK, CMake allow us to build documentation using doxygen and produces the doxygen.config file:

  1. set the flag “BUILD_DOCUMENTATION” to ON (in the advanced mode), then configure.
  2. then, set also to ON the flag “ITK_DOXYGEN_QHP”.
  3. configure and generate,
  4. then “make -j8” (and remind that the documentation generation tools is very very long).

These steps should produce an “index.qhp” file (close to “./Utilities/Doxygen/html/index.qhp” in your building directory) as  ITK don’t complete properly QHP_NAMESPACE and QHG_LOCATION (but you can edit the doxygen.config.in before all…). So, in order to convert your QHP file into a qch file, execute qhelpgenerator manually: qhelpgenerator index.qhp -o ~/ITK.qch

Done!

Qt Creator with C++ help (and examples :)

 

QtCreator with ITK Documentation

 


Posted

in

by

Tags: