How to document QML and C++ code?

  • I would like to document my QML and C++ code. Can any one suggest me the best way to do it?
    When i googled it. I got to know the plugin Doxygen but i think its only for c++(I am not sure whether it can generate for QML code as well).
    I have drawn class diagrams for c++ and qml . please have a look here. you can also edit and comment.

  • Moderators

  • @p3c0
    I didn't know about QDoc. Thanks for that but I am unable to understand the description.
    How should i generate QDoc configuration file? i see the description here here. but not able to understand it. It is given that
    To run qdoc, the project configuration file is supplied as an argument.
    qdoc project.qdocconf
    where should i provide the argument?
    Specifying the path to the source directories allow QDoc to find sources and generate documentation.
    where should i specify ? In .pro file or where exactly ?

    where should i run the cmd prompt in windows?
    eg: all my project files are in this location C:\Qt\Lely\LelyUI4> and i opened a cmd promt here. now what to do ? . Can you please describe step wise?

    Also they claim that with Qt5.5 it saves time suing single execution mode. here it is .I didn't understand where should i run thi cmd
    /Users/me/qt5/qtbase/bin/qdoc -outputdir /Users/me/qt5/qtbase/doc -installdir /Users/me/qt5/qtbase/doc /Users/me/qt5/master.qdocconf -single-exec
    Thanks a lot.

  • Moderators

    @vishnu Unfortunately I too haven't used the tool myself. Perhaps you to create your own qdocconf configuration file depending upon your requirement. The docs seems to be explaining all the required stuff. Try out the sample conf file mentioned on that page. The tool can be run from anywhere as long as the tool path and conf file path and project paths are valid.

  • @vishnu In a project called RBIMS, I created a text docuemt called RBIMS.qdocconf which contained the following text:

    project = RBIMS
    outputdir   += ./html
    headerdirs  += .
    sourcedirs  += .
    exampledirs = .
    imagedirs   = ./images
    headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"
    sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"

    I used the following command (executed from within my project folder) at the command line:

    ~/Qt/5.15.0/gcc_64/bin/qdoc /home/jim/Qt_Projects/RBIMS/RBIMS.qdocconf

    This produced an XML file in the html folder inside my project.

    <?xml version="1.0" encoding="UTF-8"?>
    <INDEX url="" title="RBIMS Reference Documentation" version="" project="RBIMS">
        <namespace name="" status="active" access="public" module="rbims">
    ...  Code removed for brevity
    virtual="non" const="false" static="false" final="false" override="false" type="bool" signature="bool createDatabase()"/>
                <function name="database" fullname="database::database" href="database.html#database" status="active" access="public" location="database.h" filepath="/home/jim/Qt_Projects/RBIMS/database.h" lineno="36" documented="true" meta="constructor" virtual="non" const="false" static="false" final="false" override="false" type="" brief="Database::database test constructor doc  parent" signature="database(int *parent)">
                    <parameter type="int *" name="parent" default="nullptr"/>

    You can see (toward the end) that ....

    brief="Database::database test constructor doc  parent"

    is created, which was a

     * \brief database::database test constructor doc
     * \param parent

    Qdoc comment in my code.