30 , m_animator(animator)
32 auto *timer =
new QTimer(
this);
34 connect(timer, &QTimer::timeout,
this, [
this]() {
36 m_animator->updatePixmap(
this);
45 const int pixmapSize = qRound(size * p.devicePixelRatioF());
46 return p.copy(m_currentFrame * pixmapSize, 0, pixmapSize, pixmapSize);
50 int m_currentFrame = 0;
64 m_indexes[animation] = index;
65 m_animations[index] = animation;
67 return animation->
pixmap();
72 const QModelIndex index = m_indexes.value(animation);
74 animation->deleteLater();
75 m_indexes.remove(animation);
76 m_animations.remove(index);
LoadingAnimation(LoadingAnimator *animator)
LoadingAnimator(QObject *parent=nullptr)
friend class LoadingAnimation
void updateIndex(const QModelIndex &index)
QPixmap pixmap(const QModelIndex &index)