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 void pause(const QSharedPointer<QAbstractAnimationJob> &job);
50 bool isPendingStart(const QSharedPointer<QAbstractAnimationJob> &job) const { return m_rootsPendingStart.contains(job); }
51
52 void lock() { m_mutex.lock(); }
53 void unlock() { m_mutex.unlock(); }
54
55 void windowNodesDestroyed();
56
57 QQuickWindow *window() const { return m_window; }
58
59private:
60 friend class tst_Animators;
61
62 void start_helper(QAbstractAnimationJob *job);
63 void cancel_helper(QAbstractAnimationJob *job);
64
65 QSet<QQuickAnimatorJob * > m_runningAnimators;
66 QHash<QAbstractAnimationJob *, QSharedPointer<QAbstractAnimationJob> > m_animationRoots;
67 QSet<QSharedPointer<QAbstractAnimationJob> > m_rootsPendingStop;
68 QSet<QSharedPointer<QAbstractAnimationJob> > m_rootsPendingStart;
69 QSet<QSharedPointer<QAbstractAnimationJob> > m_rootsPendingPause;
70
71 QQuickWindow *m_window;
72 QMutex m_mutex;
73};
74
75
76
77QT_END_NAMESPACE
78
79#endif // QQUICKANIMATORCONTROLLER_P_H
Combined button and popup list for selecting options.
static void qquickanimator_invalidate_jobs(QAbstractAnimationJob *job)
static void qquickanimator_sync_before_start(QAbstractAnimationJob *job)