包含图片
使用图形命令可以在文档中包含图像。图片可以作为单独的段落呈现,也可以在运行文本中呈现。
\图像
\image 命令会扩展到其第一个参数指定的图像,并将其作为单独的段落居中显示。
该命令需要两个参数。第一个参数是图像文件的名称。第二个参数是可选参数,是对图像的简单描述,相当于图像标记中的 HTML alt=""。描述用于工具提示和不支持图片的浏览器,如 Lynx 文本浏览器。
文件名后的剩余文本是可选的描述参数。请务必在文件名或描述后面换行。如果描述参数跨多行,则需要使用大括号。
/*!
Qt is a C++ toolkit for cross-platform GUI application development.
\image happyguy.jpg "Happy guy"
Qt provides single-source portability across Microsoft
Windows, macOS, Linux, and all major commercial Unix
variants. It is also available for embedded devices.
*/另请参阅\inlineimage和 \caption。
\行图像
\inlineimage 命令会扩展到其参数指定的图像。图像将与文本的其余部分一起内联渲染。
该命令需要两个参数。第一个参数是图像文件的名称。第二个参数是可选参数,是大括号 {} 中对图片的简单描述,相当于图片标记中的 HTML alt=""。描述用于工具提示,也可用于浏览器不支持图片的情况,如 Lynx 文本浏览器。
\inlineimage 命令最常用于列表和表格。下面是一个在列表中包含内联图像的示例:
/*!
\list 1
\li \inlineimage happy.gif {Oh so happy, I am a caption!}
\li \inlineimage happy.gif Oh so happy, but I'm not a caption.
\endlist
*/下面是在表格中包含内联图像的示例:
/*!
\table
\header
\li Qt
\li Qt Creator
\row
\li \inlineimage happy.gif {Oh so happy!}
\li \inlineimage happy.gif Oh so happy!
\row
\li \inlineimage happy.gif Oh so happy!
\li \inlineimage happy.gif {Oh so happy!}
\endtable
*/该命令还可用于在文本中插入内嵌图片。
/*!
\inlineimage training.jpg {Qt Training} The Qt Programming course is
offered as a five day Open Enrollment Course. The classes are open to
the public. Although the course is open to anyone who wants to learn,
attendees should have significant experience in C++ development to
derive maximum benefit from the course.
*/\caption
caption 命令为图像提供标题。
该命令将段落末尾的所有文字作为标题。尝试一下,直到你得到想要的效果。
/*!
\table 100%
\row
\li \image windows-pushbutton.png
\caption The QPushButton widget provides a command button.
\li \image windows-toolbutton.png
\caption The QToolButton class provides a quick-access button to commands
or options, usually used inside a QToolBar.
\endtable
*/另请参见\image和\inlineimage
© 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.