Hello
i have an Problem (maybe its an understanding problem)
i want make an animation with some items. At program Start all Items where init, but only the first 3 should be visible.
After i press a key, the next 3 items should be visible and go to an position.
i have a class which have private QParallelAnimation and a function, where i create new Animation.
in my Constructor of Controller i created the QParallelAnimationGroup and connected it with a slot of Controller-class:
...
_groupH = new QParallelAnimationGroup();
connect(_groupH, SIGNAL(finished()), this, SLOT(loeschenAnimationenH()));
...
...
_groupH = new QParallelAnimationGroup();
connect(_groupH, SIGNAL(finished()), this, SLOT(loeschenAnimationenH()));
...
To copy to clipboard, switch view to plain text mode
void Controller::erstelleAnimation(BasisAnzeigeElement* anz, const QPointF& endPos, QParallelAnimationgroup* group)
{
QPropertyAnimation* anim = new QPropertyAnimation(anz, "pos");
anim->setStartValue(anz->pos());
anim->setEndValue(endPos);
group->addAnimation(anim);
}
void Controller::erstelleAnimation(BasisAnzeigeElement* anz, const QPointF& endPos, QParallelAnimationgroup* group)
{
QPropertyAnimation* anim = new QPropertyAnimation(anz, "pos");
anim->setStartValue(anz->pos());
anim->setEndValue(endPos);
group->addAnimation(anim);
}
To copy to clipboard, switch view to plain text mode
and in the slot loescheAnimationenH() i clear the _groupH, because when i press a key, i emit a signal to the Controller and want to Display the next 3 Items.
loescheAnimationenH()
{
if(_groupH != NULL)
{
_groupH->clear();
}
}
loescheAnimationenH()
{
if(_groupH != NULL)
{
_groupH->clear();
}
}
To copy to clipboard, switch view to plain text mode
now my Problem is, when i make "anim = new QPropertyAnimation(anz, "pos")" i allways allocate memory, but i never give it free. Does _groupH->clear() deletes all animations and free the memory??
and when yes, how can i fix it?
i thougth to create a List "QList<QPropertyAnimation*> _animList;" and append allways the animation to it and in loescheAnimationH() i check if the _animList is empty, and when not, then i delete _animListe.at(i); and then make a _animListe.clear();
or does i have an understanding problem?
i hope somebodey understands me
with best regards
nudels
Bookmarks