QStateMachine machine;
QState *globalOverview = new QState(&machine);
globalOverview->assignProperty(&view, "zoom", qreal(1.0));
machine.setInitialState(globalOverview);
QPropertyAnimation *animation = new QPropertyAnimation(&view, "zoom");
animation->setDuration(250);
animation->setEasingCurve(QEasingCurve::InOutQuad);
machine.addDefaultAnimation(animation);
for(int i = 0; i < 100; i++) {
ExtensionItem *item = new ExtensionItem(i);
layout.addItem(item);
scene.addItem(item);
QState *state = new QState(&machine);
state->assignProperty(&view, "zoom", qreal(2.0));
globalOverview->addTransition(item, SIGNAL(selected()), state);
state->addTransition(item, SIGNAL(selected()), globalOverview);
state->addTransition(&scene, SIGNAL(selectionCleared()), globalOverview);
}
machine.start();
QStateMachine machine;
QState *globalOverview = new QState(&machine);
globalOverview->assignProperty(&view, "zoom", qreal(1.0));
machine.setInitialState(globalOverview);
QPropertyAnimation *animation = new QPropertyAnimation(&view, "zoom");
animation->setDuration(250);
animation->setEasingCurve(QEasingCurve::InOutQuad);
machine.addDefaultAnimation(animation);
for(int i = 0; i < 100; i++) {
ExtensionItem *item = new ExtensionItem(i);
layout.addItem(item);
scene.addItem(item);
QState *state = new QState(&machine);
state->assignProperty(&view, "zoom", qreal(2.0));
globalOverview->addTransition(item, SIGNAL(selected()), state);
state->addTransition(item, SIGNAL(selected()), globalOverview);
state->addTransition(&scene, SIGNAL(selectionCleared()), globalOverview);
}
machine.start();
To copy to clipboard, switch view to plain text mode
Bookmarks