Hi,
I am trying to create and entity and move it using moveReferencePoint funtion. The entity moves but i see the original one as well. How do we delete or keep copies =1 using c++ ?
QSharedPointer<RCircleEntity> myCircle;
void function1()
{
myCircle = QSharedPointer<RCircleEntity>(new RCircleEntity(document, RCircleData(centre, radius)));
RAddObjectOperation op = new RAddObjectOperation(myCircle, false);
documentInterface->applyOperation(op);
}
void function2()
{
myCircle.moveReferencePoint(centre, targetCentre);
RModifyObjectOperation op = new RModifyObjectOperation(myCircle, false);
documentInterface->applyOperation(op); ---> This moves the circle to new centre but I can also see the original circle.
}
Please let me know how to delete the previous circle.
I am using QCAD version : 3.20.1.5
Thanks,
EZM
How to delete original entity after moving in c++
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Re: How to delete original entity after moving in c++
Hi,
Is there any solution/update regarding the above issue.
Thanks,
ezm
Is there any solution/update regarding the above issue.
Thanks,
ezm
Re: How to delete original entity after moving in c++
Adding an object to an operation twice adds two objects. Note that myCircle is just an object under your control. When adding it to the document a new object is created under the control of the document. You'd have to store the ID after adding the object and then query the object from the document, change it, re-add it for the document to know it's the same object.
Re: How to delete original entity after moving in c++
Thanks Andrew!
Re: How to delete original entity after moving in c++
Vannote: please provide more information / context.