\youtube

生成在线文档时,会在 HTML 中嵌入 YouTube 视频。生成离线文档(.qch)时,会添加指向该视频的外部链接并附带缩略图。HTML 文档中会显示视频的缩略图及播放按钮。您需要将缩略图保存至项目文件夹中的\images\extraimages\ 目录下。

请使用以下 URL 在浏览器中打开缩略图:https://img.youtube.com/vi/<ID>/0.jpg 。其中<ID> 是该视频在 YouTube 上的 ID。例如,如果视频的 URL 为https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=youtu.be ,则其 ID 为dQw4w9WgXcQ 。请将图像文件保存为dQw4w9WgXcQ.jpg 。

您必须将缩略图文件的文件名添加到\images\extraimages\extraimages.qdocconf 中。例如:

{HTML.extraimages,qhp.qtdesignstudio.extraFiles} += \
    images/dQw4w9WgXcQ.jpg

要在文本中添加视频链接,请写:

\youtube dQw4w9WgXcQ

另请参 阅“宏”。

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