Commit 5d48d55c authored by Craig Watson's avatar Craig Watson

Fix for duplicated strokes being positioned badly

Bug likely surfaced when fixing positioning of saved strokes. Quick
tests show that positioning now works both for duplication and
saving/loading
parent 6b90a8f3
......@@ -593,9 +593,6 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
itemSize = commonItem->boundingRect().size();
commonItem->setSelected(false);
UBGraphicsStrokesGroup *stroke = dynamic_cast<UBGraphicsStrokesGroup*>(commonItem);
if (stroke)
itemPos = QPointF(shifting, shifting);
}
UBMimeType::Enum itemMimeType;
......
......@@ -148,12 +148,15 @@ void UBGraphicsStrokesGroup::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
UBItem* UBGraphicsStrokesGroup::deepCopy() const
{
QTransform groupTransform = transform();
QPointF groupPos = pos();
UBGraphicsStrokesGroup* copy = new UBGraphicsStrokesGroup();
copyItemParameters(copy);
copy->resetTransform();
copy->setPos(0,0);
const_cast<UBGraphicsStrokesGroup*>(this)->resetTransform();
const_cast<UBGraphicsStrokesGroup*>(this)->setPos(0,0);
QList<QGraphicsItem*> chl = childItems();
......@@ -175,7 +178,9 @@ UBItem* UBGraphicsStrokesGroup::deepCopy() const
}
}
const_cast<UBGraphicsStrokesGroup*>(this)->setTransform(groupTransform);
const_cast<UBGraphicsStrokesGroup*>(this)->setPos(groupPos);
copy->setTransform(groupTransform);
copy->setPos(groupPos);
return copy;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment