I am writting a documentation for my QML project with QDoc. So far, I am able to make a simple one with a description of my functions/signals/properties. Now, I would like to define the inheritance and the important statements like in the Qt doc (see below).
According to the Qt documentation, the inheritance is defined with \inherits command. However, I don't see any result when I want to make my objects inherit from Item and I don't have any warning/error when I run the qdoc.
According the Qt wiki, QDoc considers the version specified in the command as the import statement. Following the example, I tried to define my own import statement since my qml files will be available with a specific import only (let's say MyLib 2.0 here). Like the inheritance, qdoc doesn't seem to understand because I have the following result:
Any idea of what I missed? You can find below a simple example of what I have (the css file is very simple so I don't think it is relevant to show it).
My environment:
- Qt 5.10.10 with msvc2015
- LLVM 9.0.0 (for qdoc)
config.qdocconf
sourcedirs = .
headerdirs = .
imagedirs = .
sources.fileextensions = "*.qml"
outputdir = ./doc/
outputformats = HTML
HTML.stylesheets = style.css
HTML.headerstyles = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\"/>\n"
CustomItem.qml
import QtQuick 2.10;
/*!
MyLib 2.0 //! What should I write to get the import statement?
\qmltype CustomItem
\inherits Item //! What should I write to get the "Inherits"?
\brief A simple example of object that inherits of Item.
I can safely assume that the properties and signals work well.
*/
Item {
id: customItem;
/*!
prop1 description
*/
property color prop1;
/*!
prop2 description
*/
property int prop2: 6;
}
Thank you for your help !
In order for
\inherits
to work, the type it inherits must be defined somewhere that QDoc can find. SinceItem
is a type provided by Qt, your.qdocconf
file must depend on the module that provides the documentation forItem
.You can do this by adding the following lines to your
.qdocconf
file.Documentation on
depends
Relevant section:
But you also need to tell QDoc where the index files for those dependencies are.
Which means you need to build the Qt documentation and pass the location of the installed documentation to
qdoc
Link on building the Qt documentation
Once you've done that, using
\inherits Item
should provide the following line in your produced documentation.