| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/statemachine/qabstracttransition.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 "qabstracttransition.h" | - | ||||||||||||
| 41 | - | |||||||||||||
| 42 | #ifndef QT_NO_STATEMACHINE | - | ||||||||||||
| 43 | - | |||||||||||||
| 44 | #include "qabstracttransition_p.h" | - | ||||||||||||
| 45 | #include "qabstractstate.h" | - | ||||||||||||
| 46 | #include "qhistorystate.h" | - | ||||||||||||
| 47 | #include "qstate.h" | - | ||||||||||||
| 48 | #include "qstatemachine.h" | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 51 | - | |||||||||||||
| 52 | /*! | - | ||||||||||||
| 53 | \class QAbstractTransition | - | ||||||||||||
| 54 | \inmodule QtCore | - | ||||||||||||
| 55 | - | |||||||||||||
| 56 | \brief The QAbstractTransition class is the base class of transitions between QAbstractState objects. | - | ||||||||||||
| 57 | - | |||||||||||||
| 58 | \since 4.6 | - | ||||||||||||
| 59 | \ingroup statemachine | - | ||||||||||||
| 60 | - | |||||||||||||
| 61 | The QAbstractTransition class is the abstract base class of transitions | - | ||||||||||||
| 62 | between states (QAbstractState objects) of a | - | ||||||||||||
| 63 | QStateMachine. QAbstractTransition is part of \l{The State Machine | - | ||||||||||||
| 64 | Framework}. | - | ||||||||||||
| 65 | - | |||||||||||||
| 66 | The sourceState() function returns the source of the transition. The | - | ||||||||||||
| 67 | targetStates() function returns the targets of the transition. The machine() | - | ||||||||||||
| 68 | function returns the state machine that the transition is part of. | - | ||||||||||||
| 69 | - | |||||||||||||
| 70 | The triggered() signal is emitted when the transition has been triggered. | - | ||||||||||||
| 71 | - | |||||||||||||
| 72 | Transitions can cause animations to be played. Use the addAnimation() | - | ||||||||||||
| 73 | function to add an animation to the transition. | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | \section1 Subclassing | - | ||||||||||||
| 76 | - | |||||||||||||
| 77 | The eventTest() function is called by the state machine to determine whether | - | ||||||||||||
| 78 | an event should trigger the transition. In your reimplementation you | - | ||||||||||||
| 79 | typically check the event type and cast the event object to the proper type, | - | ||||||||||||
| 80 | and check that one or more properties of the event meet your criteria. | - | ||||||||||||
| 81 | - | |||||||||||||
| 82 | The onTransition() function is called when the transition is triggered; | - | ||||||||||||
| 83 | reimplement this function to perform custom processing for the transition. | - | ||||||||||||
| 84 | */ | - | ||||||||||||
| 85 | - | |||||||||||||
| 86 | /*! | - | ||||||||||||
| 87 | \property QAbstractTransition::sourceState | - | ||||||||||||
| 88 | - | |||||||||||||
| 89 | \brief the source state (parent) of this transition | - | ||||||||||||
| 90 | */ | - | ||||||||||||
| 91 | - | |||||||||||||
| 92 | /*! | - | ||||||||||||
| 93 | \property QAbstractTransition::targetState | - | ||||||||||||
| 94 | - | |||||||||||||
| 95 | \brief the target state of this transition | - | ||||||||||||
| 96 | - | |||||||||||||
| 97 | If a transition has no target state, the transition may still be | - | ||||||||||||
| 98 | triggered, but this will not cause the state machine's configuration to | - | ||||||||||||
| 99 | change (i.e. the current state will not be exited and re-entered). | - | ||||||||||||
| 100 | */ | - | ||||||||||||
| 101 | - | |||||||||||||
| 102 | /*! | - | ||||||||||||
| 103 | \property QAbstractTransition::targetStates | - | ||||||||||||
| 104 | - | |||||||||||||
| 105 | \brief the target states of this transition | - | ||||||||||||
| 106 | - | |||||||||||||
| 107 | If multiple states are specified, all must be descendants of the same | - | ||||||||||||
| 108 | parallel group state. | - | ||||||||||||
| 109 | */ | - | ||||||||||||
| 110 | - | |||||||||||||
| 111 | /*! | - | ||||||||||||
| 112 | \property QAbstractTransition::transitionType | - | ||||||||||||
| 113 | - | |||||||||||||
| 114 | \brief indicates whether this transition is an internal transition, or an external transition. | - | ||||||||||||
| 115 | - | |||||||||||||
| 116 | Internal and external transitions behave the same, except for the case of a transition whose | - | ||||||||||||
| 117 | source state is a compound state and whose target(s) is a descendant of the source. In such a | - | ||||||||||||
| 118 | case, an internal transition will not exit and re-enter its source state, while an external one | - | ||||||||||||
| 119 | will. | - | ||||||||||||
| 120 | - | |||||||||||||
| 121 | By default, the type is an external transition. | - | ||||||||||||
| 122 | */ | - | ||||||||||||
| 123 | - | |||||||||||||
| 124 | /*! | - | ||||||||||||
| 125 | \enum QAbstractTransition::TransitionType | - | ||||||||||||
| 126 | - | |||||||||||||
| 127 | This enum specifies the kind of transition. By default, the type is an external transition. | - | ||||||||||||
| 128 | - | |||||||||||||
| 129 | \value ExternalTransition Any state that is the source state of a transition (which is not a | - | ||||||||||||
| 130 | target-less transition) is left, and re-entered when necessary. | - | ||||||||||||
| 131 | \value InternalTransition If the target state of a transition is a sub-state of a compound state, | - | ||||||||||||
| 132 | and that compound state is the source state, an internal transition will | - | ||||||||||||
| 133 | not leave the source state. | - | ||||||||||||
| 134 | - | |||||||||||||
| 135 | \sa QAbstractTransition::transitionType | - | ||||||||||||
| 136 | */ | - | ||||||||||||
| 137 | - | |||||||||||||
| 138 | QAbstractTransitionPrivate::QAbstractTransitionPrivate() | - | ||||||||||||
| 139 | : transitionType(QAbstractTransition::ExternalTransition) | - | ||||||||||||
| 140 | { | - | ||||||||||||
| 141 | } executed 400 times by 2 tests: end of blockExecuted by:
| 400 | ||||||||||||
| 142 | - | |||||||||||||
| 143 | QStateMachine *QAbstractTransitionPrivate::machine() const | - | ||||||||||||
| 144 | { | - | ||||||||||||
| 145 | if (QState *source = sourceState())
| 90-400175 | ||||||||||||
| 146 | return source->machine(); executed 400175 times by 2 tests: return source->machine();Executed by:
| 400175 | ||||||||||||
| 147 | Q_Q(const QAbstractTransition); | - | ||||||||||||
| 148 | if (QHistoryState *parent = qobject_cast<QHistoryState *>(q->parent()))
| 0-90 | ||||||||||||
| 149 | return parent->machine(); never executed: return parent->machine(); | 0 | ||||||||||||
| 150 | return 0; executed 90 times by 2 tests: return 0;Executed by:
| 90 | ||||||||||||
| 151 | } | - | ||||||||||||
| 152 | - | |||||||||||||
| 153 | bool QAbstractTransitionPrivate::callEventTest(QEvent *e) | - | ||||||||||||
| 154 | { | - | ||||||||||||
| 155 | Q_Q(QAbstractTransition); | - | ||||||||||||
| 156 | return q->eventTest(e); executed 5952 times by 2 tests: return q->eventTest(e);Executed by:
| 5952 | ||||||||||||
| 157 | } | - | ||||||||||||
| 158 | - | |||||||||||||
| 159 | void QAbstractTransitionPrivate::callOnTransition(QEvent *e) | - | ||||||||||||
| 160 | { | - | ||||||||||||
| 161 | Q_Q(QAbstractTransition); | - | ||||||||||||
| 162 | q->onTransition(e); | - | ||||||||||||
| 163 | } executed 1320 times by 2 tests: end of blockExecuted by:
| 1320 | ||||||||||||
| 164 | - | |||||||||||||
| 165 | QState *QAbstractTransitionPrivate::sourceState() const | - | ||||||||||||
| 166 | { | - | ||||||||||||
| 167 | return qobject_cast<QState*>(parent); executed 603140 times by 2 tests: return qobject_cast<QState*>(parent);Executed by:
| 603140 | ||||||||||||
| 168 | } | - | ||||||||||||
| 169 | - | |||||||||||||
| 170 | void QAbstractTransitionPrivate::emitTriggered() | - | ||||||||||||
| 171 | { | - | ||||||||||||
| 172 | Q_Q(QAbstractTransition); | - | ||||||||||||
| 173 | emit q->triggered(QAbstractTransition::QPrivateSignal()); | - | ||||||||||||
| 174 | } executed 1391 times by 2 tests: end of blockExecuted by:
| 1391 | ||||||||||||
| 175 | - | |||||||||||||
| 176 | /*! | - | ||||||||||||
| 177 | Constructs a new QAbstractTransition object with the given \a sourceState. | - | ||||||||||||
| 178 | */ | - | ||||||||||||
| 179 | QAbstractTransition::QAbstractTransition(QState *sourceState) | - | ||||||||||||
| 180 | : QObject(*new QAbstractTransitionPrivate, sourceState) | - | ||||||||||||
| 181 | { | - | ||||||||||||
| 182 | } executed 304 times by 2 tests: end of blockExecuted by:
| 304 | ||||||||||||
| 183 | - | |||||||||||||
| 184 | /*! | - | ||||||||||||
| 185 | \internal | - | ||||||||||||
| 186 | */ | - | ||||||||||||
| 187 | QAbstractTransition::QAbstractTransition(QAbstractTransitionPrivate &dd, | - | ||||||||||||
| 188 | QState *parent) | - | ||||||||||||
| 189 | : QObject(dd, parent) | - | ||||||||||||
| 190 | { | - | ||||||||||||
| 191 | } executed 96 times by 2 tests: end of blockExecuted by:
| 96 | ||||||||||||
| 192 | - | |||||||||||||
| 193 | /*! | - | ||||||||||||
| 194 | Destroys this transition. | - | ||||||||||||
| 195 | */ | - | ||||||||||||
| 196 | QAbstractTransition::~QAbstractTransition() | - | ||||||||||||
| 197 | { | - | ||||||||||||
| 198 | } | - | ||||||||||||
| 199 | - | |||||||||||||
| 200 | /*! | - | ||||||||||||
| 201 | Returns the source state of this transition, or 0 if this transition has no | - | ||||||||||||
| 202 | source state. | - | ||||||||||||
| 203 | */ | - | ||||||||||||
| 204 | QState *QAbstractTransition::sourceState() const | - | ||||||||||||
| 205 | { | - | ||||||||||||
| 206 | Q_D(const QAbstractTransition); | - | ||||||||||||
| 207 | return d->sourceState(); executed 202875 times by 2 tests: return d->sourceState();Executed by:
| 202875 | ||||||||||||
| 208 | } | - | ||||||||||||
| 209 | - | |||||||||||||
| 210 | /*! | - | ||||||||||||
| 211 | Returns the target state of this transition, or 0 if the transition has no | - | ||||||||||||
| 212 | target. | - | ||||||||||||
| 213 | */ | - | ||||||||||||
| 214 | QAbstractState *QAbstractTransition::targetState() const | - | ||||||||||||
| 215 | { | - | ||||||||||||
| 216 | Q_D(const QAbstractTransition); | - | ||||||||||||
| 217 | if (d->targetStates.isEmpty())
| 2-17 | ||||||||||||
| 218 | return 0; executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||||||||
| 219 | return d->targetStates.first().data(); executed 17 times by 1 test: return d->targetStates.first().data();Executed by:
| 17 | ||||||||||||
| 220 | } | - | ||||||||||||
| 221 | - | |||||||||||||
| 222 | /*! | - | ||||||||||||
| 223 | Sets the \a target state of this transition. | - | ||||||||||||
| 224 | */ | - | ||||||||||||
| 225 | void QAbstractTransition::setTargetState(QAbstractState* target) | - | ||||||||||||
| 226 | { | - | ||||||||||||
| 227 | Q_D(QAbstractTransition); | - | ||||||||||||
| 228 | if ((d->targetStates.size() == 1 && target == d->targetStates.at(0).data()) ||
| 1-236 | ||||||||||||
| 229 | (d->targetStates.isEmpty() && target == 0)) {
| 1-236 | ||||||||||||
| 230 | return; executed 3 times by 1 test: return;Executed by:
| 3 | ||||||||||||
| 231 | } | - | ||||||||||||
| 232 | if (!target)
| 1-234 | ||||||||||||
| 233 | d->targetStates.clear(); executed 1 time by 1 test: d->targetStates.clear();Executed by:
| 1 | ||||||||||||
| 234 | else | - | ||||||||||||
| 235 | setTargetStates(QList<QAbstractState*>() << target); executed 234 times by 2 tests: setTargetStates(QList<QAbstractState*>() << target);Executed by:
| 234 | ||||||||||||
| 236 | emit targetStateChanged(QPrivateSignal()); | - | ||||||||||||
| 237 | } executed 235 times by 2 tests: end of blockExecuted by:
| 235 | ||||||||||||
| 238 | - | |||||||||||||
| 239 | /*! | - | ||||||||||||
| 240 | Returns the target states of this transition, or an empty list if this | - | ||||||||||||
| 241 | transition has no target states. | - | ||||||||||||
| 242 | */ | - | ||||||||||||
| 243 | QList<QAbstractState*> QAbstractTransition::targetStates() const | - | ||||||||||||
| 244 | { | - | ||||||||||||
| 245 | Q_D(const QAbstractTransition); | - | ||||||||||||
| 246 | QList<QAbstractState*> result; | - | ||||||||||||
| 247 | for (int i = 0; i < d->targetStates.size(); ++i) {
| 4184-4201 | ||||||||||||
| 248 | QAbstractState *target = d->targetStates.at(i).data(); | - | ||||||||||||
| 249 | if (target)
| 1-4183 | ||||||||||||
| 250 | result.append(target); executed 4183 times by 2 tests: result.append(target);Executed by:
| 4183 | ||||||||||||
| 251 | } executed 4184 times by 2 tests: end of blockExecuted by:
| 4184 | ||||||||||||
| 252 | return result; executed 4201 times by 2 tests: return result;Executed by:
| 4201 | ||||||||||||
| 253 | } | - | ||||||||||||
| 254 | - | |||||||||||||
| 255 | /*! | - | ||||||||||||
| 256 | Sets the target states of this transition to be the given \a targets. | - | ||||||||||||
| 257 | */ | - | ||||||||||||
| 258 | void QAbstractTransition::setTargetStates(const QList<QAbstractState*> &targets) | - | ||||||||||||
| 259 | { | - | ||||||||||||
| 260 | Q_D(QAbstractTransition); | - | ||||||||||||
| 261 | - | |||||||||||||
| 262 | // Verify if any of the new target states is a null-pointer: | - | ||||||||||||
| 263 | for (int i = 0; i < targets.size(); ++i) {
| 389-392 | ||||||||||||
| 264 | if (targets.at(i) == Q_NULLPTR) {
| 1-391 | ||||||||||||
| 265 | qWarning("QAbstractTransition::setTargetStates: target state(s) cannot be null"); | - | ||||||||||||
| 266 | return; executed 1 time by 1 test: return;Executed by:
| 1 | ||||||||||||
| 267 | } | - | ||||||||||||
| 268 | } executed 391 times by 2 tests: end of blockExecuted by:
| 391 | ||||||||||||
| 269 | - | |||||||||||||
| 270 | // First clean out any target states that got destroyed, but for which we still have a QPointer | - | ||||||||||||
| 271 | // around. | - | ||||||||||||
| 272 | for (int i = 0; i < d->targetStates.size(); ) {
| 1-389 | ||||||||||||
| 273 | if (d->targetStates.at(i).isNull()) {
| 0-1 | ||||||||||||
| 274 | d->targetStates.remove(i); | - | ||||||||||||
| 275 | } else { never executed: end of block | 0 | ||||||||||||
| 276 | ++i; | - | ||||||||||||
| 277 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 278 | } | - | ||||||||||||
| 279 | - | |||||||||||||
| 280 | // Easy check: if both lists are empty, we're done. | - | ||||||||||||
| 281 | if (targets.isEmpty() && d->targetStates.isEmpty())
| 0-389 | ||||||||||||
| 282 | return; never executed: return; | 0 | ||||||||||||
| 283 | - | |||||||||||||
| 284 | bool sameList = true; | - | ||||||||||||
| 285 | - | |||||||||||||
| 286 | if (targets.size() != d->targetStates.size()) {
| 1-388 | ||||||||||||
| 287 | // If the sizes of the lists are different, we don't need to be smart: they're different. So | - | ||||||||||||
| 288 | // we can just set the new list as the targetStates. | - | ||||||||||||
| 289 | sameList = false; | - | ||||||||||||
| 290 | } else { executed 388 times by 2 tests: end of blockExecuted by:
| 388 | ||||||||||||
| 291 | QVector<QPointer<QAbstractState> > copy(d->targetStates); | - | ||||||||||||
| 292 | for (int i = 0; i < targets.size(); ++i) {
| 1 | ||||||||||||
| 293 | sameList &= copy.removeOne(targets.at(i)); | - | ||||||||||||
| 294 | if (!sameList)
| 0-1 | ||||||||||||
| 295 | break; // ok, we now know the lists are not the same, so stop the loop. never executed: break; | 0 | ||||||||||||
| 296 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 297 | - | |||||||||||||
| 298 | sameList &= copy.isEmpty(); | - | ||||||||||||
| 299 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 300 | - | |||||||||||||
| 301 | if (sameList)
| 1-388 | ||||||||||||
| 302 | return; executed 1 time by 1 test: return;Executed by:
| 1 | ||||||||||||
| 303 | - | |||||||||||||
| 304 | d->targetStates.resize(targets.size()); | - | ||||||||||||
| 305 | for (int i = 0; i < targets.size(); ++i) {
| 388-390 | ||||||||||||
| 306 | d->targetStates[i] = targets.at(i); | - | ||||||||||||
| 307 | } executed 390 times by 2 tests: end of blockExecuted by:
| 390 | ||||||||||||
| 308 | - | |||||||||||||
| 309 | emit targetStatesChanged(QPrivateSignal()); | - | ||||||||||||
| 310 | } executed 388 times by 2 tests: end of blockExecuted by:
| 388 | ||||||||||||
| 311 | - | |||||||||||||
| 312 | /*! | - | ||||||||||||
| 313 | Returns the type of the transition. | - | ||||||||||||
| 314 | */ | - | ||||||||||||
| 315 | QAbstractTransition::TransitionType QAbstractTransition::transitionType() const | - | ||||||||||||
| 316 | { | - | ||||||||||||
| 317 | Q_D(const QAbstractTransition); | - | ||||||||||||
| 318 | return d->transitionType; executed 1389 times by 2 tests: return d->transitionType;Executed by:
| 1389 | ||||||||||||
| 319 | } | - | ||||||||||||
| 320 | - | |||||||||||||
| 321 | /*! | - | ||||||||||||
| 322 | Sets the type of the transition to \a type. | - | ||||||||||||
| 323 | */ | - | ||||||||||||
| 324 | void QAbstractTransition::setTransitionType(TransitionType type) | - | ||||||||||||
| 325 | { | - | ||||||||||||
| 326 | Q_D(QAbstractTransition); | - | ||||||||||||
| 327 | d->transitionType = type; | - | ||||||||||||
| 328 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 329 | - | |||||||||||||
| 330 | /*! | - | ||||||||||||
| 331 | Returns the state machine that this transition is part of, or 0 if the | - | ||||||||||||
| 332 | transition is not part of a state machine. | - | ||||||||||||
| 333 | */ | - | ||||||||||||
| 334 | QStateMachine *QAbstractTransition::machine() const | - | ||||||||||||
| 335 | { | - | ||||||||||||
| 336 | Q_D(const QAbstractTransition); | - | ||||||||||||
| 337 | return d->machine(); executed 147 times by 2 tests: return d->machine();Executed by:
| 147 | ||||||||||||
| 338 | } | - | ||||||||||||
| 339 | - | |||||||||||||
| 340 | #ifndef QT_NO_ANIMATION | - | ||||||||||||
| 341 | - | |||||||||||||
| 342 | /*! | - | ||||||||||||
| 343 | Adds the given \a animation to this transition. | - | ||||||||||||
| 344 | The transition does not take ownership of the animation. | - | ||||||||||||
| 345 | - | |||||||||||||
| 346 | \sa removeAnimation(), animations() | - | ||||||||||||
| 347 | */ | - | ||||||||||||
| 348 | void QAbstractTransition::addAnimation(QAbstractAnimation *animation) | - | ||||||||||||
| 349 | { | - | ||||||||||||
| 350 | Q_D(QAbstractTransition); | - | ||||||||||||
| 351 | if (!animation) {
| 1-26 | ||||||||||||
| 352 | qWarning("QAbstractTransition::addAnimation: cannot add null animation"); | - | ||||||||||||
| 353 | return; executed 1 time by 1 test: return;Executed by:
| 1 | ||||||||||||
| 354 | } | - | ||||||||||||
| 355 | d->animations.append(animation); | - | ||||||||||||
| 356 | } executed 26 times by 1 test: end of blockExecuted by:
| 26 | ||||||||||||
| 357 | - | |||||||||||||
| 358 | /*! | - | ||||||||||||
| 359 | Removes the given \a animation from this transition. | - | ||||||||||||
| 360 | - | |||||||||||||
| 361 | \sa addAnimation() | - | ||||||||||||
| 362 | */ | - | ||||||||||||
| 363 | void QAbstractTransition::removeAnimation(QAbstractAnimation *animation) | - | ||||||||||||
| 364 | { | - | ||||||||||||
| 365 | Q_D(QAbstractTransition); | - | ||||||||||||
| 366 | if (!animation) {
| 1 | ||||||||||||
| 367 | qWarning("QAbstractTransition::removeAnimation: cannot remove null animation"); | - | ||||||||||||
| 368 | return; executed 1 time by 1 test: return;Executed by:
| 1 | ||||||||||||
| 369 | } | - | ||||||||||||
| 370 | d->animations.removeOne(animation); | - | ||||||||||||
| 371 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 372 | - | |||||||||||||
| 373 | /*! | - | ||||||||||||
| 374 | Returns the list of animations associated with this transition, or an empty | - | ||||||||||||
| 375 | list if it has no animations. | - | ||||||||||||
| 376 | - | |||||||||||||
| 377 | \sa addAnimation() | - | ||||||||||||
| 378 | */ | - | ||||||||||||
| 379 | QList<QAbstractAnimation*> QAbstractTransition::animations() const | - | ||||||||||||
| 380 | { | - | ||||||||||||
| 381 | Q_D(const QAbstractTransition); | - | ||||||||||||
| 382 | return d->animations; executed 1397 times by 2 tests: return d->animations;Executed by:
| 1397 | ||||||||||||
| 383 | } | - | ||||||||||||
| 384 | - | |||||||||||||
| 385 | #endif | - | ||||||||||||
| 386 | - | |||||||||||||
| 387 | /*! | - | ||||||||||||
| 388 | \fn QAbstractTransition::eventTest(QEvent *event) | - | ||||||||||||
| 389 | - | |||||||||||||
| 390 | This function is called to determine whether the given \a event should cause | - | ||||||||||||
| 391 | this transition to trigger. Reimplement this function and return true if the | - | ||||||||||||
| 392 | event should trigger the transition, otherwise return false. | - | ||||||||||||
| 393 | */ | - | ||||||||||||
| 394 | - | |||||||||||||
| 395 | /*! | - | ||||||||||||
| 396 | \fn QAbstractTransition::onTransition(QEvent *event) | - | ||||||||||||
| 397 | - | |||||||||||||
| 398 | This function is called when the transition is triggered. The given \a event | - | ||||||||||||
| 399 | is what caused the transition to trigger. Reimplement this function to | - | ||||||||||||
| 400 | perform custom processing when the transition is triggered. | - | ||||||||||||
| 401 | */ | - | ||||||||||||
| 402 | - | |||||||||||||
| 403 | /*! | - | ||||||||||||
| 404 | \fn QAbstractTransition::triggered() | - | ||||||||||||
| 405 | - | |||||||||||||
| 406 | This signal is emitted when the transition has been triggered (after | - | ||||||||||||
| 407 | onTransition() has been called). | - | ||||||||||||
| 408 | */ | - | ||||||||||||
| 409 | - | |||||||||||||
| 410 | /*! | - | ||||||||||||
| 411 | \fn QAbstractTransition::targetStateChanged() | - | ||||||||||||
| 412 | \since 5.4 | - | ||||||||||||
| 413 | - | |||||||||||||
| 414 | This signal is emitted when the targetState property is changed. | - | ||||||||||||
| 415 | - | |||||||||||||
| 416 | \sa QAbstractTransition::targetState | - | ||||||||||||
| 417 | */ | - | ||||||||||||
| 418 | - | |||||||||||||
| 419 | /*! | - | ||||||||||||
| 420 | \fn QAbstractTransition::targetStatesChanged() | - | ||||||||||||
| 421 | \since 5.4 | - | ||||||||||||
| 422 | - | |||||||||||||
| 423 | This signal is emitted when the targetStates property is changed. | - | ||||||||||||
| 424 | - | |||||||||||||
| 425 | \sa QAbstractTransition::targetStates | - | ||||||||||||
| 426 | */ | - | ||||||||||||
| 427 | - | |||||||||||||
| 428 | /*! | - | ||||||||||||
| 429 | \reimp | - | ||||||||||||
| 430 | */ | - | ||||||||||||
| 431 | bool QAbstractTransition::event(QEvent *e) | - | ||||||||||||
| 432 | { | - | ||||||||||||
| 433 | return QObject::event(e); executed 4 times by 1 test: return QObject::event(e);Executed by:
| 4 | ||||||||||||
| 434 | } | - | ||||||||||||
| 435 | - | |||||||||||||
| 436 | QT_END_NAMESPACE | - | ||||||||||||
| 437 | - | |||||||||||||
| 438 | #endif //QT_NO_STATEMACHINE | - | ||||||||||||
| Source code | Switch to Preprocessed file |