| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/statemachine/qfinalstate.cpp | 
| Source code | Switch to Preprocessed file | 
| Line | Source | Count | 
|---|---|---|
| 1 | /**************************************************************************** | - | 
| 2 | ** | - | 
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | 
| 4 | ** Contact: https://www.qt.io/licensing/ | - | 
| 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 The Qt Company. For licensing terms | - | 
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | 
| 15 | ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software | - | 
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | 
| 21 | ** packaging of this file. Please review the following information to | - | 
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | 
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | 
| 24 | ** | - | 
| 25 | ** GNU General Public License Usage | - | 
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - | 
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - | 
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - | 
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - | 
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | 
| 31 | ** included in the packaging of this file. Please review the following | - | 
| 32 | ** information to ensure the GNU General Public License requirements will | - | 
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | 
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | 
| 35 | ** | - | 
| 36 | ** $QT_END_LICENSE$ | - | 
| 37 | ** | - | 
| 38 | ****************************************************************************/ | - | 
| 39 | - | |
| 40 | #include "qfinalstate_p.h" | - | 
| 41 | - | |
| 42 | #ifndef QT_NO_STATEMACHINE | - | 
| 43 | - | |
| 44 | QT_BEGIN_NAMESPACE | - | 
| 45 | - | |
| 46 | /*! | - | 
| 47 | \class QFinalState | - | 
| 48 | \inmodule QtCore | - | 
| 49 | - | |
| 50 | \brief The QFinalState class provides a final state. | - | 
| 51 | - | |
| 52 | \since 4.6 | - | 
| 53 | \ingroup statemachine | - | 
| 54 | - | |
| 55 | A final state is used to communicate that (part of) a QStateMachine has | - | 
| 56 | finished its work. When a final top-level state is entered, the state | - | 
| 57 | machine's \l{QStateMachine::finished()}{finished}() signal is emitted. In | - | 
| 58 | general, when a final substate (a child of a QState) is entered, the parent | - | 
| 59 | state's \l{QState::finished()}{finished}() signal is emitted. QFinalState | - | 
| 60 | is part of \l{The State Machine Framework}. | - | 
| 61 | - | |
| 62 | To use a final state, you create a QFinalState object and add a transition | - | 
| 63 | to it from another state. Example: | - | 
| 64 | - | |
| 65 | \code | - | 
| 66 | QPushButton button; | - | 
| 67 | - | |
| 68 | QStateMachine machine; | - | 
| 69 | QState *s1 = new QState(); | - | 
| 70 | QFinalState *s2 = new QFinalState(); | - | 
| 71 | s1->addTransition(&button, SIGNAL(clicked()), s2); | - | 
| 72 | machine.addState(s1); | - | 
| 73 | machine.addState(s2); | - | 
| 74 | - | |
| 75 | QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit())); | - | 
| 76 | machine.setInitialState(s1); | - | 
| 77 | machine.start(); | - | 
| 78 | \endcode | - | 
| 79 | - | |
| 80 | \sa QState::finished() | - | 
| 81 | */ | - | 
| 82 | - | |
| 83 | QFinalStatePrivate::QFinalStatePrivate() | - | 
| 84 | : QAbstractStatePrivate(FinalState) | - | 
| 85 | { | - | 
| 86 | } executed 62 times by 1 test:  end of blockExecuted by: 
 | 62 | 
| 87 | - | |
| 88 | QFinalStatePrivate::~QFinalStatePrivate() | - | 
| 89 | { | - | 
| 90 | // to prevent vtables being generated in every file that includes the private header | - | 
| 91 | } | - | 
| 92 | - | |
| 93 | /*! | - | 
| 94 | Constructs a new QFinalState object with the given \a parent state. | - | 
| 95 | */ | - | 
| 96 | QFinalState::QFinalState(QState *parent) | - | 
| 97 | : QAbstractState(*new QFinalStatePrivate, parent) | - | 
| 98 | { | - | 
| 99 | } executed 62 times by 1 test:  end of blockExecuted by: 
 | 62 | 
| 100 | - | |
| 101 | /*! | - | 
| 102 | \internal | - | 
| 103 | */ | - | 
| 104 | QFinalState::QFinalState(QFinalStatePrivate &dd, QState *parent) | - | 
| 105 | : QAbstractState(dd, parent) | - | 
| 106 | { | - | 
| 107 | } never executed:  end of block | 0 | 
| 108 | - | |
| 109 | - | |
| 110 | /*! | - | 
| 111 | Destroys this final state. | - | 
| 112 | */ | - | 
| 113 | QFinalState::~QFinalState() | - | 
| 114 | { | - | 
| 115 | } | - | 
| 116 | - | |
| 117 | /*! | - | 
| 118 | \reimp | - | 
| 119 | */ | - | 
| 120 | void QFinalState::onEntry(QEvent *event) | - | 
| 121 | { | - | 
| 122 | Q_UNUSED(event); | - | 
| 123 | } executed 72 times by 1 test:  end of blockExecuted by: 
 | 72 | 
| 124 | - | |
| 125 | /*! | - | 
| 126 | \reimp | - | 
| 127 | */ | - | 
| 128 | void QFinalState::onExit(QEvent *event) | - | 
| 129 | { | - | 
| 130 | Q_UNUSED(event); | - | 
| 131 | } executed 7 times by 1 test:  end of blockExecuted by: 
 | 7 | 
| 132 | - | |
| 133 | /*! | - | 
| 134 | \reimp | - | 
| 135 | */ | - | 
| 136 | bool QFinalState::event(QEvent *e) | - | 
| 137 | { | - | 
| 138 | return QAbstractState::event(e); executed 1 time by 1 test:  return QAbstractState::event(e);Executed by: 
 | 1 | 
| 139 | } | - | 
| 140 | - | |
| 141 | QT_END_NAMESPACE | - | 
| 142 | - | |
| 143 | #endif //QT_NO_STATEMACHINE | - | 
| Source code | Switch to Preprocessed file |