File: oxygenanimation.h

package info (click to toggle)
oxygen 4%3A6.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,492 kB
  • sloc: cpp: 23,036; python: 39; sh: 14; makefile: 5
file content (54 lines) | stat: -rw-r--r-- 1,127 bytes parent folder | download | duplicates (2)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef oxygenanimation_h
#define oxygenanimation_h
//////////////////////////////////////////////////////////////////////////////
// oxygenanimation.h
// stores event filters and maps widgets to animations for animations
// -------------------
//
// SPDX-FileCopyrightText: 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
//
// SPDX-License-Identifier: MIT
//////////////////////////////////////////////////////////////////////////////

#include <QPointer>
#include <QPropertyAnimation>
#include <QVariant>

#include "oxygen_export.h"

#include "liboxygen.h"

namespace Oxygen
{
class OXYGEN_EXPORT Animation : public QPropertyAnimation
{
    Q_OBJECT

public:
    //! TimeLine shared pointer
    using Pointer = WeakPointer<Animation>;

    //! constructor
    Animation(int duration, QObject *parent)
        : QPropertyAnimation(parent)
    {
        setDuration(duration);
    }

    //! true if running
    bool isRunning(void) const
    {
        return state() == Animation::Running;
    }

    //! restart
    void restart(void)
    {
        if (isRunning())
            stop();
        start();
    }
};
}

#endif