summaryrefslogtreecommitdiffstats
path: root/examples/statemachine/animation/sub-attaq/qanimationstate.h
blob: 7a9165e36df1e0db2adaba2f29a44b9995678e52 (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
29
30
31
32
33
34
35
36
37
38
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#ifndef QANIMATIONSTATE_H
#define QANIMATIONSTATE_H

#include <QState>

QT_BEGIN_NAMESPACE

class QAbstractAnimation;

class QAnimationState : public QState
{
    Q_OBJECT
public:
    QAnimationState(QState *parent = nullptr);
    ~QAnimationState();

    void setAnimation(QAbstractAnimation *animation);
    QAbstractAnimation* animation() const;

signals:
    void animationFinished();

protected:
    void onEntry(QEvent *) override;
    void onExit(QEvent *) override;
    bool event(QEvent *e) override;

private:
    Q_DISABLE_COPY(QAnimationState)
    QAbstractAnimation *m_animation;
};

QT_END_NAMESPACE

#endif // QANIMATIONSTATE_H