特殊内容

文件内容命令用于识别文件中具有特殊效果、概念含义或功能的部分。

\引用

\quotation 和 \endquotation 命令对长引文进行定界。

在 html 输出中,分隔块中的文本由<blockquote></blockquote>包围,例如

/*!
  Although the prospect of a significantly broader market is
  good news for Firstlogic, the notion also posed some
  challenges. Dave Dobson, director of technology for the La
  Crosse, Wisconsin-based company, said:

  \quotation
     As our solutions were being adopted into new
     environments, we saw an escalating need for easier
     integration with a wider range of enterprise
     applications.
  \endquotation
*/

在生成的 HTML 中,\quotation块中的文本将显示为

<blockquote>
  <p>As our solutions were being adopted into new environments,
  we saw an escalating need for easier integration with a wider
  range of enterprise applications.</p>
</blockquote>

大多数浏览器的内置样式表会以左右缩进的方式呈现 <blockquote> 标记的内容。上面的示例将显示为

随着我们的解决方案被采用到新的环境中,我们发现与更广泛的企业应用程序进行更简便集成的需求在不断增长。

但您可以在 style.css 文件中重新定义<blockquote>标记。

\注释

\note 命令定义一个新段落,段落前用粗体 "Note: "标出。该命令将一个连续的段落作为参数,在段落结束后终止。note 命令只适用于较短的语句,不适用于较长的多行段落。

\warning命令类似,note 也适用于简短而重要的语句。有关使用信息,请参阅《Qt 写作指南》

\内容表

由于 QDoc 现在会自动生成目录,因此禁用了 \tableofcontents 命令。

自动生成的目录显示在页面的右上角。

\brief

brief 命令对任何主题命令进行一句话描述。

简介文本用于介绍相关对象的文档,以及使用\generatelist命令和\annotatedlist命令生成的列表。

简短文本将显示在该特定主题的文档中。

例如,布尔QWidget::isWindow 属性:

/*!
   \property QWidget::isActiveWindow
   \brief Whether this widget's window is the active window.

   The active window is the window that contains the widget that
   has keyboard focus.

   When popup windows are visible, this property is \c true
   for both the active window \e and the popup.

   \sa activateWindow(), QApplication::activeWindow()
*/

QWidget::geometry 属性

/*!
   \property QWidget::geometry
   \brief The geometry of the widget relative to its parent and
   excluding the window frame.

   When changing the geometry, the widget, if visible,
   receives a move event (moveEvent()) and/or a resize
   event (resizeEvent()) immediately.

   ...

  \sa frameGeometry(), rect(), ...
*/

当使用 \brief 命令描述一个类时,我们建议使用这样一个完整的句子:

The <classname> class is|provides|contains|specifies...

警告: 不要用同一个句子重复详细描述,因为简要说明将是详细描述的第一段。

/*!
   \class PreviewWindow
   \brief The PreviewWindow class is a custom widget
          displaying the names of its currently set
          window flags in a read-only text editor.

   The PreviewWindow class inherits QWidget. The widget
   displays the names of its window flags set with the
   setWindowFlags() function. It is also provided with a
   QPushButton that closes the window.

   ...

   \sa QWidget
*/

名称空间中使用 (brief):

/*!
   \namespace Qt

   \brief The Qt namespace contains miscellaneous identifiers
   used throughout the Qt library.
*/

headerfile 中使用 (brief):

/*!
   \headerfile <QtGlobal>
   \title Global Qt Declarations

   \brief The <QtGlobal> header file provides basic
   declarations and is included by all other Qt headers.

   \sa <QtAlgorithms>
*/

另请参见\property,\class,\namespace\headerfile.

\legalese

\legalese 和 \endlegalese 命令用于限定许可协议。

在生成的 HTML 中,被分隔的文本由<div class="LegaleseLeft"></div>标记包围。

用 \legalese 和 \endlegalese 包围的许可协议示例:

/*!
    \legalese
        Copyright 1996 Daniel Dardailler.

        Permission to use, copy, modify, distribute, and sell this
        software for any purpose is hereby granted without fee,
        provided that the above copyright notice appear in all
        copies and that both that copyright notice and this
        permission notice appear in supporting documentation, and
        that the name of Daniel Dardailler not be used in
        advertising or publicity pertaining to distribution of the
        software without specific, written prior permission. Daniel
        Dardailler makes no representations about the suitability of
        this software for any purpose. It is provided "as is"
        without express or implied warranty.

        Modifications Copyright 1999 Matt Koss, under the same
        license as above.
    \endlegalese
*/

在生成的 HTML 中将显示为

<div class="LegaleseLeft">
   <p>Copyright 1996 Daniel Dardailler.</p>
   <p>Permission to use, copy, modify, distribute, and sell
   this software for any purpose is hereby granted without fee,
   provided that the above copyright notice appear in all
   copies and that both that copyright notice and this
   permission notice appear in supporting documentation, and
   that the name of Daniel Dardailler not be used in
   advertising or publicity pertaining to distribution of the
   software without specific, written prior permission. Daniel
   Dardailler makes no representations about the suitability of
   this software for any purpose. It is provided "as is"
   without express or implied warranty.</p>

   <p>Modifications Copyright 1999 Matt Koss, under the same
   license as above.</p>
</div>

如果省略了 \endlegalese 命令,QDoc 将处理 \legalese 命令,但会将文档页面的其余部分视为许可协议。

理想情况下,许可文本与许可代码放在一起。

在其他地方,可以使用legalese 作为参数的\generatelist来累积识别为\legalese命令的文档。这对于生成与源代码相关的许可协议概览非常有用。

注意: \generatelist legalese 命令的输出只包括当前文档项目中的\legalese 文本。如果当前文档项目依赖于其他模块,则不会列出它们的许可证文本。

\警告

Warning 命令会在命令参数前加上 "Warning:"(警告),字体为粗体。

/*!
   Qt::HANDLE is a platform-specific handle type
   for system objects. This is  equivalent to
   \c{void *} on Windows and macOS, and to
   \c{unsigned long} on X11.

   \warning Using this type is not portable.
*/

© 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.