0

I made a qml library and I now want to make a documentation. I use QDoc with Qt 5.10.10 with msvc2015 and LLVM 9.0.0.

I would like to display the 2 following data:

enter image description here

  • inheritance: I tried to use \inherits but I don't see any result. I tried to use an Item from QtQuick (with QtQuick::Item) and an item from my own library. Am I missing something ?
  • Import statement: I just don't know what to do. It seems I have to use \qmlmodule but I have an error whether I use it on my qdocconf or in my qml file.

Below the code I currently have:

// MyButton.qml - the header
    /*!
    QtQuick.Controls 1.1

    \qmltype SolidButton
    \qmlmodule MyModule
    \inherits QtQuick::Button
    \brief My button. It inherits from Button from QtQuick.

    \section1 Detailed Example

    \qml
    MyButton {
        text: "My Button";
    }
    \endqml
    */

// qdocconf

    sourcedirs += ../qml/
    headerdirs += ../qml/
    imagedirs = .

    sources.fileextensions = "*.qml"

    outputdir  =    ./doc/qml/
    outputformats = HTML

    HTML.stylesheets = style.css
    HTML.headerstyles = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\"/>\n"

----- EDIT: As asked in the comment, here the error I have

  • Inheritance: I just don't see any result. \inherits has no impact with a qt control or my own local controls
  • Import statement. If I try to use the \qmlmodule on my qml file I get this error enter image description here If I do nothing, I get this: enter image description here

----- EDIT 2: I should also mention that I am using Visual Studio, not Qt Creator

  • use [Doxygen](https://www.doxygen.nl/index.html) . – Parisa.H.R Jul 09 '21 at 17:39
  • How will it help with my issue ? – The friendly stranger Jul 09 '21 at 17:42
  • To create documents like Qt Documentation , Doxygen will create it automatically . search about `doxywizard` and `Doxygen` – Parisa.H.R Jul 09 '21 at 17:46
  • So, do you think it's better to use Doxygen than the QDoc provided by Qt ? – The friendly stranger Jul 09 '21 at 17:52
  • maybe , we should Test both of them , I don't know which one is better . – Parisa.H.R Jul 09 '21 at 17:54
  • I already used doxygen in the past for c++. I agree it is pretty convenient. However, I like the way QDoc generate the html. If I tweak the css, I can have a design close to the Qt documentation. If doxygen is able to fix my current issue (inheritance/import statement) then I might consider using it. – The friendly stranger Jul 09 '21 at 17:59
  • I know it shows `class Diagram` and also shows Inheritance there. but I'm not sure about showing them inside a Table. – Parisa.H.R Jul 09 '21 at 18:05
  • You probably need to specify the name of your project and a bunch of other things. Perhaps https://code.qt.io/cgit/qt/qtquickcontrols2.git/tree/src/quickcontrols2/doc/qtquickcontrols.qdocconf could be used as a reference. Also, please post the errors you get. – Mitch Jul 10 '21 at 07:51
  • @Mitch I edited my message. Basically I don't have any inheritance no matter what I do. I guess I am not using \qmlmodule well because I can't generate documetnation. If I do nothing I have "Import statement import ." – The friendly stranger Jul 12 '21 at 14:29

1 Answers1

0

\qmlmodule is not allowed in a qml file. You have to add it to a separate myQMLmoduleName.qdoc file:

 /*!
  \qmlmodule MyControls
  \brief Mycustom controls.
*/

then add the *.qdoc extentions to your myConfig.qdocconf for qdoc to find your myQMLmoduleName.qdoc.

# what kind of sources should be processed
sources.fileextensions += "*.qdoc *.cpp *.qml"
sourcedirs += ../path/to/your/config/
Kelteseth
  • 150
  • 1
  • 11
  • I also have the same problem with the inherits command and after hours of trying came to the conclusion this is for cpp only. QQC 1 are written in QML and do not contain this statement: https://code.qt.io/cgit/qt/qtquickcontrols.git/tree/src/controls/Button.qml but still have clickable inherits https://doc.qt.io/qt-5/qml-qtquick-controls-button.html. QQC 2 are written in c++ and contains this statement: https://code.woboq.org/qt5/qtdeclarative/src/quick/items/qquicktextedit.cpp.html – Kelteseth Aug 11 '21 at 08:28