Important: Please read the Qt Code of Conduct -

\enum directive doesn't work correctly in QDoc if enum is not included in the class or namespace.

  • Hi,

    According documentation there is not any requirements that enum should be included in name space or some class for correct QDoc parsing . QDoc doesn't recognize any comments to enum if it is included just in some *.h without class or namespace context.
    In mainwindow.h class:

    enum eParentPath
        PARENT_NONE = 0,
    namespace Ui {
    class MainWindow;
    class MainWindow : public QMainWindow

    In some .qdoc file:

      \module GeneralEnums
      \title General enums
      \brief Contains general enums used in the project
      \enum eParentPath
      \brief Relations for bidirectional tree references
      \inmodule GeneralEnums
      Relations for bidirectional tree references
      \value PARENT_NONE
            no parent for the element
      \value PARENT_PARAM
            some parent parameter
      \value PARENT_DEF
            item is definition
      \value PARENT_EQUAL
            equal item
      \value PARENT_OPERATOR
            parent as operator
      \value PARENT_SON
            parent is the son of some item
      \value PARENT_SIBLING
            item is the sibling
      Some dummy comments.

    QDoc run successfully and generalenums-module.html is generated but without any real documentation. Where is the error? Doesn't mean that QDoc doesn't support enum without some context like class or namespace? It is really bad because now I need refactor one big library in Qt compatible project for documentation generation. Do I need create the error?

  • Got some comments from one Qt developer. All global items like functions, variables and enums should be marked as related to some classes or header using \related directive.
    From the point of C++ design it is not good to use such enums. But I am creating the documentation for existing library and cannot do big refactoring now.

Log in to reply