summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/animation/sequential/tracer.cpp
blob: 46e994a89f66d4e1934e37530ff7dcaa285b3db6 (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
26
27
28
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#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();
}