9#include <QWaitCondition>
11#include <QCoreApplication>
12#include <QEasingCurve>
14#include <QtCore/private/qnumeric_p.h>
109 if (
g._t &&
g._t !=
q) {
110 qWarning() <<
"QQuickTimeLine: Cannot modify a QQuickTimeLineValue owned by"
111 <<
"another timeline.";
122 if (!
iter->ops.isEmpty() &&
126 iter->ops.last().length +=
o.length;
127 iter->length +=
o.length;
131 iter->length +=
o.length;
179 return base + delta * pTime;
192 return base + delta * pTime;
298 iter.key()->_t =
nullptr;
300 delete d; d =
nullptr;
328 if (
time <= 0)
return;
348 d->
add(timeLineValue, op);
362 if ((velocity > 0.0f) == (acceleration > 0.0f))
363 acceleration = acceleration * -1.0f;
365 int time =
static_cast<int>(-1000 * velocity / acceleration);
366 if (
time <= 0)
return -1;
369 d->
add(timeLineValue, op);
389 Q_ASSERT(acceleration > 0.0f && maxDistance > 0.0f);
391 qreal maxAccel = (velocity * velocity) / (2.0f * maxDistance);
392 if (maxAccel > acceleration)
393 acceleration = maxAccel;
395 if ((velocity > 0.0f) == (acceleration > 0.0f))
396 acceleration = acceleration * -1.0f;
398 int time =
static_cast<int>(-1000 * velocity / acceleration);
399 if (
time <= 0)
return -1;
402 d->
add(timeLineValue, op);
421 int time =
static_cast<int>(1000 * (2.0f *
distance) / velocity);
422 if (
time <= 0)
return -1;
425 d->
add(timeLineValue, op);
436 if (
time <= 0)
return;
438 d->
add(timeLineValue, op);
447 if (
time <= 0)
return;
449 d->
add(timeLineValue, op);
458 if (
time <= 0)
return;
460 d->
add(timeLineValue, op);
469 if (
time <= 0)
return;
471 d->
add(timeLineValue, op);
479 if (!timeLineValue.
_t)
481 if (timeLineValue.
_t !=
this) {
482 qWarning() <<
"QQuickTimeLine: Cannot reset a QQuickTimeLineValue owned by another timeline.";
486 remove(&timeLineValue);
487 timeLineValue.
_t =
nullptr;
517 int glength =
iter->length;
639 iter.key()->_t =
nullptr;
696 d <<
"QuickTimeLine(" <<
Qt::hex << (
const void *)
this <<
Qt::dec <<
")";
702 return lhs.first < rhs.first;
716 const Op &op = tl.
ops.first();
719 if (
length < advanceTime) {
721 if (advanceTime == 0)
737 Op &op = tl.
ops.first();
738 if (advanceTime == 0 && op.
length != 0)
744 tl.
base =
v->value();
751 bool changed =
false;
758 tl.
ops.removeFirst();
763 bool changed =
false;
771 }
while(!tl.
ops.isEmpty() && advanceTime == 0 && tl.
ops.first().length == 0);
774 if (tl.
ops.isEmpty()) {
778 if (tl.
ops.first().type ==
Op::Pause && pauseTime != 0) {
780 if (pauseTime == -1 || opPauseTime < pauseTime)
781 pauseTime = opPauseTime;
792 std::sort(updates.
begin(), updates.
end());
794 for (
int ii = 0; ii < updates.
size(); ++ii) {
931#include "moc_qquicktimeline_p_p.cpp"
std::deque< UpdateRequest > updateQueue
QAbstractAnimationJob::State state() const
Type type() const
Returns the type of the easing curve.
qreal valueForProgress(qreal progress) const
Return the effective progress for the easing curve at progress.
iterator begin()
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
const_iterator cbegin() const noexcept
const_iterator constEnd() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the ...
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
const_iterator constBegin() const noexcept
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item in the hash.
iterator Iterator
Qt-style synonym for QHash::iterator.
iterator erase(const_iterator it)
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
friend class const_iterator
const_iterator cend() const noexcept
void clear() noexcept(std::is_nothrow_destructible< Node >::value)
Removes all items from the hash and frees up all memory used by it.
bool isEmpty() const noexcept
Returns true if the hash contains no items; otherwise returns false.
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
qsizetype size() const noexcept
void removeAt(qsizetype i)
const_reference at(qsizetype i) const noexcept
QQuickTimeLineCallback & operator=(const QQuickTimeLineCallback &o)
QQuickTimeLineObject * callbackObject() const
virtual ~QQuickTimeLineObject()
The QQuickTimeLineValue class provides a value that can be modified by QQuickTimeLine.
virtual qreal value() const
Return the current value.
The QQuickTimeLine class provides a timeline for controlling animations.
void debugAnimation(QDebug d) const override
friend struct QQuickTimeLinePrivate
void reset(QQuickTimeLineValue &)
Cancel (but don't complete) all scheduled actions for timeLineValue.
void setSyncMode(SyncMode)
Set the timeline's synchronization mode to syncMode.
int accel(QQuickTimeLineValue &, qreal velocity, qreal accel)
Decelerate timeLineValue from the starting velocity to zero at the given acceleration rate.
void callback(const QQuickTimeLineCallback &)
Execute the event.
bool isActive() const
Returns true if the timeline is active.
void complete()
Completes the timeline.
void clear()
Resets the timeline.
void updateCurrentTime(int) override
QQuickTimeLine(QObject *parent=nullptr)
Construct a new QQuickTimeLine with the specified parent.
int accelDistance(QQuickTimeLineValue &, qreal velocity, qreal distance)
Decelerate timeLineValue from the starting velocity to zero over the given distance.
void set(QQuickTimeLineValue &, qreal)
Set the value of timeLineValue.
SyncMode syncMode() const
Return the timeline's synchronization mode.
void move(QQuickTimeLineValue &, qreal destination, int time=500)
Linearly change the timeLineValue from its current value to the given destination value over time mil...
void moveBy(QQuickTimeLineValue &, qreal change, int time=500)
Linearly change the timeLineValue from its current value by the change amount over time milliseconds.
void updated()
Emitted each time the timeline modifies QQuickTimeLineValues.
~QQuickTimeLine()
Destroys the time line.
int duration() const override
Combined button and popup list for selecting options.
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & dec(QTextStream &stream)
Calls QTextStream::setIntegerBase(10) on stream and returns stream.
std::pair< T1, T2 > QPair
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char * destination
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter * iter
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyIsNull(qfloat16 f) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
constexpr const T & qMin(const T &a, const T &b)
static Q_DECL_CONST_FUNCTION bool qt_is_nan(double d)
GLint GLfloat GLfloat GLfloat v2
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLenum GLuint GLenum GLsizei length
GLsizei GLsizei GLfloat distance
GLdouble GLdouble GLdouble GLdouble q
GLfixed GLfixed GLint GLint order
constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
QT_BEGIN_NAMESPACE typedef void(* Callback)(QQmlNotifierEndpoint *, void **)
bool operator<(const QPair< int, Update > &lhs, const QPair< int, Update > &rhs)
Op & operator=(const Op &o)
Op(Type t, int l, qreal v, qreal v2, int o, const QQuickTimeLineCallback &ev=QQuickTimeLineCallback(), const QEasingCurve &es=QEasingCurve())
QQuickTimeLineCallback event
QQuickTimeLine::SyncMode syncMode
qreal value(const Op &op, int time, qreal base, bool *) const
void add(QQuickTimeLineObject &, const Op &)
QQuickTimeLinePrivate(QQuickTimeLine *)
QHash< QQuickTimeLineObject *, TimeLine > Ops
QList< QPair< int, Update > > * updateQueue
Update(const QQuickTimeLineCallback &_e)
Update(QQuickTimeLineValue *_g, qreal _v)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent