2016-11-24 15 views
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(); 
} 

アニメーションにはさらにありますが、問題を示すビットにコードを単純化しました。アイテムは描画され、必要に応じて回転しますが、ループごとに目に見える瞬間に停止します。 QTimeLineが使用するデフォルトではQGraphicsItemAnimationはすべてのQTimeLineループの後に一時停止します

答えて

0

に設定した曲線:

QTimeLine::EaseInOutCurve 

は値が徐々に成長して開始し、その後、着実に実行し、その後、再びゆっくりと成長することを意味します。リニアにsetting the curve shapeをお試しください:

QTimeLine::LinearCurve 
+0

おかげで、私はドキュメントでそれを逃したことができるかわかりません... – smsware

関連する問題