diff options
Diffstat (limited to 'src/qml/animations')
-rw-r--r-- | src/qml/animations/qabstractanimationjob.cpp | 8 | ||||
-rw-r--r-- | src/qml/animations/qabstractanimationjob_p.h | 14 | ||||
-rw-r--r-- | src/qml/animations/qanimationgroupjob_p.h | 2 | ||||
-rw-r--r-- | src/qml/animations/qanimationjobutil_p.h | 12 | ||||
-rw-r--r-- | src/qml/animations/qcontinuinganimationgroupjob_p.h | 2 | ||||
-rw-r--r-- | src/qml/animations/qparallelanimationgroupjob_p.h | 2 | ||||
-rw-r--r-- | src/qml/animations/qpauseanimationjob_p.h | 2 | ||||
-rw-r--r-- | src/qml/animations/qsequentialanimationgroupjob_p.h | 2 |
8 files changed, 31 insertions, 13 deletions
diff --git a/src/qml/animations/qabstractanimationjob.cpp b/src/qml/animations/qabstractanimationjob.cpp index 7bb2af476c..a50685ba50 100644 --- a/src/qml/animations/qabstractanimationjob.cpp +++ b/src/qml/animations/qabstractanimationjob.cpp @@ -37,6 +37,9 @@ void QQmlAnimationTimer::unsetJobTimer(QAbstractAnimationJob *animation) if (animation->m_timer == this) animation->m_timer = nullptr; + if (animation->m_isPause) + runningPauseAnimations.removeOne(animation); + if (animation->isGroup()) { QAnimationGroupJob *group = static_cast<QAnimationGroupJob *>(animation); if (const auto children = group->children()) { @@ -214,10 +217,9 @@ void QQmlAnimationTimer::unregisterRunningAnimation(QAbstractAnimationJob *anima if (animation->m_isGroup) return; - if (animation->m_isPause) - runningPauseAnimations.removeOne(animation); - else + if (!animation->m_isPause) runningLeafAnimations--; + Q_ASSERT(runningLeafAnimations >= 0); } diff --git a/src/qml/animations/qabstractanimationjob_p.h b/src/qml/animations/qabstractanimationjob_p.h index 6330b01bb1..7e0fb00021 100644 --- a/src/qml/animations/qabstractanimationjob_p.h +++ b/src/qml/animations/qabstractanimationjob_p.h @@ -30,7 +30,7 @@ class QAnimationGroupJob; class QAnimationJobChangeListener; class QQmlAnimationTimer; -class Q_QML_PRIVATE_EXPORT QAbstractAnimationJob : public QInheritedListNode +class Q_QML_EXPORT QAbstractAnimationJob : public QInheritedListNode { Q_DISABLE_COPY(QAbstractAnimationJob) public: @@ -149,10 +149,10 @@ protected: friend class QQmlAnimationTimer; friend class QAnimationGroupJob; - friend Q_QML_PRIVATE_EXPORT QDebug operator<<(QDebug, const QAbstractAnimationJob *job); + friend Q_QML_EXPORT QDebug operator<<(QDebug, const QAbstractAnimationJob *job); }; -class Q_QML_PRIVATE_EXPORT QAnimationJobChangeListener +class Q_QML_EXPORT QAnimationJobChangeListener { public: virtual ~QAnimationJobChangeListener(); @@ -162,7 +162,7 @@ public: virtual void animationCurrentTimeChanged(QAbstractAnimationJob *, int) {} }; -class Q_QML_PRIVATE_EXPORT QQmlAnimationTimer : public QAbstractAnimationTimer +class Q_QML_EXPORT QQmlAnimationTimer : public QAbstractAnimationTimer { Q_OBJECT private: @@ -193,7 +193,11 @@ public: void updateAnimationsTime(qint64 timeStep) override; //useful for profiling/debugging +#ifdef QT_QAbstractAnimationTimer_runningAnimationCount_IS_CONST + qsizetype runningAnimationCount() const override { return animations.size(); } +#else int runningAnimationCount() override { return animations.size(); } +#endif bool hasStartAnimationPending() const { return startAnimationPending; } @@ -223,7 +227,7 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractAnimationJob::ChangeTypes) -Q_QML_PRIVATE_EXPORT QDebug operator<<(QDebug, const QAbstractAnimationJob *job); +Q_QML_EXPORT QDebug operator<<(QDebug, const QAbstractAnimationJob *job); QT_END_NAMESPACE diff --git a/src/qml/animations/qanimationgroupjob_p.h b/src/qml/animations/qanimationgroupjob_p.h index 3bfaf030a6..d276f63868 100644 --- a/src/qml/animations/qanimationgroupjob_p.h +++ b/src/qml/animations/qanimationgroupjob_p.h @@ -23,7 +23,7 @@ QT_REQUIRE_CONFIG(qml_animation); QT_BEGIN_NAMESPACE -class Q_QML_PRIVATE_EXPORT QAnimationGroupJob : public QAbstractAnimationJob +class Q_QML_EXPORT QAnimationGroupJob : public QAbstractAnimationJob { Q_DISABLE_COPY(QAnimationGroupJob) public: diff --git a/src/qml/animations/qanimationjobutil_p.h b/src/qml/animations/qanimationjobutil_p.h index f4798b127a..fb323d7c89 100644 --- a/src/qml/animations/qanimationjobutil_p.h +++ b/src/qml/animations/qanimationjobutil_p.h @@ -15,10 +15,19 @@ // We mean it. // +#include <QtCore/qcompilerdetection.h> +#include <QtCore/qtconfigmacros.h> + #include <type_traits> QT_REQUIRE_CONFIG(qml_animation); +#if defined(Q_CC_GNU_ONLY) && Q_CC_GNU_ONLY >= 1300 +# define ACTION_IF_DISABLE_DANGLING_POINTER_WARNING QT_WARNING_DISABLE_GCC("-Wdangling-pointer") +#else +# define ACTION_IF_DISABLE_DANGLING_POINTER_WARNING +#endif + // SelfDeletable is used for self-destruction detection along with // ACTION_IF_DELETED and RETURN_IF_DELETED macros. While using, the objects // under test should have a member m_selfDeletable of type SelfDeletable @@ -35,6 +44,8 @@ struct SelfDeletable { // \param action post process if p was deleted under test. #define ACTION_IF_DELETED(p, func, action) \ do { \ + QT_WARNING_PUSH \ + ACTION_IF_DISABLE_DANGLING_POINTER_WARNING \ static_assert(std::is_same<decltype((p)->m_selfDeletable), SelfDeletable>::value, "m_selfDeletable must be SelfDeletable");\ bool *prevWasDeleted = (p)->m_selfDeletable.m_wasDeleted; \ bool wasDeleted = false; \ @@ -46,6 +57,7 @@ do { \ {action;} \ } \ (p)->m_selfDeletable.m_wasDeleted = prevWasDeleted; \ + QT_WARNING_POP \ } while (false) #define RETURN_IF_DELETED(func) \ diff --git a/src/qml/animations/qcontinuinganimationgroupjob_p.h b/src/qml/animations/qcontinuinganimationgroupjob_p.h index d1d621b684..1112262d4b 100644 --- a/src/qml/animations/qcontinuinganimationgroupjob_p.h +++ b/src/qml/animations/qcontinuinganimationgroupjob_p.h @@ -21,7 +21,7 @@ QT_REQUIRE_CONFIG(qml_animation); QT_BEGIN_NAMESPACE -class Q_QML_PRIVATE_EXPORT QContinuingAnimationGroupJob : public QAnimationGroupJob +class Q_QML_EXPORT QContinuingAnimationGroupJob : public QAnimationGroupJob { Q_DISABLE_COPY(QContinuingAnimationGroupJob) public: diff --git a/src/qml/animations/qparallelanimationgroupjob_p.h b/src/qml/animations/qparallelanimationgroupjob_p.h index c86806969f..c4708a8e5d 100644 --- a/src/qml/animations/qparallelanimationgroupjob_p.h +++ b/src/qml/animations/qparallelanimationgroupjob_p.h @@ -21,7 +21,7 @@ QT_REQUIRE_CONFIG(qml_animation); QT_BEGIN_NAMESPACE -class Q_QML_PRIVATE_EXPORT QParallelAnimationGroupJob : public QAnimationGroupJob +class Q_QML_EXPORT QParallelAnimationGroupJob : public QAnimationGroupJob { Q_DISABLE_COPY(QParallelAnimationGroupJob) public: diff --git a/src/qml/animations/qpauseanimationjob_p.h b/src/qml/animations/qpauseanimationjob_p.h index 166dc06a6f..e08186e165 100644 --- a/src/qml/animations/qpauseanimationjob_p.h +++ b/src/qml/animations/qpauseanimationjob_p.h @@ -21,7 +21,7 @@ QT_REQUIRE_CONFIG(qml_animation); QT_BEGIN_NAMESPACE -class Q_QML_PRIVATE_EXPORT QPauseAnimationJob : public QAbstractAnimationJob +class Q_QML_EXPORT QPauseAnimationJob : public QAbstractAnimationJob { Q_DISABLE_COPY(QPauseAnimationJob) public: diff --git a/src/qml/animations/qsequentialanimationgroupjob_p.h b/src/qml/animations/qsequentialanimationgroupjob_p.h index c963043a77..c7d4319b4d 100644 --- a/src/qml/animations/qsequentialanimationgroupjob_p.h +++ b/src/qml/animations/qsequentialanimationgroupjob_p.h @@ -22,7 +22,7 @@ QT_REQUIRE_CONFIG(qml_animation); QT_BEGIN_NAMESPACE class QPauseAnimationJob; -class Q_QML_PRIVATE_EXPORT QSequentialAnimationGroupJob : public QAnimationGroupJob +class Q_QML_EXPORT QSequentialAnimationGroupJob : public QAnimationGroupJob { Q_DISABLE_COPY(QSequentialAnimationGroupJob) public: |