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
preferencesAboutTextFull
Craig Watson 8 years ago
parent 6b90a8f333
commit 5d48d55c7f
  1. 3
      src/board/UBBoardController.cpp
  2. 5
      src/domain/UBGraphicsStrokesGroup.cpp

@ -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;
}

Loading…
Cancel
Save