ПОнимаю, что написал для телепатов. Не может ли кто глянуть кодец - что не так?
Прога - это диалог. Вот что в конструкторе диалога
ui.setupUi(this);
QPixmap kineticPix("im.png");
QPixmap bgPix("bkg.jpg");
m_ListObjects = new SListScene( this );
QList<SGraphicsItem *> items;
for (int i = 0; i < 64; ++i) {
SGraphicsItem *item = new SGraphicsItem(kineticPix);
item->setOffset(-kineticPix.width()/2, -kineticPix.height()/2+4*i);
item->setZValue(i);
items << item;
m_ListObjects->addItem(item);
}
// States
QState *rootState = new QState;
QState *ellipseState = new QState(rootState);
QState *figure8State = new QState(rootState);
QState *randomState = new QState(rootState);
QState *tiledState = new QState(rootState);
QState *centeredState = new QState(rootState);
// Values
for (int i = 0; i < items.count(); ++i) {
SGraphicsItem *item = items.at(i);
// Ellipse
ellipseState->assignProperty(item, "pos",
QPointF(cos((i / 63.0) * 6.28) * 250,
sin((i / 63.0) * 6.28) * 250));
// Figure 8
figure8State->assignProperty(item, "pos",
QPointF(sin((i / 63.0) * 6.28) * 250,
sin(((i * 2)/63.0) * 6.28) * 250));
// Random
randomState->assignProperty(item, "pos",
QPointF(-250 + qrand() % 500,
-250 + qrand() % 500));
// Tiled
tiledState->assignProperty(item, "pos",
QPointF(((i % 8) - 4) * kineticPix.width() + kineticPix.width() / 2,
((i / 8) - 4) * kineticPix.height() + kineticPix.height() / 2));
// Centered
centeredState->assignProperty(item, "pos", QPointF());
}
// Ui
ui.allView->setScene( m_playersListObjects );
ui.allView->setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
ui.allView->setBackgroundBrush(bgPix);
ui.allView->setCacheMode(QGraphicsView::CacheBackground);
ui.allView->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QStateMachine states;
states.addState(rootState);
states.setInitialState(rootState);
rootState->setInitialState(randomState);
QParallelAnimationGroup *group = new QParallelAnimationGroup;
for (int i = 0; i < items.count(); ++i) {
QPropertyAnimation *anim = new QPropertyAnimation(items[i], "pos");
anim->setDuration(750 + i * 25);
anim->setEasingCurve(QEasingCurve::InOutBack);
group->addAnimation(anim);
}
QAbstractTransition *trans = rootState->addTransition(ui.pushButton, SIGNAL(pressed()), ellipseState);
trans->addAnimation(group);
trans = rootState->addTransition(ui.PlayerNationality, SIGNAL(currentIndexChanged(int)), figure8State);
trans->addAnimation(group);
QTimer timer;
timer.start(1025);
timer.setSingleShot(true);
trans = rootState->addTransition(&timer, SIGNAL(timeout()), tiledState);
trans->addAnimation(group);
states.start();
Все из примера. Элементы встают в начальную позицию и все.. никакой анимации нету ни разу...