blob: 9ceea1e70e9ef564c9fa6f8dd3bf2df26145fd16 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "divelineitem.h"
#include <QPropertyAnimation>
DiveLineItem::DiveLineItem(QGraphicsItem *parent) : QGraphicsLineItem(parent)
{
}
void DiveLineItem::animatedHide()
{
QPropertyAnimation *animation = new QPropertyAnimation(this, "opacity");
connect(animation, SIGNAL(finished()), SLOT(deleteLater()));
animation->setStartValue(1);
animation->setEndValue(0);
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
void DiveLineItem::animateMoveTo(qreal x, qreal y)
{
QPropertyAnimation *animation = new QPropertyAnimation(this, "pos");
animation->setStartValue(property("pos").toPointF());
animation->setEndValue(QPointF(x, y));
animation->start(QAbstractAnimation::DeleteWhenStopped);
}
|