Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickanimatorcontroller_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 Gunnar Sletta <gunnar@sletta.org>
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6#ifndef QQUICKANIMATORCONTROLLER_P_H
7#define QQUICKANIMATORCONTROLLER_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
21#include <QtQuick/qsgnode.h>
22#include <QtQuick/qquickitem.h>
23
24#include <QtCore/qmutex.h>
25#include <QtCore/qthread.h>
26
28
29class Q_AUTOTEST_EXPORT QQuickAnimatorController : public QObject, public QAnimationJobChangeListener
30{
31 Q_OBJECT
32
33public:
34 QQuickAnimatorController(QQuickWindow *window);
35 ~QQuickAnimatorController();
36
37 void advance();
38 void beforeNodeSync();
39 void afterNodeSync();
40
41 void animationFinished(QAbstractAnimationJob *job) override;
42 void animationStateChanged(QAbstractAnimationJob *job, QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) override;
43
44 void requestSync();
45
46 // These are called from the GUI thread (the proxy)
47 void start(const QSharedPointer<QAbstractAnimationJob> &job);
48 void cancel(const QSharedPointer<QAbstractAnimationJob> &job);
49 bool isPendingStart(const QSharedPointer<QAbstractAnimationJob> &job) const { return m_rootsPendingStart.contains(job); }
50
51 void lock() { m_mutex.lock(); }
52 void unlock() { m_mutex.unlock(); }
53
54 void windowNodesDestroyed();
55
56 QQuickWindow *window() const { return m_window; }
57
58private:
59 friend class tst_Animators;
60
61 void start_helper(QAbstractAnimationJob *job);
62 void cancel_helper(QAbstractAnimationJob *job);
63
64 QSet<QQuickAnimatorJob * > m_runningAnimators;
65 QHash<QAbstractAnimationJob *, QSharedPointer<QAbstractAnimationJob> > m_animationRoots;
66 QSet<QSharedPointer<QAbstractAnimationJob> > m_rootsPendingStop;
67 QSet<QSharedPointer<QAbstractAnimationJob> > m_rootsPendingStart;
68
69 QQuickWindow *m_window;
70 QMutex m_mutex;
71};
72
73
74
75QT_END_NAMESPACE
76
77#endif // QQUICKANIMATORCONTROLLER_P_H
static void qquickanimator_invalidate_jobs(QAbstractAnimationJob *job)
static void qquickanimator_sync_before_start(QAbstractAnimationJob *job)