Fix saving of groups' positions

Previously, only transforms were saved -- not positions (which are set
if a group is moved by dragging it directly; if dragged by its frame,
its transform is updated instead).

Issue observed was that a group that had been moved would lose its new
position when the document was saved then loaded. (All other transforms
were kept, however).

Now, when duplicating a group before saving a document, position is
included in the group's transform.
preferencesAboutTextFull
Craig Watson 8 years ago
parent 1fd2545692
commit 14849cf538
  1. 4
      src/domain/UBGraphicsScene.cpp

@ -1178,6 +1178,7 @@ UBGraphicsScene* UBGraphicsScene::sceneDeepCopy() const
UBGraphicsGroupContainerItem* groupCloned = group->deepCopyNoChildDuplication();
groupCloned->resetMatrix();
groupCloned->resetTransform();
groupCloned->setPos(0, 0);
bool locked = groupCloned->Delegate()->isLocked();
foreach(QGraphicsItem* eachItem ,group->childItems()){
@ -1191,7 +1192,8 @@ UBGraphicsScene* UBGraphicsScene::sceneDeepCopy() const
copy->addItem(groupCloned);
groupCloned->setMatrix(group->matrix());
groupCloned->setTransform(group->transform());
groupCloned->setTransform(QTransform::fromTranslate(group->pos().x(), group->pos().y()));
groupCloned->setTransform(group->transform(), true);
}
if (ubItem && !stroke && !group && item->isVisible())

Loading…
Cancel
Save