void UBGraphicsPathItem::copyItemParameters(UBItem *copy) const { UBGraphicsPathItem *cp = dynamic_cast<UBGraphicsPathItem*>(copy); if (cp) { cp->setPath(QPainterPath(this->path())); cp->setTransform(this->transform()); cp->setTransformOriginPoint(this->transformOriginPoint()); cp->setFlag(QGraphicsItem::ItemIsMovable, true); cp->setFlag(QGraphicsItem::ItemIsSelectable, true); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked)); cp->setFlag(QGraphicsItem::ItemIsFocusable, true); if(Delegate()->action()){ if(Delegate()->action()->linkType() == eLinkToAudio){ UBGraphicsItemPlayAudioAction* audioAction = dynamic_cast<UBGraphicsItemPlayAudioAction*>(Delegate()->action()); UBGraphicsItemPlayAudioAction* action = new UBGraphicsItemPlayAudioAction(audioAction->fullPath()); cp->Delegate()->setAction(action); } else cp->Delegate()->setAction(Delegate()->action()); } if (hasFillingProperty()) cp->mFillingProperty = new UBFillProperty(*fillingProperty()); if (hasStrokeProperty()) cp->mStrokeProperty = new UBStrokeProperty(*strokeProperty()); cp->mClosed = this->mClosed; for(int i = 0; i < mHandles.size(); i++){ UBFreeHandle *handle = new UBFreeHandle(); handle->setParentItem(cp); handle->setEditableObject(cp); handle->setPos(mHandles.at(i)->pos()); handle->setId(mHandles.at(i)->getId()); handle->hide(); cp->mHandles.push_back(handle); } } }
void UBGraphicsGroupContainerItem::copyItemParameters(UBItem *copy) const { UBGraphicsGroupContainerItem *cp = dynamic_cast<UBGraphicsGroupContainerItem*>(copy); if (cp) { cp->setPos(this->pos()); cp->setTransform(this->transform()); cp->setFlag(QGraphicsItem::ItemIsMovable, true); cp->setFlag(QGraphicsItem::ItemIsSelectable, true); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked)); if(Delegate()->action()){ if(Delegate()->action()->linkType() == eLinkToAudio){ UBGraphicsItemPlayAudioAction* audioAction = dynamic_cast<UBGraphicsItemPlayAudioAction*>(Delegate()->action()); UBGraphicsItemPlayAudioAction* action = new UBGraphicsItemPlayAudioAction(audioAction->fullPath()); cp->Delegate()->setAction(action); } else cp->Delegate()->setAction(Delegate()->action()); } } }