be sure to always have a containment!

BUG:206379

svn path=/trunk/KDE/kdelibs/; revision=1045316
This commit is contained in:
Aaron J. Seigo 2009-11-05 19:17:00 +00:00
parent f0f6b91bd5
commit 7acbfbc47f

View File

@ -514,21 +514,18 @@ void AppletHandle::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
// see which containment it belongs to
Corona * corona = qobject_cast<Corona*>(scene());
if (corona) {
QList<Containment*> containments = corona->containments();
for (int i = 0; i < containments.size(); ++i) {
foreach (Containment *containment, corona->containments()) {
QPointF pos;
QGraphicsView *v;
v = containments[i]->view();
QGraphicsView *v = containment->view();
if (v) {
pos = v->mapToScene(
v->mapFromGlobal(event->screenPos() - m_mousePos));
pos = v->mapToScene(v->mapFromGlobal(event->screenPos() - m_mousePos));
if (containments[i]->sceneBoundingRect().contains(pos)) {
if (containment->sceneBoundingRect().contains(pos)) {
//kDebug() << "new containment = " << containments[i];
//kDebug() << "rect = " << containments[i]->sceneBoundingRect();
// add the applet to the new containment and take it from the old one
//kDebug() << "moving to other containment with position" << pos;;
switchContainment(containments[i], pos);
switchContainment(containment, pos);
break;
}
}
@ -603,6 +600,7 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Plasma::View *v = Plasma::View::topLevelViewAt(event->screenPos());
if (v && v != m_currentView) {
Containment *c = v->containment();
if (c) {
QPoint pos = v->mapFromGlobal(event->screenPos());
//we actually have been dropped on another containment, so
//move there: we have a screenpos, we need a scenepos
@ -610,6 +608,7 @@ void AppletHandle::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
switchContainment(c, v->mapToScene(pos));
}
}
}
if (m_applet) {
QPointF mappedPoint = transform().map(QPointF(deltaScene.x(), deltaScene.y()));