0
QGraphicsBubbleItem::QGraphicsBubbleItem(qreal x, qreal y, qreal width, qreal height, QGraphicsItem *parentItem)
: QGraphicsEllipseItem(x, y, width, height, parentItem)
{
timer = new QTimeLine(3000);
timer->setFrameRange(0, 100);
//timer->setLoopCount(3);
connect(timer, &QTimeLine::finished, timer, &QTimeLine::start);
animation = new QGraphicsItemAnimation;
animation->setItem(this);
animation->setTimeLine(timer);
animation->setTranslationAt(0, (width/2)*(-1), (height/2)*(-1));
animation->setRotationAt(0.5, 180);
animation->setRotationAt(1, 360);
timer->start();
}
還有更多的動畫,但我已將代碼簡化爲顯示問題的位。項目被繪製並且正在旋轉,但它在每個循環後的可見時刻停止。QGraphicsItemAnimation在每個QTimeLine循環後暫停
謝謝,我不知道我怎麼會在文檔中錯過了... – smsware