Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Introduction to QDoc

QDoc is a tool used by Qt Developers to generate documentation for software projects. It works by extracting qdoc comments from project source files and then formatting these comments as HTML pages or DITA XML documents, etc. QDoc finds qdoc comments in .cpp files and in .qdoc files. QDoc does not look for qdoc comments in .h files. A qdoc comment always begins with an exclamation mark ! e.g.:

     / *!
         \class QObject
         \brief The QObject class is the base class of all Qt objects.

         \ingroup objectmodel

         \reentrant

         QObject is the heart of the Qt \l{Object Model}. The
         central feature in this model is a very powerful mechanism
         for seamless object communication called \l{signals and
         slots}. You can connect a signal to a slot with connect()
         and destroy the connection with disconnect(). To avoid
         never ending notification loops you can temporarily block
         signals with blockSignals(). The protected functions
         connectNotify() and disconnectNotify() make it possible to
         track connections.

         QObjects organize themselves in \l {Object Trees &
         Ownership} {object trees}. When you create a QObject with
         another object as parent, the object will automatically
         add itself to the parent's children() list. The parent
         takes ownership of the object; i.e., it will automatically
         delete its children in its destructor. You can look for an
         object by name and optionally type using findChild() or
         findChildren().

         Every object has an objectName() and its class name can be
         found via the corresponding metaObject() (see
         QMetaObject::className()).  You can determine whether the
         object's class inherits another class in the QObject
         inheritance hierarchy by using the inherits() function.

     ....
 * /

From the qdoc comment above, QDoc generates the now famous HTML page QObject Class Reference.

This manual explains how to use the QDoc commands in qdoc comments to embed good documentation in your source files. It also explains how to make a QDoc configuration file, which you will pass to QDoc on the command line.

Running QDoc

The current name of the QDoc program is qdoc. To run qdoc from the command line, give it the name of a configuration file:

$ ../../bin/qdoc ./config.qdocconf

QDoc recognizes the .qdocconf suffix as a QDoc configuration file. The configuration file is where you tell QDoc where to find the project source files, header files, and .qdoc files. It is also where you tell QDoc what kind of output to generate (HTML, DITA XML,...), and where to put the generated documentation. The configuration file also contains other information for QDoc.

See The QDoc Configuration File for a instructions on how to build a Qdoc configuration file.

How QDoc Works

QDoc begins by reading the configuarion file you specified on the command line. It stores all the variables from the configuration file for later use. One of the first variables it uses is outputformats. This variable tells QDoc which output generators it will run. The default value is HTML, so if you don't set outputformats in your configuration file, QDoc will generate HTML output. That's usually what you will want anyway, but you can also specify DITAXML to get DITA XML output instead.

Next, QDoc uses the values of the headerdirs variable and/or the headers variable to find and parse all the header files for your project. QDoc does not scan header files for qdoc comments. It parses the header files to build a master tree of all the items that should be documented (i.e. the items that QDoc should find qdoc comments for).

After parsing all the header files and building the master tree of items to be documented, QDoc uses the value of the sourcedirs variable and/or the value of the sources variable to find and parse all the .cpp and .qdoc files for your project. These are the files QDoc scans for qdoc comments. Remember that a qdoc comment begins with an exclamation mark, i.e. /*! .

For each qdoc comment it finds, it searches the master tree for the item where the documentation belongs. The it interprets the qdoc commands in the comment and stores the interpreted commands and the comment text in the tree node for the item.

Finally, QDoc traverses the master tree. For each node, if the node has stored documentation, QDoc calls the output generator specified by the outputformats variable to format and write the documentation in the directory specified in the configuration file in the outputdir variable.

Command Types

QDoc interprets three types of commands:

Topic commands identify the elememt you are documenting, e.g. a C++ class, function, or type, an example, or an extra page of text that doesn't map to an underlying C++ elememnt.

Context commands tell QDoc how the element being documented relates to other documented elememnts, e.g. next and previous page links or inclusion in page groups or library modules. Context commands can also provide information about the documented element that QDoc can't get from the source files, e.g. whether the element is thread-safe, an overloaded or reimplemented function, or that it has been deprecated.

Markup commands tell QDoc how text and image elements in the document should be rendered, or about the document's outline structure.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web