Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show API documentation in QtCreator tooltips?

QtCreator provides tooltips for built-in Qt functions, like this:

enter image description here

I've added some documentation to my own function like this:

        /**
         * @brief serialize Writes the passed field definition set to the specified device.
         * @param device Device to write the field definition set to.
         * @param fieldDefinitionSet Field definition set to write.
         */
        void serialize(QIODevice& device, const FieldDefinitionSet& fieldDefinitionSet) const;

Running Doxygen and qhelpgenerator, I've created my own .qhp file and added it to QtCreator. However, QtCreator still doesn't show my brief summary in the tooltip:

enter image description here

I assume that QtCreator basically has recognized my .qhp file, because hitting F1 shows the generated documentation:

enter image description here

Is there any way of getting the brief summaries in the tooltips as well? I've tried everything in

  • Qt5 reference documentation: qch files
  • Use own documentation in Qt Creator help mode
  • Using automatic documentation of my own function with Qt Creator?

but still no summary.

like image 439
Nick Pruehs Avatar asked Sep 10 '16 21:09

Nick Pruehs


1 Answers

The way QtCreator extracts information from HTML documentation files requires a very specific structure for it to work.

For example, the brief summary of MyClass must be placed between <!-- $$$MyClass-brief --> and <!-- $$$MyClass --> marks in the corresponding HTML file. For method summary lookup, more complex marks are used.

Without this, brief extraction is not going to work and no summary will be displayed in QtCreator tooltips.

Sadly this is not well documented and AFAIK it might change in future releases.

If you are really interested you can take a look at QtCreator sources (htmldocextractor.cpp). And I suppose that Qt help files (inside Qt/Docs directory) can be considered working examples.

You can also try : doxygen2qtcreator.

The script inserts those Qt marks in Doxygen-generated HTML files (thus before generating the qch file with qhelpgenerator). It worked for me, but I have not tested it with newer Doxygen/Qt releases.

like image 176
Marcos Avatar answered Oct 13 '22 00:10

Marcos