Files
aliendefender/ADeditor/animlabel.cpp
buull 0a9679fd99 some bugfix in ADeditor
memory optimization in AD
2010-09-18 00:00:32 +04:00

28 lines
508 B
C++

#include "animlabel.h"
AnimLabel::AnimLabel(QWidget *parent) :
QLabel(parent)
{
startTimer(50);
}
void AnimLabel::setAnimation(const QStringList &anim)
{
for (int i=0; i<images.size(); ++i)
delete images[i];
images.clear();
for (int i=0; i<anim.size(); ++i)
images.append(new QPixmap(anim.at(i)));
imgIndex = 0;
}
void AnimLabel::timerEvent(QTimerEvent *)
{
if (images.isEmpty()) return;
if (imgIndex >= images.size()) imgIndex = 0;
this->setPixmap(*images.at(imgIndex));
imgIndex++;
}