diff --git a/extenders/extenderitem.cpp b/extenders/extenderitem.cpp index d11508978..e9b8a8f18 100644 --- a/extenders/extenderitem.cpp +++ b/extenders/extenderitem.cpp @@ -444,6 +444,11 @@ void ExtenderItem::destroy() d->hostApplet()->config("ExtenderItems").deleteGroup(QString::number(d->extenderItemId)); d->extender->d->removeExtenderItem(this); emit d->extender->itemDetached(this); + + if (sender() == d->destroyAction) { + emit destroyActionTriggered(); + } + deleteLater(); } @@ -689,6 +694,7 @@ ExtenderItemPrivate::ExtenderItemPrivate(ExtenderItem *extenderItem, Extender *h dragger(new FrameSvg(extenderItem)), background(new FrameSvg(extenderItem)), collapseIcon(0), + destroyAction(0), title(QString()), mouseOver(false), dragStarted(false), @@ -766,7 +772,7 @@ void ExtenderItemPrivate::updateToolBox() //add the close icon if desired. if (destroyActionVisibility) { - IconWidget *destroyAction = new IconWidget(q); + destroyAction = new IconWidget(q); destroyAction->setSvg("widgets/configuration-icons", "close"); QSizeF size = destroyAction->sizeFromIconSize(iconSize); destroyAction->setMinimumSize(size); diff --git a/extenders/extenderitem.h b/extenders/extenderitem.h index 5cfdcdac3..1388831f4 100644 --- a/extenders/extenderitem.h +++ b/extenders/extenderitem.h @@ -254,6 +254,15 @@ class PLASMA_EXPORT ExtenderItem : public QGraphicsWidget */ void hideCloseButton(); + Q_SIGNALS: + /** + * Emitted when the user closes the extender item with the destroy icon, + * not when the item is destroyed programmatically. + * + * @since 4.4 + */ + void destroyActionTriggered(); + protected: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);