简体   繁体   English

doxygen 生成的文档,带有自动生成的 qt 项目链接

[英]doxygen generated documentation with auto-generated links to qt project

I have a project with use Qt extensively.我有一个广泛使用 Qt 的项目。 The documentation is generated with doxygen.文档是用 doxygen 生成的。 Is it possible to configure doxygen to generate links to online qt documentation.是否可以配置 doxygen 以生成指向在线 qt 文档的链接。

For example,例如,

/**
 * Implements QAbstractListModel.
 */

The comment like this would have in the output an internet link to Qt online documentation of QAbstractListModel.像这样的评论将在输出中包含指向 QAbstractListModel 的 Qt 在线文档的 Internet 链接。

You can use the TAGFILES option on your Doxyfile then you can setup the online link as TAGFILE.您可以在 Doxyfile 上使用TAGFILES选项,然后您可以将在线链接设置为 TAGFILE。 See:看:

TAGFILES = qtcore.tags=http://qt-project.org/doc/qt-4.8/ \
qtgui.tags=http://qt-project.org/doc/qt-4.8/ \
qtwidgets.tags=http://qt-project.org/doc/qt-4.8/ \
qtxml.tags=http://qt-project.org/doc/qt-4.8/ \
qtnetwork.tags=http://qt-project.org/doc/qt-4.8/

More information here: Linking to external documentation更多信息:链接到外部文档

I was looking on internet about that and in fact I couldn't find the answer.我正在互联网上寻找有关此问题的信息,实际上我找不到答案。 I just tried it and it worked so great for me!!!我刚试过,它对我来说太棒了!!!

Is it possible to configure doxygen to generate links to online qt documentation.是否可以配置 doxygen 以生成指向在线 qt 文档的链接。

It would have been important for the KDE API documentation, too, but there is no, or at least not a simple way to do it.这对于 KDE API 文档也很重要,但是没有,或者至少没有简单的方法来做到这一点。

However, as you can see on the KDE API page (eg KMessageBox and grep for QWidget), you can apply some tricks to at least the method signature, etc, to get the link to the Qt documentation.但是,正如您在KDE API 页面上看到的(例如 QWidget 的 KMessageBox 和 grep),您至少可以对方法签名等应用一些技巧,以获取 Qt 文档的链接。 Perhaps, you could try to apply the same trick to the documentation without doxygen.也许,您可以尝试将相同的技巧应用于没有 doxygen 的文档。

In general, you wish to have more than just the doxygen documentation, so I think you would need a more generic approach, respectively.一般来说,您希望拥有的不仅仅是 doxygen 文档,所以我认为您分别需要一种更通用的方法。

I wrote a utility to copy the .tags files from selected module(s) in a Qt docs install folder and place them somewhere local to the Doxygen config.我编写了一个实用程序来从 Qt docs 安装文件夹中的选定模块复制.tags文件,并将它们放置在 Doxygen 配置的本地位置。 It will optionally concatenate the input files into one big .tags file so the Doxygen config becomes much simpler if linking to online help (vs. generating a .qhp).它会选择性地将输入文件连接成一个大的.tags文件,因此如果链接到在线帮助(与生成 .qhp 相比),Doxygen 配置会变得更加简单。

If I have:如果我有:

project/
  doc/
    Doxyfile
    html/
    tagfiles/
      qt.tags
  src/

The single file can be used like so:可以像这样使用单个文件:

TAGFILES = tagfiles/qt.tags=https://doc.qt.io/qt-5/

Or for QHP:或者对于 QHP:

TAGFILES = \
     tagfiles/qtcore.tags=qthelp://org.qt-project.qtcore/qtcore/  \
     tagfiles/qtgui.tags=qthelp://org.qt-project.qtgui/qtgui/     \
     tagfiles/qtwidgets.tags=qthelp://org.qt-project.qtwidgets/qtwidgets/ 

Here's an example of docs generated from that repo. 这是从该存储库生成的文档示例 All the linking to Qt docs is automatic, including all the inherited stuff in the expandable trees.所有到 Qt 文档的链接都是自动的,包括可扩展树中的所有继承内容。

Adding the large Qt tags noticeably slows down Doxygen runs, so I would definitely limit the imported tags to only the Qt modules one needs to link to.添加大型 Qt 标签会明显减慢 Doxygen 的运行速度,因此我肯定会将导入的标签限制为仅需要链接到的 Qt 模块。

UPDATE : There is a bug (QTBUG-61790) (fixed in Qt 5.15.0) in Qt's generation of tags for enumeration values which prevents Doxygen from generating proper links to them.更新:在 Qt 为枚举值生成标记时存在一个错误(QTBUG-61790) (在 Qt 5.15.0 中修复),这会阻止 Doxygen 生成指向它们的正确链接。 I added a separate utility which fixes the tag files, and also updated the copy utility I linked to at the top to implement the enum fixes.我添加了一个单独的实用程序来修复标记文件,还更新了我在顶部链接的复制实用程序以实现枚举修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM