Lomiri
Loading...
Searching...
No Matches
EasingCurve Class Reference

The EasingCurve class. More...

#include <plugins/Utils/easingcurve.h>

Inherits QObject.

Signals

void typeChanged ()
 
void periodChanged ()
 
void progressChanged ()
 

Public Member Functions

 EasingCurve (QObject *parent=0)
 
QEasingCurve::Type type () const
 
void setType (const QEasingCurve::Type type)
 
qreal period () const
 
void setPeriod (qreal period)
 
qreal progress () const
 
void setProgress (qreal progress)
 
qreal value () const
 

Properties

QEasingCurve::Type type
 
qreal period
 
qreal progress
 
qreal value
 

Detailed Description

The EasingCurve class.

This class exposes the QEasingCurve C++ API to QML. This is useful for user interactive animations. While the QML Animation types all require a "from", "to" and "duration", this one is based on "period" and "progress". So you can control the position of the animation by changing the progress, also going back and forward in the aimation. Depending on the type of the easing curve, value will return the transformed progress.

Definition at line 36 of file easingcurve.h.

Constructor & Destructor Documentation

◆ EasingCurve()

EasingCurve::EasingCurve ( QObject *  parent = 0)

Definition at line 22 of file easingcurve.cpp.

22 :
23 QObject(parent),
24 m_progress(0),
25 m_value(0)
26{
27
28}

Member Function Documentation

◆ period()

qreal EasingCurve::period ( ) const

Definition at line 45 of file easingcurve.cpp.

46{
47 return m_easingCurve.period();
48}

◆ progress()

qreal EasingCurve::progress ( ) const

Definition at line 56 of file easingcurve.cpp.

57{
58 return m_progress;
59}

◆ setPeriod()

void EasingCurve::setPeriod ( qreal  period)

Definition at line 50 of file easingcurve.cpp.

51{
52 m_easingCurve.setPeriod(period);
53 Q_EMIT periodChanged();
54}

◆ setProgress()

void EasingCurve::setProgress ( qreal  progress)

Definition at line 61 of file easingcurve.cpp.

62{
63 if (m_progress != progress) {
64 m_progress = progress;
65 m_value = m_easingCurve.valueForProgress(m_progress);
66 Q_EMIT progressChanged();
67 }
68}

◆ setType()

void EasingCurve::setType ( const QEasingCurve::Type  type)

Definition at line 35 of file easingcurve.cpp.

36{
37 // FIXME: Working around bug https://bugreports.qt-project.org/browse/QTBUG-38686 here
38 QEasingCurve newCurve;
39 newCurve.setType(type);
40 newCurve.setPeriod(m_easingCurve.period());
41 m_easingCurve = newCurve;
42 Q_EMIT typeChanged();
43}

◆ type()

QEasingCurve::Type EasingCurve::type ( ) const

Definition at line 30 of file easingcurve.cpp.

31{
32 return m_easingCurve.type();
33}

◆ value()

qreal EasingCurve::value ( ) const

Definition at line 70 of file easingcurve.cpp.

71{
72 return m_value;
73}

Property Documentation

◆ period

qreal EasingCurve::period
readwrite

Definition at line 40 of file easingcurve.h.

◆ progress

qreal EasingCurve::progress
readwrite

Definition at line 41 of file easingcurve.h.

◆ type

QEasingCurve::Type EasingCurve::type
readwrite

Definition at line 39 of file easingcurve.h.

◆ value

qreal EasingCurve::value
read

Definition at line 42 of file easingcurve.h.


The documentation for this class was generated from the following files: