some bugfix in ADeditor

memory optimization in AD
This commit is contained in:
2010-09-18 00:00:32 +04:00
parent 97c8725091
commit 0a9679fd99
14 changed files with 399 additions and 133 deletions

27
ADeditor/animlabel.cpp Normal file
View File

@@ -0,0 +1,27 @@
#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++;
}