<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qfinalstate.cpp --> <title>QFinalState Class | Qt Core 5.12.6</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.12</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QFinalState</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtcore-index.html">Qt 5.12.6 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#static-public-members">Static Public Members</a></li> <li class="level1"><a href="#reimplemented-protected-functions">Reimplemented Protected Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QFinalState Class</h1> <!-- $$$QFinalState-brief --> <p>The <a href="qfinalstate.html">QFinalState</a> class provides a final state. <a href="#details">More...</a></p> <!-- @@@QFinalState --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QFinalState></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.6</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qabstractstate.html">QAbstractState</a></td></tr></table></div><ul> <li><a href="qfinalstate-members.html">List of all members, including inherited members</a></li> <li><a href="qfinalstate-obsolete.html">Obsolete members</a></li> </ul> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qfinalstate.html#QFinalState">QFinalState</a></b>(QState *<i>parent</i> = nullptr)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qfinalstate.html#dtor.QFinalState">~QFinalState</a></b>()</td></tr> </table></div> <ul> <li class="fn">3 public functions inherited from <a href="qabstractstate.html#public-functions">QAbstractState</a></li> <li class="fn">32 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li> </ul> <a name="static-public-members"></a> <h2 id="static-public-members">Static Public Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> const QMetaObject </td><td class="memItemRight bottomAlign"><b><a href="qfinalstate.html#staticMetaObject-var">staticMetaObject</a></b></td></tr> </table></div> <ul> <li class="fn">10 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li> </ul> <a name="reimplemented-protected-functions"></a> <h2 id="reimplemented-protected-functions">Reimplemented Protected Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qfinalstate.html#event">event</a></b>(QEvent *<i>e</i>) override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qfinalstate.html#onEntry">onEntry</a></b>(QEvent *<i>event</i>) override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qfinalstate.html#onExit">onExit</a></b>(QEvent *<i>event</i>) override</td></tr> </table></div> <ul> <li class="fn">3 protected functions inherited from <a href="qabstractstate.html#protected-functions">QAbstractState</a></li> <li class="fn">9 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 property inherited from <a href="qabstractstate.html#properties">QAbstractState</a></li> <li class="fn">1 property inherited from <a href="qobject.html#properties">QObject</a></li> <li class="fn">1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li> <li class="fn">3 signals inherited from <a href="qabstractstate.html#signals">QAbstractState</a></li> <li class="fn">2 signals inherited from <a href="qobject.html#signals">QObject</a></li> <li class="fn">3 protected functions inherited from <a href="qabstractstate.html#protected-functions">QAbstractState</a></li> <li class="fn">9 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li> </ul> <a name="details"></a> <!-- $$$QFinalState-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qfinalstate.html">QFinalState</a> class provides a final state.</p> <p>A final state is used to communicate that (part of) a <a href="qstatemachine.html">QStateMachine</a> has finished its work. When a final top-level state is entered, the state machine's <a href="qstate.html#finished">finished</a>() signal is emitted. In general, when a final substate (a child of a <a href="qstate.html">QState</a>) is entered, the parent state's <a href="qstate.html#finished">finished</a>() signal is emitted. <a href="qfinalstate.html">QFinalState</a> is part of <a href="statemachine-api.html">The State Machine Framework</a>.</p> <p>To use a final state, you create a <a href="qfinalstate.html">QFinalState</a> object and add a transition to it from another state. Example:</p> <pre class="cpp"> <span class="type"><a href="../qtwidgets/qpushbutton.html">QPushButton</a></span> button; <span class="type"><a href="qstatemachine.html">QStateMachine</a></span> machine; <span class="type"><a href="qstate.html">QState</a></span> <span class="operator">*</span>s1 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qstate.html">QState</a></span>(); <span class="type"><a href="qfinalstate.html#QFinalState">QFinalState</a></span> <span class="operator">*</span>s2 <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qfinalstate.html#QFinalState">QFinalState</a></span>(); s1<span class="operator">-</span><span class="operator">></span>addTransition(<span class="operator">&</span>button<span class="operator">,</span> SIGNAL(clicked())<span class="operator">,</span> s2); machine<span class="operator">.</span>addState(s1); machine<span class="operator">.</span>addState(s2); <span class="type"><a href="qobject.html#QObject">QObject</a></span><span class="operator">::</span>connect(<span class="operator">&</span>machine<span class="operator">,</span> SIGNAL(finished())<span class="operator">,</span> <span class="type"><a href="../qtwidgets/qapplication.html">QApplication</a></span><span class="operator">::</span>instance()<span class="operator">,</span> SLOT(quit())); machine<span class="operator">.</span>setInitialState(s1); machine<span class="operator">.</span>start(); </pre> </div> <p><b>See also </b><a href="qstate.html#finished">QState::finished</a>().</p> <!-- @@@QFinalState --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QFinalState[overload1]$$$QFinalStateQState* --> <h3 class="fn" id="QFinalState"><a name="QFinalState"></a>QFinalState::<span class="name">QFinalState</span>(<span class="type"><a href="qstate.html">QState</a></span> *<i>parent</i> = nullptr)</h3> <p>Constructs a new <a href="qfinalstate.html">QFinalState</a> object with the given <i>parent</i> state.</p> <!-- @@@QFinalState --> <!-- $$$~QFinalState[overload1]$$$~QFinalState --> <h3 class="fn" id="dtor.QFinalState"><a name="dtor.QFinalState"></a><code>[virtual] </code>QFinalState::<span class="name">~QFinalState</span>()</h3> <p>Destroys this final state.</p> <!-- @@@~QFinalState --> <!-- $$$event[overload1]$$$eventQEvent* --> <h3 class="fn" id="event"><a name="event"></a><code>[override virtual protected] </code><span class="type">bool</span> QFinalState::<span class="name">event</span>(<span class="type"><a href="qevent.html">QEvent</a></span> *<i>e</i>)</h3> <p>Reimplemented from <a href="qabstractstate.html#event">QAbstractState::event</a>().</p> <!-- @@@event --> <!-- $$$onEntry[overload1]$$$onEntryQEvent* --> <h3 class="fn" id="onEntry"><a name="onEntry"></a><code>[override virtual protected] </code><span class="type">void</span> QFinalState::<span class="name">onEntry</span>(<span class="type"><a href="qevent.html">QEvent</a></span> *<i>event</i>)</h3> <p>Reimplemented from <a href="qabstractstate.html#onEntry">QAbstractState::onEntry</a>().</p> <!-- @@@onEntry --> <!-- $$$onExit[overload1]$$$onExitQEvent* --> <h3 class="fn" id="onExit"><a name="onExit"></a><code>[override virtual protected] </code><span class="type">void</span> QFinalState::<span class="name">onExit</span>(<span class="type"><a href="qevent.html">QEvent</a></span> *<i>event</i>)</h3> <p>Reimplemented from <a href="qabstractstate.html#onExit">QAbstractState::onExit</a>().</p> <!-- @@@onExit --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 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>