本页

特殊内容

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

\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命令类似,注释适用于简短而重要的语句。有关使用信息,请参阅《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命令可以使用 \generatelistlegalese 作为参数。这有助于生成与源代码相关的许可协议概览。

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

\warning

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