本页内容

特别内容

文档内容命令用于标识文档中的特定部分,这些部分具有特殊的呈现方式、概念含义或功能。

\quotation

\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
*/

位于 \quotation 块中的文本将在生成的 HTML 中显示为:

<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 写作指南》。

\notranslate

\notranslate 命令用于指示,当生成的输出被传递给语言翻译服务时,其参数不应被翻译。

其他命令(\c, \tt)具有相同的效果,但 `\notranslate ` 不会对参数进行任何样式处理。

该命令于 QDoc 6.10 版本中引入。

\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中:

/*!
   \namespace Qt

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

在以下场景中使用\brief \headerfile:

/*!
   \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.
*/

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