mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
remove QTimeLine::CurveShape enum, property setter and getter for it
upstream commit:
072fb7de51
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8093ab8f7e
commit
240e980b8c
4 changed files with 14 additions and 108 deletions
2
README
2
README
|
@ -84,7 +84,7 @@ QTBUG-12564, QTBUG-20028, QTBUG-71967, QTBUG-70956, QTBUG-71446, QTBUG-61307,
|
|||
QTBUG-27287, QTBUG-25143, QTBUG-22833, QTBUG-57399, QTBUG-59159, QTBUG-15773,
|
||||
QTBUG-70506, QTBUG-46054, QTBUG-11223, QTBUG-63108, QTBUG-6932, QTBUG-42365,
|
||||
QTBUG-83817, QTBUG-4341, QTBUG-36933, QTBUG-49113, QTBUG-69920, QTBUG-40015,
|
||||
QTBUG-54942, QTBUG-91261, QTBUG-73445, QTBUG-21098, QTBUG-59966
|
||||
QTBUG-54942, QTBUG-91261, QTBUG-73445, QTBUG-21098, QTBUG-59966, QTBUG-85520
|
||||
|
||||
Unless you use QMake and QDoc porting to Katie or even supporting it along with
|
||||
Qt4 in the same codebase is trivial and requires only minor changes because
|
||||
|
|
|
@ -190,14 +190,14 @@ void QTimeLinePrivate::setCurrentTime(int msecs)
|
|||
valueForTime() and emitting valueChanged(). By default, valueForTime()
|
||||
applies an interpolation algorithm to generate these value. You can choose
|
||||
from a set of predefined timeline algorithms by calling
|
||||
setCurveShape().
|
||||
setEasingCurve().
|
||||
|
||||
Note that by default, QTimeLine uses the EaseInOut curve shape,
|
||||
which provides a value that grows slowly, then grows steadily, and
|
||||
finally grows slowly. For a custom timeline, you can reimplement
|
||||
valueForTime(), in which case QTimeLine's curveShape property is ignored.
|
||||
valueForTime(), in which case QTimeLine's easing curve is ignored.
|
||||
|
||||
\sa QProgressBar, QProgressDialog, QGraphicsItemAnimation
|
||||
\sa QProgressBar, QProgressDialog, QGraphicsItemAnimation, QEasingCurve
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -234,24 +234,6 @@ void QTimeLinePrivate::setCurrentTime(int msecs)
|
|||
\sa setDirection()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum QTimeLine::CurveShape
|
||||
|
||||
This enum describes the default shape of QTimeLine's value curve. The
|
||||
default, shape is EaseInOutCurve. The curve defines the relation
|
||||
between the value and the timeline.
|
||||
|
||||
\value EaseInCurve The value starts growing slowly, then increases in speed.
|
||||
\value EaseOutCurve The value starts growing steadily, then ends slowly.
|
||||
\value EaseInOutCurve The value starts growing slowly, then runs steadily, then grows slowly again.
|
||||
\value LinearCurve The value grows linearly (e.g., if the duration is 1000 ms,
|
||||
the value at time 500 ms is 0.5).
|
||||
\value SineCurve The value grows sinusoidally.
|
||||
\value CosineCurve The value grows cosinusoidally.
|
||||
|
||||
\sa setCurveShape()
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QTimeLine::valueChanged(qreal value)
|
||||
|
||||
|
@ -476,76 +458,12 @@ void QTimeLine::setUpdateInterval(int interval)
|
|||
d->updateInterval = interval;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QTimeLine::curveShape
|
||||
\brief the shape of the timeline curve.
|
||||
|
||||
The curve shape describes the relation between the time and value for the
|
||||
base implementation of valueForTime().
|
||||
|
||||
If you have reimplemented valueForTime(), this value is ignored.
|
||||
|
||||
By default, this property is set to \l EaseInOutCurve.
|
||||
|
||||
\sa valueForTime()
|
||||
*/
|
||||
QTimeLine::CurveShape QTimeLine::curveShape() const
|
||||
{
|
||||
Q_D(const QTimeLine);
|
||||
switch (d->easingCurve.type()) {
|
||||
case QEasingCurve::InOutSine:
|
||||
return EaseInOutCurve;
|
||||
case QEasingCurve::InCurve:
|
||||
return EaseInCurve;
|
||||
case QEasingCurve::OutCurve:
|
||||
return EaseOutCurve;
|
||||
case QEasingCurve::Linear:
|
||||
return LinearCurve;
|
||||
case QEasingCurve::SineCurve:
|
||||
return SineCurve;
|
||||
case QEasingCurve::CosineCurve:
|
||||
return CosineCurve;
|
||||
default:
|
||||
return EaseInOutCurve;
|
||||
}
|
||||
}
|
||||
|
||||
void QTimeLine::setCurveShape(CurveShape shape)
|
||||
{
|
||||
switch (shape) {
|
||||
case EaseInOutCurve:
|
||||
setEasingCurve(QEasingCurve(QEasingCurve::InOutSine));
|
||||
break;
|
||||
case EaseInCurve:
|
||||
setEasingCurve(QEasingCurve(QEasingCurve::InCurve));
|
||||
break;
|
||||
case EaseOutCurve:
|
||||
setEasingCurve(QEasingCurve(QEasingCurve::OutCurve));
|
||||
break;
|
||||
case LinearCurve:
|
||||
setEasingCurve(QEasingCurve(QEasingCurve::Linear));
|
||||
break;
|
||||
case SineCurve:
|
||||
setEasingCurve(QEasingCurve(QEasingCurve::SineCurve));
|
||||
break;
|
||||
case CosineCurve:
|
||||
setEasingCurve(QEasingCurve(QEasingCurve::CosineCurve));
|
||||
break;
|
||||
default:
|
||||
setEasingCurve(QEasingCurve(QEasingCurve::InOutSine));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QTimeLine::easingCurve
|
||||
|
||||
\since 4.6
|
||||
|
||||
Specifies the easing curve that the timeline will use.
|
||||
If both easing curve and curveShape are set, the last set property will
|
||||
override the previous one. (If valueForTime() is reimplemented it will
|
||||
override both)
|
||||
*/
|
||||
|
||||
QEasingCurve QTimeLine::easingCurve() const
|
||||
|
@ -630,7 +548,7 @@ int QTimeLine::frameForTime(int msec) const
|
|||
Reimplement this function to provide a custom curve shape for your
|
||||
timeline.
|
||||
|
||||
\sa CurveShape, frameForTime()
|
||||
\sa easingCurve, frameForTime()
|
||||
*/
|
||||
qreal QTimeLine::valueForTime(int msec) const
|
||||
{
|
||||
|
|
|
@ -38,7 +38,6 @@ class Q_CORE_EXPORT QTimeLine : public QObject
|
|||
Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime)
|
||||
Q_PROPERTY(Direction direction READ direction WRITE setDirection)
|
||||
Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount)
|
||||
Q_PROPERTY(CurveShape curveShape READ curveShape WRITE setCurveShape)
|
||||
Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve)
|
||||
public:
|
||||
enum State {
|
||||
|
@ -50,14 +49,6 @@ public:
|
|||
Forward,
|
||||
Backward
|
||||
};
|
||||
enum CurveShape {
|
||||
EaseInCurve,
|
||||
EaseOutCurve,
|
||||
EaseInOutCurve,
|
||||
LinearCurve,
|
||||
SineCurve,
|
||||
CosineCurve
|
||||
};
|
||||
|
||||
explicit QTimeLine(int duration = 1000, QObject *parent = nullptr);
|
||||
virtual ~QTimeLine();
|
||||
|
@ -82,9 +73,6 @@ public:
|
|||
int updateInterval() const;
|
||||
void setUpdateInterval(int interval);
|
||||
|
||||
CurveShape curveShape() const;
|
||||
void setCurveShape(CurveShape shape);
|
||||
|
||||
QEasingCurve easingCurve() const;
|
||||
void setEasingCurve(const QEasingCurve &curve);
|
||||
|
||||
|
|
|
@ -336,13 +336,13 @@ void tst_QTimeLine::loopCount()
|
|||
void tst_QTimeLine::interpolation()
|
||||
{
|
||||
QTimeLine timeLine(400);
|
||||
QCOMPARE(timeLine.curveShape(), QTimeLine::EaseInOutCurve);
|
||||
QCOMPARE(timeLine.easingCurve().type(), QEasingCurve::InOutSine);
|
||||
timeLine.setFrameRange(100, 200);
|
||||
timeLine.setCurveShape(QTimeLine::LinearCurve);
|
||||
QCOMPARE(timeLine.curveShape(), QTimeLine::LinearCurve);
|
||||
timeLine.setEasingCurve(QEasingCurve(QEasingCurve::Linear));
|
||||
QCOMPARE(timeLine.easingCurve().type(), QEasingCurve::Linear);
|
||||
|
||||
// smooth
|
||||
timeLine.setCurveShape(QTimeLine::EaseInOutCurve);
|
||||
timeLine.setEasingCurve(QEasingCurve(QEasingCurve::InOutSine));
|
||||
timeLine.start();
|
||||
QTest::qWait(100);
|
||||
QCOMPARE(timeLine.state(), QTimeLine::Running);
|
||||
|
@ -353,7 +353,7 @@ void tst_QTimeLine::interpolation()
|
|||
timeLine.setCurrentTime(0); // ### todo reset?
|
||||
|
||||
// linear
|
||||
timeLine.setCurveShape(QTimeLine::LinearCurve);
|
||||
timeLine.setEasingCurve(QEasingCurve(QEasingCurve::Linear));
|
||||
timeLine.start();
|
||||
QTest::qWait(100);
|
||||
QCOMPARE(timeLine.state(), QTimeLine::Running);
|
||||
|
@ -401,7 +401,7 @@ void tst_QTimeLine::reverse()
|
|||
QFETCH(int, wait2);
|
||||
|
||||
QTimeLine timeLine(duration);
|
||||
timeLine.setCurveShape(QTimeLine::LinearCurve);
|
||||
timeLine.setEasingCurve(QEasingCurve(QEasingCurve::Linear));
|
||||
timeLine.setFrameRange(start, end);
|
||||
|
||||
timeLine.setDirection((QTimeLine::Direction)direction);
|
||||
|
@ -571,7 +571,7 @@ void tst_QTimeLine::multipleTimeLines()
|
|||
void tst_QTimeLine::sineCurve()
|
||||
{
|
||||
QTimeLine timeLine(1000);
|
||||
timeLine.setCurveShape(QTimeLine::SineCurve);
|
||||
timeLine.setEasingCurve(QEasingCurve(QEasingCurve::SineCurve));
|
||||
QCOMPARE(timeLine.valueForTime(0), qreal(0));
|
||||
QCOMPARE(timeLine.valueForTime(250), qreal(0.5));
|
||||
QCOMPARE(timeLine.valueForTime(500), qreal(1));
|
||||
|
@ -582,7 +582,7 @@ void tst_QTimeLine::sineCurve()
|
|||
void tst_QTimeLine::cosineCurve()
|
||||
{
|
||||
QTimeLine timeLine(1000);
|
||||
timeLine.setCurveShape(QTimeLine::CosineCurve);
|
||||
timeLine.setEasingCurve(QEasingCurve(QEasingCurve::CosineCurve));
|
||||
QCOMPARE(timeLine.valueForTime(0), qreal(0.5));
|
||||
QCOMPARE(timeLine.valueForTime(250), qreal(1));
|
||||
QCOMPARE(timeLine.valueForTime(500), qreal(0.5));
|
||||
|
@ -596,7 +596,7 @@ void tst_QTimeLine::outOfRange()
|
|||
QCOMPARE(timeLine.valueForTime(-100), qreal(0));
|
||||
QCOMPARE(timeLine.valueForTime(2000), qreal(1));
|
||||
|
||||
timeLine.setCurveShape(QTimeLine::SineCurve);
|
||||
timeLine.setEasingCurve(QEasingCurve(QEasingCurve::SineCurve));
|
||||
QCOMPARE(timeLine.valueForTime(2000), qreal(0));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue