标签内容

使用以下宏创建标签,这些标签组中的 HTML 标签具有可比较或可替代的内容。例如,可以显示不同编程语言的代码片段。

使用制表符宏

\tab {name}{tab-id}{title}{checked}
\tabcontent {tab-id}
  content
\endtabcontent

注意: 这些宏仅适用于联机模板,因此通常需要使用条件文本才能在脱机帮助中获得良好效果。

例如,在选项卡中显示 CMake 和 qmake 编译系统的说明:

\if defined(onlinedocs)
  \tab {build-qt-app}{tab-cmake}{CMake}{checked}
  \tab {build-qt-app}{tab-qmake}{qmake}{}
  \tabcontent {tab-cmake}
\else
  \section1 Using CMake
\endif
  CMake-specific instructions go here
\if defined(onlinedocs)
  \endtabcontent
  \tabcontent {tab-qmake}
\else
  \section1 Using qmake
\endif
  qmake-specific instructions go here
\if defined(onlinedocs)
  \endtabcontent
\endif

\标签

\tab {name}{tab-id}{title}{checked}

指定选项卡组中的一个选项卡,该选项卡有名称、ID、标题和默认状态。

使用唯一名称指定哪些选项卡属于一个选项卡组。也就是说,一个组中的所有选项卡都有相同的名称。要将标签页相互区分开来,可在组内为每个标签页赋予一个唯一的标签页ID。使用此tab-id作为 \tabcontent 宏的值,可为标签页添加内容。

选中参数会在加载 HTML 页面时默认选择标签页。对于初始隐藏的标签页,可传递一个空参数 {}。

\标签内容

\tabcontent {tab-id}

为指定标签页ID的标签页添加内容。

\endtabcontent

标记以 \tabcontent 开始的标签页内容的结束。

另请参阅

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