Don't crash on use when detaching extenderitems while having widgets locked. Instead just move the item back where it came from.

svn path=/trunk/KDE/kdelibs/; revision=895345
This commit is contained in:
Rob Scheepmaker 2008-12-10 13:51:26 +00:00
parent aa49665c6c
commit 7ae063b1ec

View File

@ -744,8 +744,14 @@ void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Applet *applet = containment->addApplet("internal:extender",
QVariantList(),
QRectF(containment->mapFromScene(mousePos), size()));
setExtender(applet->d->extender);
extenderCreated = true;
if (applet) {
setExtender(applet->d->extender);
extenderCreated = true;
} else {
kDebug() << "Creating internal:extender applet failed, probably "
<< "because widgets are locked.";
}
}
}
}
@ -754,6 +760,7 @@ void ExtenderItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
//back to where it came from.
if (!extenderCreated) {
setExtender(extender());
kDebug() << "Move the item back to where it came from.";
}
}
}