remove the event filter if we're a containment, don't return too early from the filter

This commit is contained in:
Aaron Seigo 2011-07-19 09:36:52 +02:00
parent 239b5a5d10
commit b35d410deb

View File

@ -1799,7 +1799,6 @@ bool Applet::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
break; break;
} }
return false;
} }
switch (event->type()) { switch (event->type()) {
@ -2409,6 +2408,9 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
break; break;
case ItemParentHasChanged: case ItemParentHasChanged:
{ {
if (isContainment()) {
removeSceneEventFilter(this);
} else {
Containment *c = containment(); Containment *c = containment();
if (c && c->containmentType() == Containment::DesktopContainment) { if (c && c->containmentType() == Containment::DesktopContainment) {
installSceneEventFilter(this); installSceneEventFilter(this);
@ -2416,6 +2418,7 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value)
removeSceneEventFilter(this); removeSceneEventFilter(this);
} }
} }
}
break; break;
case ItemPositionHasChanged: case ItemPositionHasChanged:
emit geometryChanged(); emit geometryChanged();