qt5base-lts/doc/global/htmltabs.qdocconf
Venugopal Shivashankar 98a94cd6da Doc: Add qdoc macro for tabbed content
The macro enables tabbed content in the online style
only. It's usage must be gaurded with a conditional
block as shown in the following example to handle
the offline style usecase:

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

Pick-to: 6.2 6.3
Change-Id: I02d50c057280a9ffea913642284e67ddcda7aa94
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2022-04-05 10:30:00 +02:00

61 lines
1.8 KiB
Plaintext

#Macros for HTML tabs
#Usage:
#\tab {name}{tab-id}{title}{checked}
#\tabcontent {tab-id}
# content
#\endtabcontent
# Ensure that the {name} is unique for the group.
# i.e A group of tabs can have the same name, whereas
# {tab-id} should be unique. In addition, the argument
# for \tabcontent macro should match the {tab-id} for the
# corresponding \tab.
# The {checked} argument ensures that the tab is selected
# by default when the HTML page is loaded. For the other
# tabs that are not selected, pass and empty argument {}.
#
# Note that these macros work with the online template only.
#
# Example:
# \if(onlinedocs)
# \tab {build-qt-app}{tab-cmake}{CMake}{selected}
# \tab {build-qt-app}{tab-qmake}{qmake}{}
# \tabcontent {tab-cmake}
# \else
# \section1 Using CMake
# \endif
# CMake-specific instructions go here
# \if(onlinedocs)
# \endtabcontent
# \tabcontent {tab-qmake}
# \else
# \section1 Using qmake
# \endif
# qmake-specific instructions go here
# \if(onlinedocs)
# \endtabcontent
# \endif
macro.tab.HTML = "<input type=\"radio\" name=\"tabs_\1\" id=\"\2\" \4/><label for=\"\2\">\3</label><style>#\2:checked ~ .\2{display: block;}</style>"
macro.tabcontent.HTML = "<div class=\"tabcontent \1\">"
macro.endtabcontent.HTML = "</div>"
HTML.extraimages += template/style/htmltabs.css
HTML.headerstyle += \
" <link rel=\"stylesheet\" type=\"text/css\" href=\"images/htmltabs.css\" />\n"
HTML.headerscripts += \
" <script type=\"text/javascript\">\n" \
" \$(document).ready(function(){\n" \
" \$(\"input[type=radio]\").on(\"click\", function() {\n" \
" var lbl = \$(this).next().text();\n" \
" \$(\"input[type=radio]:not(checked)\").filter(function() {\n" \
" if (\$(this).next().text() == lbl)\n" \
" \$(this).prop(\"checked\", true);\n" \
" });\n" \
" });\n" \
" });\n" \
" </script>\n"