summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/animation/sequential/tracer.cpp
blob: 49bd51e8e9906a378377b49e9dd26f324fd54d88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <QAbstractAnimation>
#include <QDebug>
#include <QPoint>
#include "tracer.h"

Tracer::Tracer(QObject *parent)
    : QObject(parent)
{
}

void Tracer::checkValue()
{
    QAbstractAnimation *animation = static_cast<QAbstractAnimation *>(sender());
    if (time != animation->duration()) {
        qDebug() << "Animation's last recorded time" << time;
        qDebug() << "Expected" << animation->duration();
    }
}

void Tracer::recordValue(const QVariant &value)
{
    QAbstractAnimation *animation = static_cast<QAbstractAnimation *>(sender());
    this->value = value;
    time = animation->currentTime();
}