emit a signal when the user clicks the close button.
would perhaps be better to bind it with an action and make it accessible with action("close")? CCMAIL: plasma-devel@kde.org svn path=/trunk/KDE/kdelibs/; revision=1047062
This commit is contained in:
parent
71fa982797
commit
a56c4c381a
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user