File indexing completed on 2024-09-08 03:28:09
0001 /* 0002 SPDX-FileCopyrightText: 2010 Etienne Rebetez <etienne.rebetez@oberwallis.ch> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #include "statemachine.h" 0008 0009 StateSwitcher::StateSwitcher(QStateMachine *machine) 0010 : QState(machine) 0011 { 0012 } 0013 0014 void StateSwitcher::addState(QState *state, QAbstractAnimation *animation, int id) 0015 { 0016 auto trans = new StateSwitchTransition(id); 0017 trans->setTargetState(state); 0018 addTransition(trans); 0019 trans->addAnimation(animation); 0020 } 0021 0022 void StateSwitcher::switchToState(int n) 0023 { 0024 machine()->postEvent(new StateSwitchEvent(n)); 0025 }