首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >QML/qdoc :如何定义继承和导入语句

QML/qdoc :如何定义继承和导入语句
EN

Stack Overflow用户
提问于 2021-07-09 16:30:30
回答 1查看 165关注 0票数 0

我创建了一个qml库,现在我想创建一个文档。我将QDoc与QT5.10.10与msvc2015和LLVM 9.0.0结合使用。

我想显示以下2项数据:

  • inheritance:我尝试使用\inherits,但没有看到任何结果。我尝试使用QtQuick中的一个项(使用QtQuick:: Item )和我自己库中的一个项。我是不是遗漏了一些?
  • Import语句,:我只是不知道该做什么。看来我必须使用\qmlmodule,但是无论是在qdocconf还是在qml文件中使用它,都有一个错误。

下面是我目前的代码:

代码语言:javascript
复制
// 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"

--编辑:正如评论中所问的,这里我有错误

  • Inheritance:,我只是没有看到任何结果。继承对qt控件或我自己的本地controls
  • Import语句没有影响。如果我试图在我的qml文件中使用\qmlmodule,就会得到这个错误

如果我什么都不做,我就明白了:

--编辑2:我还应该提到我使用的是Visual,而不是

EN

回答 1

Stack Overflow用户

发布于 2021-08-11 07:45:01

在qml文件中不允许使用qmlmodule。您必须将它添加到单独的myQMLmoduleName.qdoc文件中:

代码语言:javascript
复制
 /*!
  \qmlmodule MyControls
  \brief Mycustom controls.
*/

然后将*.qdoc扩展添加到qdoc的myConfig.qdocconf中,以查找myQMLmoduleName.qdoc。

代码语言:javascript
复制
# what kind of sources should be processed
sources.fileextensions += "*.qdoc *.cpp *.qml"
sourcedirs += ../path/to/your/config/
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68320087

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档