文档结构

文档结构化命令用于将文档划分为多个部分。QDoc 支持四种级别的章节:\section1,\section2,\section3, 和\section4 。章节命令对应于大纲中使用的传统章节、小节等。

章节命令

一般来说,文档结构化命令会将其后面直到第一个换行符的所有内容作为参数。参数将作为单元标题呈现。如果标题需要跨几行,请确保每一行(最后一行除外)都以反斜线结束。

QDoc 中的章节共有四个级别:\section1\section2\section3\section4 。它们分别对应于传统的节、小节、子小节和子小节。

章节单元有严格的排序:

section1
      |
      section2
             |
             section3
                    |
                    section4

使用小节时,第一个小节命令应为section1

/*!
    \section1 Basic Qt

    This is the first section.


        \section2 Getting Started

        This is the first subsection.


            \section3 Hello Qt

            This is the first subsubsection.


            \section3 Making Connections

            This is the second subsubsection.


            \section3 Using the Reference Documentation

            This is the third subsubsection.


        \section2 Creating Dialogs

        This is the second subsection.


            \section3 Subclassing QDialog

            This is the first subsubsection.

            ...


    \section1 Intermediate Qt

    This is the second section.


        \section2 Layout Management

        This is the second section's first subsection.


            \section3 Basic Layouts

            This is the first subsubsection.

        ...
*/

每个章节都是文档中的一个逻辑单元。章节标题通常出现在页面右上角自动生成的目录中。

\第 1 节

\section1 命令启动一个新章节。

有关各种章节单元、命令参数和渲染的解释,请参阅章节命令

\section2

\section2 命令启动一个新的章节。

有关各种章节单元、命令参数和渲染的解释,请参阅章节命令

\section3

\section3 命令启动一个新的章节。

有关各种章节单元、命令参数和渲染的解释,请参阅章节命令

\section4

\section4 命令启动一个新的章节。

有关各种章节单元、命令参数和渲染的解释,请参阅章节命令

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.