some bugfix in ADeditor
memory optimization in AD
This commit is contained in:
27
ADeditor/animlabel.cpp
Normal file
27
ADeditor/animlabel.cpp
Normal 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++;
|
||||
}
|
||||
Reference in New Issue
Block a user