列表

Doxygen 提供了多种创建项目列表的方式。

使用破折号

通过在行首放置多个列对齐的减号(-),将自动生成项目符号列表。除了减号,也可以使用加号(+)或星号(*)。

编号列表也可以通过使用减号后跟井号(#),或者使用数字后跟点来生成。

当使用减号后跟可选空格,再跟 [ ] 表示未选中复选框,或 [x][X] 表示已选中复选框时,可以创建带选中或未选中复选框指示的列表。

允许列表嵌套,并根据项目的缩进进行。

这是一个例子

  /*! 
   *  A list of events:
   *    - mouse events
   *         -# mouse move event
   *         -# mouse click event\n
   *            More info about the click event.
   *         -# mouse double click event
   *    - keyboard events
   *         1. key down event
   *         2. key up event
   *    - checkbox list
   *         - [ ] unchecked
   *         - [x] checked
   *
   *  More text here.
   */

结果将是

事件列表

  • 鼠标事件
    1. 鼠标移动事件
    2. 鼠标点击事件
      更多关于点击事件的信息。
    3. 鼠标双击事件
  • 键盘事件
    1. 按键按下事件
    2. 按键抬起事件
  • 复选框列表
    • 未选中
    • 已选中

更多文本在这里。

如果您在列表内使用制表符进行缩进,请确保配置文件中的 TAB_SIZE 设置为正确的制表符大小。

您可以通过开始一个新段落来结束列表,或者在与您希望结束的列表相同缩进级别上的空行上放置一个点(.)。

这是一个不言自明的例子

/**
 * Text before the list
 * - list item 1
 *   - sub item 1
 *     - sub sub item 1
 *     - sub sub item 2
 *     . 
 *     The dot above ends the sub sub item list.
 *
 *     More text for the first sub item
 *   .
 *   The dot above ends the first sub item.
 *
 *   More text for the first list item
 *   - sub item 2
 *   - sub item 3
 * - list item 2
 * .
 * More text in the same paragraph.
 *
 * More text in a new paragraph.
 */

使用 HTML 命令

如果您愿意,也可以在文档块内使用 HTML 命令。

这是上面使用 HTML 命令的例子

  /*! 
   *  A list of events:
   *  <ul>
   *  <li> mouse events
   *     <ol>
   *     <li>mouse move event
   *     <li>mouse click event<br>
   *         More info about the click event.
   *     <li>mouse double click event
   *     </ol>
   *  <li> keyboard events
   *     <ol>     
   *     <li>key down event
   *     <li>key up event
   *     </ol>
   *  </ul>
   *  More text here.
   */
注意
在这种情况下,缩进并不重要。

使用 \arg 或 \li

为了与 Qt Software 的内部文档工具 qdoc 和 KDoc 兼容,Doxygen 有两个命令可以用于创建简单的非嵌套列表。

请参阅 \arg\li 获取更多信息。

前往下一节或返回索引