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
qquickanimatedimage_p.h
Go to the documentation of this file.
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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKANIMATEDIMAGE_P_H
6#define QQUICKANIMATEDIMAGE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <private/qtquickglobal_p.h>
20
22
23#include "qquickimage_p.h"
24
26
27class QMovie;
29
30class Q_QUICK_EXPORT QQuickAnimatedImage : public QQuickImage
31{
32 Q_OBJECT
33
34 Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged)
35 Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
36 Q_PROPERTY(int currentFrame READ currentFrame WRITE setCurrentFrame NOTIFY frameChanged OVERRIDE)
37 Q_PROPERTY(int frameCount READ frameCount NOTIFY frameCountChanged OVERRIDE)
38 Q_PROPERTY(qreal speed READ speed WRITE setSpeed NOTIFY speedChanged REVISION(2, 11))
39 Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged REVISION(6, 12))
40 Q_PROPERTY(FinishBehavior finishBehavior READ finishBehavior WRITE setFinishBehavior NOTIFY
41 finishBehaviorChanged REVISION(6, 12))
42
43 QML_NAMED_ELEMENT(AnimatedImage)
44 QML_ADDED_IN_VERSION(2, 0)
45
46public:
47 enum LoopParameters { Infinite = -1 };
48 Q_ENUM(LoopParameters)
50 enum FinishBehavior : quint8 { FinishAtInitialFrame, FinishAtFinalFrame };
51 Q_ENUM(FinishBehavior)
52
53 QQuickAnimatedImage(QQuickItem *parent=nullptr);
54 ~QQuickAnimatedImage();
55
56 bool isPlaying() const;
57 void setPlaying(bool play);
58
59 bool isPaused() const;
60 void setPaused(bool pause);
61
62 int currentFrame() const override;
63 void setCurrentFrame(int frame) override;
64
65 int frameCount() const override;
66
67 qreal speed() const;
68 void setSpeed(qreal speed);
69
70 // Extends QQuickImage's src property
71 void setSource(const QUrl&) override;
72
73 int loops() const;
74 void setLoops(int loops);
75
76 FinishBehavior finishBehavior() const;
77 void setFinishBehavior(FinishBehavior behavior);
78
79Q_SIGNALS:
80 void playingChanged();
81 void pausedChanged();
82 void frameChanged();
83 void currentFrameChanged();
84 void frameCountChanged();
85 Q_REVISION(2, 11) void speedChanged();
86 Q_REVISION(6, 12) void loopsChanged();
87 Q_REVISION(6, 12) void finishBehaviorChanged();
88 Q_REVISION(6, 12) void finished();
89
90private Q_SLOTS:
91 void movieUpdate();
92 void movieRequestFinished();
93 void playingStatusChanged();
94 void onCacheChanged();
95 void onMovieFinished();
96
97protected:
98 void load() override;
99 void componentComplete() override;
100
101private:
102 Q_DISABLE_COPY(QQuickAnimatedImage)
103 Q_DECLARE_PRIVATE(QQuickAnimatedImage)
104};
105
106QT_END_NAMESPACE
107
108#endif // QQUICKANIMATEDIMAGE_P_H
Combined button and popup list for selecting options.
QT_REQUIRE_CONFIG(quick_animatedimage)