C++ 在 Qt Creator 中使用我自己函数的自动文档?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17955686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 21:36:43  来源:igfitidea点击:

Using automatic documentation of my own function with Qt Creator?

c++qtdocumentationqt-creator

提问by Cory Klein

I was using Qt Creator and I decided I wanted to document a function I had written so I positioned my cursor above my function definition and typed /**<ENTER>like so:

我正在使用 Qt Creator 并且我决定要记录我编写的函数,因此我将光标定位在函数定义上方并输入/**<ENTER>如下:

/**<ENTER>
void MyClass::myFunction(int myArg)
{
...

Qt Creator auto-expanded that comment:

Qt Creator 自动扩展了该评论:

/**
 * @brief MyClass::myFunction
 * @param myArg
 */
void MyClass::myFunction(int myArg)
{
...

What is this? Where is it documented?

这是什么?它在哪里记录?

Can I use this to generate my own Qt Assistant qchhelp files or something?

我可以用它来生成我自己的 Qt Assistantqch帮助文件或其他东西吗?

回答by phyatt

It should be documented hereor here, but its not...

它应该在这里这里记录,但它不是......

So here is some info about it:

所以这里有一些关于它的信息:

The settings for this feature are found here:

此功能的设置可在此处找到:

Windows:

视窗:

Qt Creator > Tools > Options > Text Editor > Completion > Documentation Comments

Qt Creator > 工具 > 选项 > 文本编辑器 > 完成 > 文档注释

Mac OS X:

Mac OS X:

Qt Creator > Preferences > Text Editor > Completion > Documentation Comments

Qt Creator > Preferences > Text Editor > Completion > Documentation Comments

The three options it lists are:

它列出的三个选项是:

  • Enable doxygen blocks
  • Generate brief description
  • Add leading asterisks
  • 启用 doxygen 块
  • 生成简要说明
  • 添加前导星号

(Found in Qt 2.6, but possibly in earlier versions, too?, or it may be part of the default plugin set at some point.)

(在 Qt 2.6 中找到,但也可能在早期版本中?,或者它可能在某个时候成为默认插件集的一部分。)

The stubs that are created are doxygen style stubs.

创建的存根是 doxygen 风格的存根。

You can use doxygen to run through your source code and create some fancy documentation, both in a chm file and in a html document and pdf.

您可以使用 doxygen 来运行您的源代码并在 chm 文件和 html 文档和 pdf 中创建一些精美的文档。

http://www.doxygen.nl/

http://www.doxygen.nl/

http://www.doxygen.nl/manual/output.html(includes qch files)

http://www.doxygen.nl/manual/output.html(包括 qch 文件)

Here is a related plugin for Qt Creator:

这是 Qt Creator 的相关插件:

http://dev.kofee.org/projects/qtcreator-doxygen/wiki

http://dev.kofee.org/projects/qtcreator-doxygen/wiki

And using the QHelpEnginein your own program...

QHelpEngine在您自己的程序中使用...

http://qt-project.org/doc/qt-4.8/qthelp-framework.html

http://qt-project.org/doc/qt-4.8/qthelp-framework.html

And finally, you can use QDesktopServices to handle a help styled url:

最后,您可以使用 QDesktopServices 来处理帮助样式的 url:

http://doc-snapshot.qt-project.org/4.8/qdesktopservices.html#url-handlers

http://doc-snapshot.qt-project.org/4.8/qdesktopservices.html#url-handlers

Hope that helps.

希望有帮助。