src/corelib/statemachine/qstatemachine.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtCore module of the Qt Toolkit.
     7 ** This file is part of the QtCore module of the Qt Toolkit.
     8 **
     8 **
  1173 {
  1173 {
  1174     delete _startState;
  1174     delete _startState;
  1175     _startState = 0;
  1175     _startState = 0;
  1176 }
  1176 }
  1177 
  1177 
       
  1178 void QStateMachinePrivate::clearHistory()
       
  1179 {
       
  1180     Q_Q(QStateMachine);
       
  1181     QList<QHistoryState*> historyStates = qFindChildren<QHistoryState*>(q);
       
  1182     for (int i = 0; i < historyStates.size(); ++i) {
       
  1183         QHistoryState *h = historyStates.at(i);
       
  1184         QHistoryStatePrivate::get(h)->configuration.clear();
       
  1185     }
       
  1186 }
       
  1187 
  1178 void QStateMachinePrivate::_q_start()
  1188 void QStateMachinePrivate::_q_start()
  1179 {
  1189 {
  1180     Q_Q(QStateMachine);
  1190     Q_Q(QStateMachine);
  1181     Q_ASSERT(state == Starting);
  1191     Q_ASSERT(state == Starting);
  1182     Q_ASSERT(rootState() != 0);
  1192     Q_ASSERT(rootState() != 0);
  1184     configuration.clear();
  1194     configuration.clear();
  1185     qDeleteAll(internalEventQueue);
  1195     qDeleteAll(internalEventQueue);
  1186     internalEventQueue.clear();
  1196     internalEventQueue.clear();
  1187     qDeleteAll(externalEventQueue);
  1197     qDeleteAll(externalEventQueue);
  1188     externalEventQueue.clear();
  1198     externalEventQueue.clear();
       
  1199     clearHistory();
  1189 
  1200 
  1190 #ifdef QSTATEMACHINE_DEBUG
  1201 #ifdef QSTATEMACHINE_DEBUG
  1191     qDebug() << q << ": starting";
  1202     qDebug() << q << ": starting";
  1192 #endif
  1203 #endif
  1193     state = Running;
  1204     state = Running;