since the item takes ownership of its widget, get rid of it when it changes

svn path=/trunk/KDE/kdelibs/; revision=1185267
This commit is contained in:
Marco Martin 2010-10-12 19:06:34 +00:00
parent b3b18e5d7e
commit 0aa740d33b
2 changed files with 2 additions and 0 deletions

View File

@ -301,6 +301,7 @@ void ExtenderItem::setWidget(QGraphicsItem *widget)
if (d->widget) { if (d->widget) {
d->widget->removeSceneEventFilter(this); d->widget->removeSceneEventFilter(this);
d->layout->removeItem(d->widget); d->layout->removeItem(d->widget);
d->widget->deleteLater();
} }
if (!widget || !widget->isWidget()) { if (!widget || !widget->isWidget()) {

View File

@ -108,6 +108,7 @@ class PLASMA_EXPORT ExtenderItem : public QGraphicsWidget
/** /**
* @param widget The widget that should be wrapped into the extender item. * @param widget The widget that should be wrapped into the extender item.
* It has to be a QGraphicsWidget.
*/ */
void setWidget(QGraphicsItem *widget); void setWidget(QGraphicsItem *widget);