blob: d4d5dccf464e88240bd095b639745372bf425b16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
var button = new QPushButton();
var off = new QState();
off.assignProperty(button, "text", "Off");
var on = new QState();
on.assignProperty(button, "text", "On");
off.addTransition(button, "clicked()", on);
on.addTransition(button, "clicked()", off);
var machine = new QStateMachine();
machine.addState(off);
machine.addState(on);
machine.initialState = off;
machine.start();
button.resize(100, 100);
button.show();
QCoreApplication.exec();
|