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