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
qstyleanimation_p.h
Go to the documentation of this file.
1// Copyright (C) 2020 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 QSTYLEANIMATION_P_H
6#define QSTYLEANIMATION_P_H
7
8#include <QtWidgets/private/qtwidgetsglobal_p.h>
10#include "qdatetime.h"
11#include "qimage.h"
12
14
16
17//
18// W A R N I N G
19// -------------
20//
21// This file is not part of the Qt API. It exists for the convenience of
22// qcommonstyle.cpp. This header file may change from version to version
23// without notice, or even be removed.
24//
25// We mean it.
26//
27
28class Q_WIDGETS_EXPORT QStyleAnimation : public QAbstractAnimation
29{
30 Q_OBJECT
31
32public:
33 QStyleAnimation(QObject *target);
34 virtual ~QStyleAnimation();
35
36 QObject *target() const;
37
38 int duration() const override;
39 void setDuration(int duration);
40
41 int delay() const;
42 void setDelay(int delay);
43
44 QTime startTime() const;
45 void setStartTime(QTime time);
46
47 enum FrameRate {
48 DefaultFps,
49 SixtyFps,
50 ThirtyFps,
51 TwentyFps,
52 FifteenFps
53 };
54
55 FrameRate frameRate() const;
56 void setFrameRate(FrameRate fps);
57
58 void updateTarget();
59
60public Q_SLOTS:
61 void start();
62
63protected:
64 virtual bool isUpdateNeeded() const;
65 virtual void updateCurrentTime(int time) override;
66
67private:
68 int _delay;
69 int _duration;
70 QTime _startTime;
71 FrameRate _fps;
72 int _skip;
73};
74
75class Q_WIDGETS_EXPORT QProgressStyleAnimation : public QStyleAnimation
76{
77 Q_OBJECT
78
79public:
80 QProgressStyleAnimation(int speed, QObject *target);
81
82 int animationStep() const;
83 int progressStep(int width) const;
84
85 int speed() const;
86 void setSpeed(int speed);
87
88protected:
89 bool isUpdateNeeded() const override;
90
91private:
92 int _speed;
93 mutable int _step;
94};
95
96class Q_WIDGETS_EXPORT QNumberStyleAnimation : public QStyleAnimation
97{
98 Q_OBJECT
99
100public:
101 QNumberStyleAnimation(QObject *target);
102
103 qreal startValue() const;
104 void setStartValue(qreal value);
105
106 qreal endValue() const;
107 void setEndValue(qreal value);
108
109 qreal currentValue() const;
110
111protected:
112 bool isUpdateNeeded() const override;
113
114private:
115 qreal _start;
116 qreal _end;
117 mutable qreal _prev;
118};
119
120class Q_WIDGETS_EXPORT QBlendStyleAnimation : public QStyleAnimation
121{
122 Q_OBJECT
123
124public:
125 enum Type { Transition, Pulse };
126
127 QBlendStyleAnimation(Type type, QObject *target);
128
129 QImage startImage() const;
130 void setStartImage(const QImage& image);
131
132 QImage endImage() const;
133 void setEndImage(const QImage& image);
134
135 QImage currentImage() const;
136
137protected:
138 virtual void updateCurrentTime(int time) override;
139
140private:
141 Type _type;
142 QImage _start;
143 QImage _end;
144 QImage _current;
145};
146
147class Q_WIDGETS_EXPORT QScrollbarStyleAnimation : public QNumberStyleAnimation
148{
149 Q_OBJECT
150
151public:
152 enum Mode { Activating, Deactivating };
153
154 QScrollbarStyleAnimation(Mode mode, QObject *target);
155
156 Mode mode() const;
157
158 bool wasActive() const;
159 void setActive(bool active);
160
161private slots:
162 void updateCurrentTime(int time) override;
163
164private:
165 Mode _mode;
166 bool _active;
167};
168
169QT_END_NAMESPACE
170
171#endif // QSTYLEANIMATION_P_H
\inmodule QtGui
Definition qimage.h:37
QT_REQUIRE_CONFIG(animation)
QT_REQUIRE_CONFIG(animation)
static QImage blendedImage(const QImage &start, const QImage &end, float alpha)
static const qreal ScrollBarFadeOutDelay
static QT_BEGIN_NAMESPACE const qreal ScrollBarFadeOutDuration