| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | #include "qfinalstate.h" | - |
| 43 | | - |
| 44 | #ifndef QT_NO_STATEMACHINE | - |
| 45 | | - |
| 46 | #include "qabstractstate_p.h" | - |
| 47 | | - |
| 48 | QT_BEGIN_NAMESPACE | - |
| 49 | | - |
| 50 | /*! | - |
| 51 | \class QFinalState | - |
| 52 | \inmodule QtCore | - |
| 53 | | - |
| 54 | \brief The QFinalState class provides a final state. | - |
| 55 | | - |
| 56 | \since 4.6 | - |
| 57 | \ingroup statemachine | - |
| 58 | | - |
| 59 | A final state is used to communicate that (part of) a QStateMachine has | - |
| 60 | finished its work. When a final top-level state is entered, the state | - |
| 61 | machine's \l{QStateMachine::finished()}{finished}() signal is emitted. In | - |
| 62 | general, when a final substate (a child of a QState) is entered, the parent | - |
| 63 | state's \l{QState::finished()}{finished}() signal is emitted. QFinalState | - |
| 64 | is part of \l{The State Machine Framework}. | - |
| 65 | | - |
| 66 | To use a final state, you create a QFinalState object and add a transition | - |
| 67 | to it from another state. Example: | - |
| 68 | | - |
| 69 | \code | - |
| 70 | QPushButton button; | - |
| 71 | | - |
| 72 | QStateMachine machine; | - |
| 73 | QState *s1 = new QState(); | - |
| 74 | QFinalState *s2 = new QFinalState(); | - |
| 75 | s1->addTransition(&button, SIGNAL(clicked()), s2); | - |
| 76 | machine.addState(s1); | - |
| 77 | machine.addState(s2); | - |
| 78 | | - |
| 79 | QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit())); | - |
| 80 | machine.setInitialState(s1); | - |
| 81 | machine.start(); | - |
| 82 | \endcode | - |
| 83 | | - |
| 84 | \sa QState::finished() | - |
| 85 | */ | - |
| 86 | | - |
| 87 | class QFinalStatePrivate : public QAbstractStatePrivate | - |
| 88 | { | - |
| 89 | Q_DECLARE_PUBLIC(QFinalState) | - |
| 90 | | - |
| 91 | public: | - |
| 92 | QFinalStatePrivate(); | - |
| 93 | }; | - |
| 94 | | - |
| 95 | QFinalStatePrivate::QFinalStatePrivate() | - |
| 96 | : QAbstractStatePrivate(FinalState) | - |
| 97 | { | - |
| 98 | } executed: }Execution Count:60 | 60 |
| 99 | | - |
| 100 | /*! | - |
| 101 | Constructs a new QFinalState object with the given \a parent state. | - |
| 102 | */ | - |
| 103 | QFinalState::QFinalState(QState *parent) | - |
| 104 | : QAbstractState(*new QFinalStatePrivate, parent) | - |
| 105 | { | - |
| 106 | } executed: }Execution Count:60 | 60 |
| 107 | | - |
| 108 | /*! | - |
| 109 | Destroys this final state. | - |
| 110 | */ | - |
| 111 | QFinalState::~QFinalState() | - |
| 112 | { | - |
| 113 | } | - |
| 114 | | - |
| 115 | /*! | - |
| 116 | \reimp | - |
| 117 | */ | - |
| 118 | void QFinalState::onEntry(QEvent *event) | - |
| 119 | { | - |
| 120 | Q_UNUSED(event); executed (the execution status of this line is deduced): (void)event;; | - |
| 121 | } executed: }Execution Count:70 | 70 |
| 122 | | - |
| 123 | /*! | - |
| 124 | \reimp | - |
| 125 | */ | - |
| 126 | void QFinalState::onExit(QEvent *event) | - |
| 127 | { | - |
| 128 | Q_UNUSED(event); executed (the execution status of this line is deduced): (void)event;; | - |
| 129 | } executed: }Execution Count:6 | 6 |
| 130 | | - |
| 131 | /*! | - |
| 132 | \reimp | - |
| 133 | */ | - |
| 134 | bool QFinalState::event(QEvent *e) | - |
| 135 | { | - |
| 136 | return QAbstractState::event(e); executed: return QAbstractState::event(e);Execution Count:1 | 1 |
| 137 | } | - |
| 138 | | - |
| 139 | QT_END_NAMESPACE | - |
| 140 | | - |
| 141 | #endif //QT_NO_STATEMACHINE | - |
| 142 | | - |
| | |