1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKSPRITESEQUENCE_P_H
5#define QQUICKSPRITESEQUENCE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qtquickglobal_p.h>
19
20QT_REQUIRE_CONFIG(quick_sprite);
21
22#include <QtQuick/QQuickItem>
23
24QT_BEGIN_NAMESPACE
25
26class QSGContext;
27class QQuickSprite;
28class QQuickSpriteEngine;
29class QQuickSpriteSequencePrivate;
30class QSGSpriteNode;
31class Q_QUICK_PRIVATE_EXPORT QQuickSpriteSequence : public QQuickItem
32{
33 Q_OBJECT
34 Q_PROPERTY(bool running READ running WRITE setRunning NOTIFY runningChanged FINAL)
35 Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate NOTIFY interpolateChanged FINAL)
36 Q_PROPERTY(QString goalSprite READ goalSprite WRITE setGoalSprite NOTIFY goalSpriteChanged FINAL)
37 Q_PROPERTY(QString currentSprite READ currentSprite NOTIFY currentSpriteChanged FINAL)
38 //###try to share similar spriteEngines for less overhead?
39 Q_PROPERTY(QQmlListProperty<QQuickSprite> sprites READ sprites FINAL)
40 Q_CLASSINFO("DefaultProperty", "sprites")
41 QML_NAMED_ELEMENT(SpriteSequence)
42 QML_ADDED_IN_VERSION(2, 0)
43
44public:
45 explicit QQuickSpriteSequence(QQuickItem *parent = nullptr);
46
47 QQmlListProperty<QQuickSprite> sprites();
48
49 bool running() const;
50 bool interpolate() const;
51 QString goalSprite() const;
52 QString currentSprite() const;
53
54Q_SIGNALS:
55
56 void runningChanged(bool arg);
57 void interpolateChanged(bool arg);
58 void goalSpriteChanged(const QString &arg);
59 void currentSpriteChanged(const QString &arg);
60
61public Q_SLOTS:
62
63 void jumpTo(const QString &sprite);
64 void setGoalSprite(const QString &sprite);
65 void setRunning(bool arg);
66 void setInterpolate(bool arg);
67
68private Q_SLOTS:
69 void createEngine();
70
71protected:
72 void reset();
73 QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
74private:
75 void prepareNextFrame(QSGSpriteNode *node);
76 QSGSpriteNode* initNode();
77
78private:
79 Q_DECLARE_PRIVATE(QQuickSpriteSequence)
80};
81
82QT_END_NAMESPACE
83
84#endif // QQUICKSPRITESEQUENCE_P_H
85

source code of qtdeclarative/src/quick/items/qquickspritesequence_p.h