1 /*
2     SPDX-FileCopyrightText: 2006 Paolo Capriotti <p.capriotti@gmail.com>
3     SPDX-FileCopyrightText: 2010 Stefan Majewsky <majewsky@gmx.net>
4 
5     SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #include "highlightanimation.h"
9 
10 #include "settings.h"
11 
12 #include <QPen>
13 #include <QPropertyAnimation>
14 #include <QSequentialAnimationGroup>
15 
HighlightAnimation(const QLineF & line)16 HighlightAnimation::HighlightAnimation(const QLineF &line)
17     : QGraphicsLineItem(line)
18 {
19     setPen(QPen(Settings::highlightColor(), 8.0, Qt::SolidLine, Qt::RoundCap));
20 
21     QPropertyAnimation *animation = new QPropertyAnimation(this, "opacity", this);
22     animation->setStartValue(1.0);
23     animation->setEndValue(0.0);
24     QSequentialAnimationGroup *animGroup = new QSequentialAnimationGroup(this);
25     animGroup->addPause(1000);
26     animGroup->addAnimation(animation);
27     animGroup->start(QAbstractAnimation::DeleteWhenStopped);
28     connect(animGroup, &QSequentialAnimationGroup::finished, this, &HighlightAnimation::deleteLater);
29 }
30 
31