mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
This class has animatedHide, animatedMoveTo and QProperty animations. it's very userful for the future creation of the Cartesian Axis that will have the ticks 'flowing' around when it's needed. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
24 lines
710 B
C++
24 lines
710 B
C++
#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);
|
|
}
|