From 987ca211c79a4b5c4d659a0000b9a1dfc0e78972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexis=20M=C3=A9nard?= Date: Thu, 8 May 2008 20:26:56 +0000 Subject: [PATCH] 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 --- applet.cpp | 8 ++++++++ containment.cpp | 10 +--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/applet.cpp b/applet.cpp index 421de4991..b776f7a4d 100644 --- a/applet.cpp +++ b/applet.cpp @@ -256,6 +256,14 @@ KConfigGroup Applet::globalConfig() const void Applet::destroy() { //kDebug() << "???????????????? DESTROYING APPLET" << name() << " ???????????????????????????"; + QGraphicsWidget * item = dynamic_cast(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(item->layout()); + if (lay) { + lay->removeItem(this); + } + } if (d->configXml) { d->configXml->setDefaults(); } diff --git a/containment.cpp b/containment.cpp index fb2ab4fc1..d94316ba2 100644 --- a/containment.cpp +++ b/containment.cpp @@ -1024,15 +1024,7 @@ void Containment::Private::appletAnimationComplete(QGraphicsItem *item, Plasma:: while (parent) { if (parent == q) { Applet *applet = qgraphicsitem_cast(item); - - if (applet) { - QGraphicsLinearLayout * lay = dynamic_cast(q->layout()); - if (lay) { - lay->removeItem(applet); - } - applet->destroy(); - } - + applet->destroy(); break; }