put the remove of the layout if the applet is removed in destroy function, then if we call

it from other place we will be sure the applet will be remove from the layout

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=805590
This commit is contained in:
Alexis Ménard 2008-05-08 20:26:56 +00:00
parent 66413b26ab
commit 987ca211c7
2 changed files with 9 additions and 9 deletions

View File

@ -256,6 +256,14 @@ KConfigGroup Applet::globalConfig() const
void Applet::destroy()
{
//kDebug() << "???????????????? DESTROYING APPLET" << name() << " ???????????????????????????";
QGraphicsWidget * item = dynamic_cast<QGraphicsWidget *>(parentItem());
//is the applet in a containment and is the containment have a layout? if yes, we remove the applet in the layout
if (item) {
QGraphicsLinearLayout * lay = dynamic_cast<QGraphicsLinearLayout *>(item->layout());
if (lay) {
lay->removeItem(this);
}
}
if (d->configXml) {
d->configXml->setDefaults();
}

View File

@ -1024,15 +1024,7 @@ void Containment::Private::appletAnimationComplete(QGraphicsItem *item, Plasma::
while (parent) {
if (parent == q) {
Applet *applet = qgraphicsitem_cast<Applet*>(item);
if (applet) {
QGraphicsLinearLayout * lay = dynamic_cast<QGraphicsLinearLayout *>(q->layout());
if (lay) {
lay->removeItem(applet);
}
applet->destroy();
}
applet->destroy();
break;
}