<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qdoc-manual-contextcmds.qdoc --> <title>Relating Things | QDoc Manual 5.9</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.9</td><td ><a href="qdoc-index.html">QDoc Manual</a></td><td >Relating Things</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <link rel="prev" href="17-qdoc-commands-thread.html" /> <link rel="next" href="19-qdoc-commands-grouping.html" /> <p class="naviNextPrevious headerNavi"> <a class="prevPage" href="17-qdoc-commands-thread.html">Thread Support</a> <span class="naviSeparator"> ◦ </span> <a class="nextPage" href="19-qdoc-commands-grouping.html">Grouping Things</a> </p><p/> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#commands">Commands</a></li> <li class="level2"><a href="#inherits">\inherits</a></li> <li class="level2"><a href="#overload">\overload</a></li> <li class="level2"><a href="#reimp">\reimp</a></li> <li class="level2"><a href="#relates">\relates</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">Relating Things</h1> <span class="subtitle"></span> <!-- $$$18-qdoc-commands-relating.html-description --> <div class="descr"> <a name="details"></a> <p>The relating commands are for specifying how one documented element relates to another documented element. Some examples:</p> <ul> <li>This function is an overload of another function.</li> <li>This function is a reimplementation of another function.</li> <li>This typedef is <i>related</i> to some class or header file.</li> </ul> <p>There is also a command for documenting that a QML type inherits some other QML type.</p> <a name="commands"></a> <h2 id="commands">Commands</h2> <a name="inherits-command"></a><a name="inherits"></a> <h3 >\inherits</h3> <p>The \inherits command is for documenting that one QML type inherits some other QML type. It must be included in the inheriting element's <a href="13-qdoc-commands-topics.html#qmltype-command">\qmltype</a> comment. The argument is the name of the inherited QML type.</p> <pre class="cpp"> <span class="operator">/</span> <span class="operator">*</span><span class="operator">!</span> \qmltype PauseAnimation \instantiates <span class="type">QDeclarativePauseAnimation</span> \ingroup qml<span class="operator">-</span>animation<span class="operator">-</span>transition \since <span class="number">4.7</span> \inherits Animation \brief The PauseAnimation element provides a pause <span class="keyword">for</span> an animation<span class="operator">.</span> When used in a SequentialAnimation<span class="operator">,</span> PauseAnimation is a step when nothing happens<span class="operator">,</span> <span class="keyword">for</span> a specified duration<span class="operator">.</span> A <span class="number">500ms</span> animation sequence<span class="operator">,</span> with a <span class="number">100ms</span> pause between two animations: SequentialAnimation { NumberAnimation { <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> duration: <span class="number">200</span> } PauseAnimation { duration: <span class="number">100</span> } NumberAnimation { <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span> duration: <span class="number">200</span> } } \sa {QML Animation and Transitions}<span class="operator">,</span> {declarative<span class="operator">/</span>animation<span class="operator">/</span>basics}{Animation basics example} <span class="operator">*</span> <span class="operator">/</span> </pre> <p>QDoc includes this line on the reference page for the <a href="http://qt-project.org/doc/qt-4.7/qml-pauseanimation.html">PauseAnimation</a> element:</p> <blockquote><p>Inherits <a href="http://qt-project.org/doc/qt-4.7/qml-animation.html">Animation</a></p> </blockquote> <a name="overload-command"></a><a name="overload"></a> <h3 >\overload</h3> <p>The \overload command is for indicating that a function is a secondary overload of its name.</p> <p>The command must stand on its own line.</p> <p>For a function name that is overloaded (except constructors), QDoc expects one primary version of the function, and all the others marked with the <b>\overload command</b>. The primary version should be fully documented. Each overload can have whatever extra documentation you want to add for just that overloaded version.</p> <p>From Qt 4.5, you can include the function name plus '()' as a parameter to the <b>\overload</b> command, which will include a standard <i>This function overloads...</i> line of text with a link to the documentation for the primary version of the function.</p> <pre class="cpp"> <span class="operator">/</span> <span class="operator">*</span><span class="operator">!</span> \overload addAction() This convenience function creates a <span class="keyword">new</span> action with an \a icon and some \a text<span class="operator">.</span> The function adds the newly created action to the menu<span class="char">'s list of actions, and returns it. \sa QWidget::addAction() * / QAction *QMenu::addAction(const QIcon &icon, const QString &text) { QAction *ret = new QAction(icon, text, this); addAction(ret); return ret; } </span> </pre> <p>QDoc renders this as:</p> <blockquote> <h3><a href="http://doc.qt.io/qt-5/qaction.html">QAction</a> * QMenu::addAction ( const QIcon & <i>icon</i>, const QString & <i>text</i> ) </h3> <p>This function overloads addAction()</p> <p>This convenience function creates a new action with an <i>icon</i> and some <i>text</i>. The function adds the newly created action to the menu's list of actions, and returns it.</p> <p>See also QWidget::addAction().</p> </blockquote> <p>If you don't include the function name with the <b>\overload</b> command, then instead of the "This function overloads..." line with the link to the documentation for the primary version, you get the old standard line:</p> <blockquote><p>This is an overloaded member function, provided for convenience.</p> </blockquote> <p>.</p> <a name="reimp-command"></a><a name="reimp"></a> <h3 >\reimp</h3> <p>The \reimp command is for indicating that a function is a reimplementation of a virtual function.</p> <p>The command must stand on its own line.</p> <p>QDoc will omit the reimplemented function from the class reference.</p> <pre class="cpp"> <span class="operator">/</span> <span class="operator">*</span><span class="operator">!</span> \reimp <span class="operator">*</span> <span class="operator">/</span> <span class="type">void</span> <span class="type">QToolButton</span><span class="operator">::</span>nextCheckState() { Q_D(<span class="type">QToolButton</span>); <span class="keyword">if</span> (<span class="operator">!</span>d<span class="operator">-</span><span class="operator">></span>defaultAction) <span class="type">QAbstractButton</span><span class="operator">::</span>nextCheckState(); <span class="keyword">else</span> d<span class="operator">-</span><span class="operator">></span>defaultAction<span class="operator">-</span><span class="operator">></span>trigger(); } </pre> <p>This function will not be included in the documentation. Instead, a link to the base function QAbstractButton::nextCheckState() will appear in the documentation.</p> <a name="relates-command"></a><a name="relates"></a> <h3 >\relates</h3> <p>The \relates command is for including the documentation of a global element to some class or header file. The argument is a class name or header file.</p> <pre class="cpp"> <span class="operator">/</span> <span class="operator">*</span><span class="operator">!</span> \relates <span class="type">QChar</span> Reads a <span class="type">char</span> from the stream \a in into <span class="type">char</span> \a chr<span class="operator">.</span> \sa {Format of the <span class="type">QDataStream</span> operators} <span class="operator">*</span> <span class="operator">/</span> <span class="type">QDataStream</span> <span class="operator">&</span><span class="keyword">operator</span><span class="operator">></span><span class="operator">></span>(<span class="type">QDataStream</span> <span class="operator">&</span>in<span class="operator">,</span> <span class="type">QChar</span> <span class="operator">&</span>chr) { <span class="type">quint16</span> u; in <span class="operator">></span><span class="operator">></span> u; chr<span class="operator">.</span>unicode() <span class="operator">=</span> <span class="type">ushort</span>(u); <span class="keyword">return</span> in; } </pre> <p>The documentation for this function will be included on the reference page for class QChar.</p> </div> <!-- @@@18-qdoc-commands-relating.html --> <p class="naviNextPrevious footerNavi"> <a class="prevPage" href="17-qdoc-commands-thread.html">Thread Support</a> <span class="naviSeparator"> ◦ </span> <a class="nextPage" href="19-qdoc-commands-grouping.html">Grouping Things</a> </p> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br> 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. </p> </div> </body> </html>