From 70b384721053d6d8d96b18a95bd27097f1556c89 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 5 Oct 2009 22:44:08 +0000 Subject: [PATCH] make moving between items with different parents work a bit better ;) svn path=/trunk/KDE/kdelibs/; revision=1031762 --- widgets/itembackground.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/widgets/itembackground.cpp b/widgets/itembackground.cpp index 17cc4b444..f0cdb86c0 100644 --- a/widgets/itembackground.cpp +++ b/widgets/itembackground.cpp @@ -166,7 +166,15 @@ void ItemBackground::setTargetItem(QGraphicsItem *target) d->target = target; if (target) { setZValue(target->zValue() - 1); - setParentItem(target->parentItem()); + if (parentItem() != target->parentItem()) { + QTransform t = transform(); + setTransform(QTransform()); + QRectF geom = mapToScene(geometry()).boundingRect(); + setParentItem(target->parentItem()); + setGeometry(mapFromScene(geom).boundingRect()); + setTransform(t); + } + QRectF rect = target->boundingRect(); rect.moveTopLeft(target->pos()); setTarget(rect);