6#include <QtCore/qcoreapplication.h>
7#include <QtCore/qelapsedtimer.h>
8#include "private/qabstractanimationjob_p.h"
9#include <private/qobject_p.h>
23 Q_DECLARE_PUBLIC(QQuickFrameAnimation)
83 QElapsedTimer elapsedTimer;
85 qreal frameTime = 0.0;
86 qreal smoothFrameTime = 0.0;
87 qreal elapsedTime = 0.0;
88 qint64 prevFrameTimeNs = 0;
89 qint64 prevElapsedTimeNs = 0;
92 bool componentComplete =
false;
93 bool firstTick =
true;
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146QQuickFrameAnimation::QQuickFrameAnimation(QObject *parent)
147 : QObject(*(
new QQuickFrameAnimationPrivate), parent)
149 Q_D(QQuickFrameAnimation);
150 d->frameJob.addAnimationChangeListener(d, QAbstractAnimationJob::CurrentLoop);
151 d->frameJob.setLoopCount(-1);
155
156
157
158
161
162
163
164
165
166
167
168
169bool QQuickFrameAnimation::isRunning()
const
171 Q_D(
const QQuickFrameAnimation);
175void QQuickFrameAnimation::setRunning(
bool running)
177 Q_D(QQuickFrameAnimation);
178 if (d->running != running) {
179 d->running = running;
181 Q_EMIT runningChanged();
187
188
189
190
191
192
193
194
195bool QQuickFrameAnimation::isPaused()
const
197 Q_D(
const QQuickFrameAnimation);
201void QQuickFrameAnimation::setPaused(
bool paused)
203 Q_D(QQuickFrameAnimation);
204 if (d->paused != paused) {
206 Q_EMIT pausedChanged();
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248int QQuickFrameAnimation::currentFrame()
const
250 Q_D(
const QQuickFrameAnimation);
251 return d->currentFrame;
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285qreal QQuickFrameAnimation::frameTime()
const
287 Q_D(
const QQuickFrameAnimation);
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313qreal QQuickFrameAnimation::smoothFrameTime()
const
315 Q_D(
const QQuickFrameAnimation);
316 return d->smoothFrameTime;
320
321
322
323
324
325
326
327qreal QQuickFrameAnimation::elapsedTime()
const
329 Q_D(
const QQuickFrameAnimation);
330 return d->elapsedTime;
334
335
336
337
338
339
340void QQuickFrameAnimation::start()
346
347
348
349
350
351
352void QQuickFrameAnimation::stop()
359
360
361
362
363
364
365
366void QQuickFrameAnimation::restart()
373
374
375
376
377
378
379void QQuickFrameAnimation::pause()
385
386
387
388
389
390
391void QQuickFrameAnimation::resume()
397
398
399
400
401
402
403
404
405
406
407
408
409void QQuickFrameAnimation::reset()
411 Q_D(QQuickFrameAnimation);
414 d->prevElapsedTimeNs = 0;
415 d->elapsedTimer.start();
419
420
421void QQuickFrameAnimation::classBegin()
423 Q_D(QQuickFrameAnimation);
424 d->componentComplete =
false;
428
429
430void QQuickFrameAnimation::componentComplete()
432 Q_D(QQuickFrameAnimation);
433 d->componentComplete =
true;
438
439
440void QQuickFrameAnimation::setCurrentFrame(
int frame)
442 Q_D(QQuickFrameAnimation);
443 if (d->currentFrame != frame) {
444 d->currentFrame = frame;
445 Q_EMIT currentFrameChanged();
450
451
452void QQuickFrameAnimation::setElapsedTime(qreal elapsedTime)
454 Q_D(QQuickFrameAnimation);
455 if (!qFuzzyCompare(d->elapsedTime, elapsedTime)) {
456 d->elapsedTime = elapsedTime;
457 Q_EMIT elapsedTimeChanged();
463#include "moc_qquickframeanimation_p.cpp"
int duration() const override
Combined button and popup list for selecting options.