[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/desktop/containments/desktop
From: Aaron J. Seigo <aseigo () kde ! org>
Date: 2010-06-15 19:28:15
Message-ID: 20100615192815.F131FAC8D3 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1138348 by aseigo:
use a QPropertyAnimation and close a possible memory leak (not deleting anim after \
stopping it)
M +11 -16 desktoplayout.cpp
M +2 -1 desktoplayout.h
--- trunk/KDE/kdebase/workspace/plasma/desktop/containments/desktop/desktoplayout.cpp \
#1138347:1138348 @@ -16,9 +16,6 @@
#include <KDebug>
-#include <Plasma/Animation>
-#include <Plasma/Animator>
-
#include "desktoplayout.h"
DesktopLayout::DesktopLayout()
@@ -309,21 +306,22 @@
QRectF absoluteGeom = geometryRelativeToAbsolute(spaceItem.user.toInt(), \
effectiveGeom);
if (desktopItem.item->geometry() != absoluteGeom) {
-#if 0
-// FIXME
if (spaceItem.animateMovement) {
if (m_animatingItems.contains(desktopItem.item)) {
- Plasma::Animation *anim = \
m_animatingItems.value(desktopItem.item).data(); + \
QPropertyAnimation *anim = m_animatingItems.value(desktopItem.item).data(); + \
m_animatingItems.remove(desktopItem.item); if (anim) {
+ anim->disconnect(this);
anim->stop();
+ delete anim;
}
- m_animatingItems.remove(desktopItem.item);
}
- Plasma::Animation *anim = \
Plasma::Animator::create(Plasma::Animator::SlideAnimation);
- anim->setProperty("startValue", desktopItem.item->pos());
- anim->setProperty("endValue", absoluteGeom.topLeft().toPoint());
- anim->setTargetWidget(desktopItem.item);
+ QPropertyAnimation *anim = new QPropertyAnimation(this);
+ anim->setStartValue(desktopItem.item->pos());
+ anim->setEndValue(absoluteGeom.topLeft().toPoint());
+ anim->setPropertyName("pos");
+ anim->setTargetObject(desktopItem.item);
anim->start(QAbstractAnimation::DeleteWhenStopped);
m_animatingItems.insert(desktopItem.item, anim);
@@ -331,11 +329,8 @@
spaceItem.animateMovement = false;
} else {
-#endif
desktopItem.item->setGeometry(absoluteGeom);
-#if 0
}
-#endif
}
}
}
@@ -379,9 +374,9 @@
void DesktopLayout::movementFinished()
{
- Plasma::Animation *anim = qobject_cast<Plasma::Animation *>(sender());
+ QPropertyAnimation *anim = qobject_cast<QPropertyAnimation *>(sender());
if (anim) {
- m_animatingItems.remove(anim->targetWidget());
+ m_animatingItems.remove(anim->targetObject());
}
}
--- trunk/KDE/kdebase/workspace/plasma/desktop/containments/desktop/desktoplayout.h \
#1138347:1138348 @@ -14,6 +14,7 @@
#include <QMap>
#include <QList>
#include <QObject>
+#include <QPropertyAnimation>
#include <QTransform>
#include "itemspace.h"
@@ -159,7 +160,7 @@
**/
QMap<int, DesktopLayoutItem> items;
- QHash<QGraphicsItem*, QWeakPointer<Plasma::Animation> > m_animatingItems;
+ QHash<QObject*, QWeakPointer<QPropertyAnimation> > m_animatingItems;
QPointF workingStart;
// layout configuration
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic