关于Qt 状态机
QStateMachine
machine->addState(s1);
machine->addState(s2); //加载状态
machine->setInitialState(s1); //设置初始化属性 s1
machine->start(); //开始状态
QState()
s1->assignProperty(ui->pushButton, "text", "Click me"); //当激活状态时, 设置ui->pushButton 的 text 属性, 值为 Click me
s2->addTransition(ui->pushButton, SIGNAL(clicked()), s2); //激活条件,当ui->pushButton clicked的时候, s1状态转换到s2
machine = new QStateMachine;
s1 = new QState();
s1->assignProperty(ui->pushButton, "text", "Click me"); //设置pushButton text 的属性为 Click me
s2 = new QState();
s1->addTransition(ui->pushButton, SIGNAL(clicked()), s2); //激活条件 点击clicked后, 出发转到s2
s2->assignProperty(ui->pushButton, "text", "state2"); //s2 做的事
machine->addState(s1);
machine->addState(s2);
machine->setInitialState(s1); //初始化属性 s1
machine->start(); //开始s1